Get formula from nls in combination with SSasymp

687 views Asked by At

my aim is to use a dataset with "days" (1 to 200) and "body size" and to put it into a simple model. Following, I want to predict the body size of other objects only based on the data of a couple of days (50).

Hence, I am using the following line of code to predict e.g. the body size across days (I just use this case as an example). Since it is an asymptotic function, I use SSasymp (feel free to suggest a better method).

model <- nls(bodySize~ SSasymp(day, Asym, R0, lrc), data = myData)

The range of "day" in this example is 200 days.

However, when it comes to predict the trajectory of the body size only based on only 50 days, I run into the problem that I don't get the output I expect it to be:

I run this code to get the predicted body size:

predict(model, newdata =  data.frame(day = 1:50))

I expected an output of 200 values (body size) that is based on the model. However, I get this:

       Asym         R0       lrc
 [1,] 0.1248008 0.87519923 0.2010490
 [2,] 0.2340263 0.76597370 0.3519158
 [3,] 0.3296204 0.67037959 0.4619947
 [4,] 0.4132843 0.58671570 0.5391165
 [5,] 0.4865069 0.51349313 0.5897930
 [6,] 0.5505912 0.44940880 0.6194236
 [7,] 0.6066778 0.39332223 0.6324723
and so on up to 50
.
.
.

What am I doing wrong and what do I need to do to get the 200 predicted body size values?

0

There are 0 answers