[R] nls number of explantory variables
Christoph Buser
buser at stat.math.ethz.ch
Mon Mar 13 09:14:03 CET 2006
Hi Harsh
As indicated in the answer to your first post, it is not so easy
to debug code without the code itself.
1) Have you checked the names of your variables so that you are
sure that they are correct. For example undesired white space
due to the automatic creation of variable names with paste()
results in undesired variable names:
dat <- data.frame(x1 = rnorm(10), "x 2" = rnorm(10), y = rnorm(10))
nls(y ~ beta*x1 + gamma*x2 , data = dat, start = list(beta = 1, gamma = 1))
## variable name "x 2" has been changed to "x.2"
str(dat)
2) If you believe that nls can not handle a certain amount of
variables you can check it easily by yourself. E.g. If your
code works for the variables x1,x2,...,x170, replace one
variable by variable x181 and check if it works.
If it does not work it is not the amount of variables.
In general (also as an answer to your first post: "Non-linear
Regression : Error in eval(expr, envir, enclos)", I would
recommend to do some debugging by starting with code that works
and go stepwise until some errors occurs. If there is a conflict
between two or more variables or a problem with over
parameterization you have a better chance to find it.
Regards,
Christoph
--------------------------------------------------------------
Christoph Buser <buser at stat.math.ethz.ch>
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--------------------------------------------------------------
Cal Stats writes:
> Hi..
>
> is there a limit on the number of explanatory variables in nls ?
>
> i have a dataframe with the columns names x1,x2..,x300
> when i run nls it gives the error: " x181 not found"
>
> thought it does run when i have x1,x2,...,x170 variables.
>
> Thanks
>
> Harsh
>
>
>
>
> ---------------------------------
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list