[R] Package nlme

Rohan Richard roh@n@r|ch@rd @end|ng |rom roth@m@ted@@c@uk
Thu Apr 7 12:30:19 CEST 2022


Dear Help Desk,

I am trying to perform a non-linear regression (Sigmoid curves) using the R package nlme. My field trial is a randomised complete block design (RCBD) with 3 blocks and I would like to assess the block effect in the model. Do you know how I can incorporate the block term in nlme function?

So far I tried the following code and it did not work and I an error error message:

# code
minitab$NDVI<-as.factor(minitab$NDVI)
modnlme1 <- nlme(NDVI ~ a + d / (1 + exp(-b * (DegreeDay - m)) ), data = minitab,
                 random =a + d + b + m~ 1|Block,
                 fixed = list(a ~ Lines1, d~Lines1,b ~ Lines1, m ~ Lines1),
                 weights = varPower(),
                 start=c(b=0.5,c=3,d=0.4, e=700), control = list(msMaxIter = 200))

#Error message
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
  contrasts can be applied only to factors with 2 or more levels

Could you please kindly help me?

Thank you in advance,

Best wishes,

Rohan

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows


Rothamsted Research is a company limited by guarantee, registered in England at Harpenden, Hertfordshire, AL5 2JQ under the registration number 2393175 and a not for profit charity number 802038.

	[[alternative HTML version deleted]]



More information about the R-help mailing list