I've got a loop to run some regressions for me but it keeps giving me the same error. I've checked the lengths of everything and they're all the same. My current dataframe is 133 columns of 853 rows all in double format. Any ideas how to fix this error?
EDIT: I'm using nlsLM as an augmented version of nls (nonlinear least squares) that's modified to take into account the Levenberg-Marquardt algorithm. For this, I'm using a self-starting four parameter linear model.
reg <- c()
for(i in 1:(ncol(df)-1)) {
reg$i <- nlsLM(df[[i+1]]~SSfpl(time, a, b, c, d), df)
summary(reg)
}
Error in tapply(y, x, mean, na.rm = TRUE) :
arguments must have same length