[R] Simple linear regression

Gorazd Brumen gbrumen at student.ethz.ch
Thu Jul 10 17:31:45 CEST 2003


Dear all,

Thank you all a lot for the help. The commands given by prof. Bates 
were the most direct way to the solution of the problem. 

Once again thank you all,
Gorazd Brumen

V čet, 10.07.2003 ob 16:42, je Douglas Bates poslal(a):
> Martin Maechler <maechler at stat.math.ethz.ch> writes:
> 
> > >>>>> "KKWa" == Ko-Kang Kevin Wang <kwan022 at stat.auckland.ac.nz>
> > >>>>>     on Thu, 10 Jul 2003 23:00:00 +1200 (NZST) writes:
> > 
> >     KKWa> Try: ?lm
> > 
> > no.  see below
> > 
> >     KKWa> On 10 Jul 2003, Gorazd Brumen wrote:
> > 
> >     >> Date: 10 Jul 2003 12:54:46 +0200 From: Gorazd Brumen
> >     >> <gbrumen at student.ethz.ch> To: R-help at stat.math.ethz.ch
> >     >> Subject: [R] Simple linear regression
> >     >> 
> >     >> Dear all,
> >     >> 
> >     >> My friend wants to fit a model of the type
> >     >> 
> >     >> z = a x^n y^m + b,
> >     >> 
> >     >> where x, y, z are data and a, b, n, m are unknown
> >     >> parameters.
> >     >> 
> >     >> How can he transform this to fit in the linear regression
> >     >> framework?  Any help would be appreciated.
> > 
> > He can't.  When all 4   a, b, n, m  are parameters, this is a
> > non-linear regression problem.  --> Function  nls()
> > 
> > Now, effectively 2 of the 4 are linear, 2 are non linear;
> > such a problem is denoted as  `` partially linear least-squares ''
> > In such a case it's quite important (for efficiency and
> > inference reasons) to make use of this fact.
> > 
> >  ---> use  nls(...., method = "plinear" , ....)
> 
> I think it should be 'algorithm = "plinear"'
> 
> The full call would be something like
> 
> nls(z ~ cbind(x^n*y^m, 1), data = mydata, start=c(n = 1.0, m = 2.0),
>     algorithm = "plinear")
> 
> Must the exponents n and m be positive?  If so, I recommend using the
> logarithm of the exponents as the parameters in the optimization
> 
> nls(z ~ cbind(x^exp(logn)*y^exp(logm), 1), data = mydata,
>    start=c(logn = 0., logm = log(2.0)),  algorithm = "plinear")
> 
-- 
Mail 1: gbrumen at student.ethz.ch
Mail 2: gorazd.brumen at fmf.uni-lj.si
Tel.: +41 (0)1 63 34906
Homepage: valjhun.fmf.uni-lj.si/~brumen




More information about the R-help mailing list