I'd like to fit a non-linear model using nls, but I'm getting a non-numeric argument to binary operator error:
df <- data.frame(task=rep(c("x", "y", "z"), each=6), time=rep(c(1:18)), y=c(1, 5, 9, 14, 17, 29, 2, 3, 1, 5, 2, 3, 29, 21, 18, 16, 14, 5))
OLS <- lm(y~ A + time*task, data=df)
I'm trying to get a similar result with the nls function:
NLS <- nls(y ~ A + B*time*task, data=df, start=list(A=1,B=1))
Error in B * time * task : non-numeric argument to binary operator
It seems I'm not using nls the way it should be used, so what is it that am I doing wrong?