[R] parameters' value

Douglas Bates bates at stat.wisc.edu
Mon Feb 23 21:24:10 CET 2004


"Duan Zhigang" <zduan1 at uthouston.edu> writes:

> Hi, I am a new user of R. I am trying to use R to do some nonlinear
> modeling. However, I can not find how to get the parameters's value
> back.

> Here is the code in S-plus: 
> 
> ycos1.nl <- nls(y ~ m +ac*cos(2*pi*f*t) +as*sin(2*pi*f*t), start=nl.st, trace=T)
> 
> ## store model info after satisfactory model has been found
> cNL1 <- c(ycos1.nl$parameters[1:3],0)
> 
> What is same code in R? 

The preferred approach is to use the coef extractor function.  This
works in both R and S-PLUS.

coef(ycos1.nl)




More information about the R-help mailing list