1 2### The function tests whether a given gradient is given 3### observation-wise. It tests essentially the # of rows 4### in the gradient 5observationGradient <- function(g, nParam) { 6 if(is.null(dim(g))) { 7 if(nParam == 1 & length(g) > 1) 8 return(TRUE) 9 return(FALSE) 10 } 11 if(nrow(g) == 1) 12 return(FALSE) 13 return(TRUE) 14} 15