Dear R users,
I am struggling to fit expo-linear equation to my data using "nls"
function. I am always getting error message as i highlighted below in yellow
color:
### Theexpo-linear equation which i am interested to fit my data:
response_variable = (c/r)*log(1+exp(r*(Day-tt))), where "Day" is
time-variable
## my response variable
rl <- c(2,1.5,1.8,2,2,2.5,2.6,1.5,2.4,1.7,2.3,2.4,2.2,2.6,
2.8,2,2.5,1.8,2.4,2.4,2.3,2.6,3,2,2.6,1.8,2.5,2.5,
2.3,2.7,3,2.2,2.6,1.8,2.5,2.5,2.3,2.7,3,2.2)
myday <- rep(c(3,5,7,9,10), each = 8) # creating my predictor time-variable
mydata <- data.frame(rl,myday) # data object
### fitting model equation in "nls" function
### when i assigned initial value for tt = 0.6,
CASE-I:
> mytest <- nls(rl ~ (c/r)*log(1+exp(r*(myday-tt))), data = mydata,
+ na.action = na.omit,
+ start = list(c = 2.0, r = 0.05, tt = 0.6),algorithm = "plinear")
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
CASE - II:
When i assigned initial value for tt = 1:
> mytest <- nls(rl ~ (c/r)*log(1+exp(r*(myday-tt))), data = mydata,
+ na.action = na.omit,
+ start = list(c = 2.0, r = 0.5, tt = 1),algorithm = "plinear")
Error in nls(rl ~ (c/r) * log(1 + exp(r * (myday - tt))), data = mydata, :
singular gradient
I am getting the yellow-color highlighted error message (see above). Truely
speaking, i have not so much experienced with fitting specific model equation in
R-package.
I have following queries:
1. Does any one can explain me what is going wrong here ?
2. Importantly, how can i write above equation into "nls" functions ?
I will be very thankful to you, if any one can help me.
I am looking for your cooperations.
Thanks
Regards,
Ram Kumar Basnet
[[alternative HTML version deleted]]