0

I made this nls model

formula1 <- nls(y ~ a+(x/500)^b, data=my_data, start =list(a=1, b=1))

Then I got the result below,

summary(formula)

Parameters:
    Estimate Std. Error  t value Pr(>|t|)    
a -0.5578576  0.2335056   -2.389   0.0251 *  
b  0.9424152  0.0004498 2095.239   <2e-16 ***

But I want to change the "a", "b" to "0.02", "0.9", so I've changed my formula like this and got this error message ;

formula2 <- nls(y ~ 0.02+(x/500)^0.9, data=my_data)

Error in getInitial.default(func, data, mCall = as.list(match.call(func, : # no 'getInitial' method found for "function" objects

And I changed the start value as 'a=0,02, b=0.9', but the 'estimate value' is same as formula1 ;

formula2 <- nls(y ~ a+(x/500)^b, data=my_data, start =list(a=0.02, b=0.9))
summary(formula2)

Parameters:
    Estimate Std. Error  t value Pr(>|t|)    
a -0.5578576  0.2335056   -2.389   0.0251 *  
b  0.9424152  0.0004498 2095.239   <2e-16 ***

Please let me know how can I make nls formula with fixed start value. Thanks. :)

YJ Kim
  • 1
  • 1
  • You can use something like `formula <- nls(y ~ a+(x/500)^b, data=my_data, start =list(a=0.02, b=0.9))`. The error saysthat you have to provide the `start` argumrent. – UseR10085 Jan 20 '21 at 05:03
  • Thank you Bappa. I tried this already, I changed the start value as 'a=0,02, b=0.9', but the 'estimate value' is same with 'a=1, b=1'. I suppose the estimate value would be changed as 'a=0,02, b=0.9'. Am I wrong? Then how can I change the estimate value by changing start value? – YJ Kim Jan 20 '21 at 08:02
  • If you are trying to evaluate the formula at given values of a and b you can use nls2 in the nls2 package. It has nearly the same arguments as nls. See examples on ?nls2 – G. Grothendieck Jan 25 '21 at 15:35
  • Thank you G!. It works greatly with nls2. – YJ Kim Jan 28 '21 at 00:29

0 Answers0