Error message: Error in GEN:N : NA/NaN argument

I got the sample code from Fitting ‘complex’ mixed models with ‘nlme’: Example #4 | R-bloggers
Here is the code:
library(lattice)
library(nlme)
library(aomisc)
dataset <- read.csv("https://raw.githubusercontent.com/OnofriAndreaPG/agroBioData/master/growthNGEN.csv",
header=T)
dataset$Block <- factor(dataset$Block)
head(dataset)

A wrong model

modNaive1 <- drm(Yield ~ DAS, fct = L.3(), data = dataset,
curveid = GEN:N,
pmodels = c( ~ 1, ~ NGEN, ~ NGEN))
summary(modNaive1)
plot(modNaive1,log="")

Nonlinear mixed model fitting

#-------------------------------------------------------------------------------
library(aomisc)
modnlme1 <- nlme(Yield ~ nlsL.3(DAS, b, d, e), data = dataset,
random = d + e ~ 1|Block/Plot,
fixed = list(b ~ 1, d ~ NGEN, e ~ NGEN),
weights = varPower(),
start = coef(modNaive1), control = list(msMaxIter = 200))

When run
modNaive1 <- drm(Yield ~ DAS, fct = L.3(), data = dataset,
curveid = GEN:N,
pmodels = c( ~ 1, ~ NGEN, ~ NGEN))
Got error message: Error in GEN:N : NA/NaN argument

run following code:
modnlme1 <- nlme(Yield ~ nlsL.3(DAS, b, d, e), data = dataset,
random = d + e ~ 1|Block/Plot,
fixed = list(b ~ 1, d ~ NGEN, e ~ NGEN),
weights = varPower(),
start = coef(modNaive1), control = list(msMaxIter = 200))

got another error message:
Error in contr.treatment(n = 0L) : not enough degrees of freedom to define contrasts

Can anyone help solve the problem?

This topic was automatically closed 21 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.