0

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
  • 1
    Really hard to say without any data. Try to make this a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Where do nlsLM and SSfpl come from? – camille Feb 21 '20 at 20:33
  • Per `r` tag, hover to see: Please provide minimal and reproducible example(s) along with the desired output. Use `dput()` for data and specify all non-base packages with `library()` calls. – Parfait Feb 21 '20 at 20:54

0 Answers0