I have some data int the variabley y (response variable) and x, and I suspect the formula y = A*x^2 +sqrt(0.08*A)*x. How can I fit my data to this curve? TIA, Janos Blazi
You could use nls() or optimize(). -roger JB wrote:> I have some data int the variabley y (response variable) and x, and I > suspect the formula > > y = A*x^2 +sqrt(0.08*A)*x. > > How can I fit my data to this curve? > > TIA, > > Janos Blazi > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >
At 13.11.2003 (17:17), Roger D. Peng wrote:>You could use nls() or optimize(). > >-rogerWell, 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
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