# non linear regression

I have this dataset

``````devRate <- data.frame( T = c(8, 16, 20, 25, 25, 29, 29, 35),
Rate = c(0, 0.27, 0.20, 0.69, 0.76, 1, 0.98, 0))
``````

By running this code:

``````M2 <- nls(Rate~(a*(T^b)*(1-T))^c, data = Avg_species, start = list(a = 12.236, b = 4.013, c = 0.546), algorithm = "port")
``````

Missing value or an infinity produced when evaluating the model

How to solve it?
Thanks

The problem is that `1-T` is negative and are effectively taking the square root of a negative number.

1 Like

@startz
There is no square root in the function for the elaboration of Rate variable.. am I wrong?

Thanks
Marta

This is correct, you get NaN because (1-T) produces a negative number which you then attempt to exponent using a number less than 1.

Too see this you can simply plug in the numbers, for example (1-8)^0.2 produces NAN.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.