[R] Generalized least squares using "gnls" function
Ravi Varadhan
rvaradha at jhsph.edu
Thu Jan 15 18:21:25 CET 2004
Hi:
I tried Prof. Ripley's suggestion and I got the following error message:
> ans52g <- gnls(log(b52) ~ p0 + p1/(1 + exp(-(log(dose)-p2)/p3))^p4,
start=list(p0=3,p1=8,p2=2,p3=2,p4=1.5),control=gnlsControl(tol=1.e-07),
weights=varPower(form=~fitted(".")))
Error in varPower(form = ~fitted(".")) : "form" must have a covariate
I also tried without the quotes for the "form" argument, but it did't
work either.
I would really like to use this option since I want to model
heteroscedasticity in my assay response as a power function of the mean
response, where the exponent in the power function is to be estimated
by the GLS procedure, along with the paremeters of the logistic
function.
thanks,
Ravi.
----- Original Message -----
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Date: Thursday, January 15, 2004 12:07 pm
Subject: Re: RE: [R] Generalized least squares using "gnls" function
> The default argument for varPower's `form' arg is form = ~fitted(.)
> I am pretty sure that is the `.' that is not found, and I guess it
> is an
> S/R difference.
>
> I've always had trouble with this form of varPower (even in S). I
> just
> wonder if form = ~fitted(".") might work.
>
>
> On Thu, 15 Jan 2004, Ravi Varadhan wrote:
>
> > Dear Christian:
> >
> > That is not the problem, but thanks for your attempted help. I
> still
> > don't know what the problem is. Has anyone encountered this
> while
> > using "gnls" function in the package "nlme"?
> >
> > thanks again for any help,
> >
> > Ravi.
> >
> >
> >
> > ----- Original Message -----
> > From: Christian Mora <christian_mora at vtr.net>
> > Date: Wednesday, January 14, 2004 7:15 pm
> > Subject: RE: [R] Generalized least squares using "gnls" function
> >
> > > Have you tried removing tol=1.e-07 or changing the value
> considering> > that the error is Object "." not found
> > >
> > > -----Original Message-----
> > > From: r-help-bounces+christian_mora=vtr.net at stat.math.ethz.ch
> > > [mailto:r-help-
> bounces+christian_mora=vtr.net at stat.math.ethz.ch] On
> > > Behalf Of Ravi Varadhan
> > > Sent: Wednesday, January 14, 2004 6:11 PM
> > > To: r-help at stat.math.ethz.ch
> > > Subject: [R] Generalized least squares using "gnls" function
> > >
> > >
> > > Hi:
> > >
> > > I have data from an assay in the form of two vectors, one is
> > > response
> > > and the other is a predictor. When I attempt to fit a 5
> parameter
> > > logistic model with "nls", I get converged parameter
> estimates. I
> > > also
> > > get the same answers with "gnls" without specifying the
> "weights"
> > > argument.
> > >
> > > However, when I attempt to use the "gnls" function and try to
> > > estimate
> > > the variance function, as a power function, I get the
> following
> > > error
> > > message:
> > >
> > > > ans51g <- gnls(log(b51) ~ p0 + p1/(1 + exp(-(log(dose)-
> > > p2)/p3))^p4,
> > >
> start=list(p0=3,p1=1,p2=4,p3=2,p4=1.5),control=gnlsControl(tol=1.e-
> > > 07),weights=varPower())
> > > Error in eval(expr, envir, enclos) : Object "." not found
> > > >
> > >
> > > What am I doing wrong here and how can I do a GLS analysis
> with a
> > > variance function that is estimated from the data?
> > >
> > > Here is my data:
> > >
> > > > b51 <- c(17447.60674, 7060.37234, 2872.53012, 796.40426,
> > > 454.47222, 260.22340, 120.11905, 83.40196, 51.45745,
> > > 36.87912, 26.73256, 25.18681, 17.97674)
> > > > dose <- c( 1.000000e+04, 1.000000e+03, 2.500000e+02,
> > > 6.250000e+01,
> > > 3.125000e+01, 1.562500e+01, 7.812500e+00, 3.906250e+00,
> > > 1.953125e+00, 9.765625e-01, 4.882813e-01, 2.441406e-01,
> 1.000000e-03)
> > >
> > > thanks for the help,
> > > Ravi.
> > >
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch mailing list
> > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > > http://www.R-project.org/posting-guide.html
> > >
> > >
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-
> project.org/posting-guide.html
> >
> >
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.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