[R] Non-Linear Regression Problem

Spencer Graves spencer.graves at pdf.com
Wed Apr 14 18:26:51 CEST 2004


1.  For the equation you mentioned, have you considered the following: 

DF <- data.frame(t.=c(1, 4, 16), Y=c(.8, .45, .04))
# I do NOT use "t" as a name, as it
# may conflict with the matrix transpose function.
fit0 <- lm(log(Y)~t.-1, DF)
fit0
Call:
lm(formula = log(Y) ~ t. - 1, data = DF)

Coefficients:
     t. 
-0.2012 
################

      If this is the problem you really wanted to solve AND you honestly 
need NONLINEAR least squares, I would expect that (-0.2) should provide 
a reasonable starting value for nls: 

 > fit1 <- nls(Y~exp(-THETA*t.), data=DF, start=c(THETA=-0.2))
 > fit1
Nonlinear regression model
  model:  Y ~ exp(-THETA * t.)
   data:  DF
    THETA
0.2034489
 residual sum-of-squares:  0.0003018337
 >

      2.  Alternatively, you could compute the sum of squares for all 
values of THETA = seq(0, .01, 100) in a loop, then find the minimum by 
eye. 

      3.  If this is just a toy example, and your real problem has 
several parameters, "expand.grid" will produce a grid, and you can 
compute the value of your function and the sum of squares of residuals 
at every point in the grid in a single loop, etc. 

      hope this helps.  spencer graves

WilDscOp wrote:

> Dear all,
>
>     I was wondering if there is any way i could do a "Grid Search" on 
> a parameter space using R (as SAS 6.12 and higher can do it) to start 
> the Newton-Gauss Linearization least squares method when i have NO 
> prior information about the parameter.
> W. N. Venables and B. D. Ripley (2002) "Modern Applied Statistics with 
> S", 4 th ed., page 216-7  has a topic "Self-starting non-linear 
> regressions" using negexp.SSival - but i can not solve my hypothetical 
> problem using that - my problem is :
>
> Y = EXP(-(THETA * t)) with data below for estimating THETA:
>
> t        Y
> 1    0.80
> 4     0.45
> 16     0.04
>
> Whatever i could do, is in 
> http://www.angelfire.com/ab5/get5/nonlinear.PDF
>
> Any response / help / comment / suggestion / idea / web-link / replies 
> will be greatly appreciated.
>
> Thanks in advance for your time.
>
> _______________________
>
> Mohammad Ehsanul Karim <wildscop at yahoo.com>
> Institute of Statistical Research and Training
> University of Dhaka, Dhaka- 1000, Bangladesh
>
> ______________________________________________
> 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