How to choose suitable nls models?

0

I'm trying to run nls models in two datasets using the sigmoid model, but the models are poor. How can I chose suitable models? The datasets are from n. animals harvested per species by 30 villages, and the data was collected more than once in each village.

My two datasets whit formulas

1:

library(minpack.lm)

n.kill.log<-c(4.38, 4.47, 2.30, 2.40, 3.91, 3.83, 5.56, 2.4, 2.2, 5.21, 6.72, 1.10, 2.48, 4.73)
lambida<-c(1.22,2.01, 2.7, 3, 2.5, 1.49, 1.46, 1.5, 1.31, 1.95, 1.58, 1.62, 1.9, 1.42)
df1<-data.frame(n.kill.log,lambida)

eps <- .Machine$double.eps^0.5

fit1 <- nlsLM(n.kill.log ~ a*(1 - exp(-b*lambida))^c, data = df1,
             start = list(a = max(df1$n.kill.log), b = 0.05, c = 1),
             control = nls.lm.control(maxiter = 100, ptol = eps))
summary(fit1)
plot(df1$n.kill.log, fitted(fit1))

2:

 n.kill.log<-c(4.38, 1.61, 14.47, 2.30, 2.40, 3.91, 3.83, 5.56, 2.4, 2.2, 5.21, 2.83, 6.72, 1.10, 2.48, 4.73)
    body<-c(160,1.5,23,40,4.5,4.5,0.8,3,1.2,60,70,0.5,35,30.5,4,47)
    df2<-data.frame(n.kill.log, body)
    
    ca=max(df2$n.kill.log)
    eps <- .Machine$double.eps^0.5
    fit2 <- nls(n.kill.log ~ a*(1 - exp(-b*body))^c, data = df2, 
               start = list(a = ca, b = 0.05, c = 1), 
               algorithm = 'port', 
               control = nls.control(maxiter = 100, tol = eps))
    summary(fit2)
    plot(df2$n.kill.log, fitted(fit2))

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