[R] Fitting to strange function

Tony Plate tplate at blackmesacapital.com
Thu Nov 13 21:08:08 CET 2003


Is there some reason that the simple & obvious does not work or is in some 
way not adequate?

 > data <- data.frame(x=c(1:5), y=c(1,3,2,NA,4))
 > nls(y ~ A*x^2 +sqrt(0.08*A)*x, data=data, start=list(A=0))
Nonlinear regression model
   model:  y ~ A * x^2 + sqrt(0.08 * A) * x
    data:  data
         A
0.1577584
  residual sum-of-squares:  5.445525
 >

At Thursday 07:54 PM 11/13/2003 +0100, JB wrote:
>At 13.11.2003 (17:17), Roger D. Peng wrote:
>>You could use nls() or optimize().
>>
>>-roger
>
>Well, thx.
>This is very complicated. In Mupad I simply say:
>
>         r:=stats::reg(t_list,x_list,a/2*t^2+sqrt(0.08*a)*t,[t],[a])
>
>and get the (right) answer. How would the same command in R go?
>
>TIA,
>
>jb
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list