[R] How to specify a constant in gnls{nlme}

Jost Burkardt jost.burkardt at web.de
Thu Oct 26 17:34:01 CEST 2006


Hi,

It works for me if i encapsulate the formula within a function

 a =1; b=1;
 f1  <- function(x,v,w) {a/(b+(x/v)^w)}
 fm2 = gnls( y ~ f1(x,v,w), start=list( v=1, w=1)) 

Regards,
Jost

"hong qin" <alongway at gmail.com> writes:

> Hi All,
>
> I have question about speficifying a constant in gnls() from package nlme.
> Here is a testing code:
>
> #############
> library(nlme)
>  x = exp( rnorm(100))
>  y = 1/(1+x) + rnorm(100)/10
>  plot( y ~ x)
>  fm1 = gnls( y ~ 1/(1+(x/v)^w), start=list( v=1, w=1))
>
>  a =1; b=1;
>  fm2 = gnls( y ~ a/(b+(x/v)^w), start=list( v=1, w=1)) #This won't work
> because I don't know to set $a$ and $b$ as constant.
>
> ############
>
> Thanks,
>
> HQ
>
> 	[[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
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list