Dear Rohan,

Bert Gunter has already made several general useful suggestions.

In addition, why did you make the variable on the left-hand side of the model a factor? Shouldn't it be a numeric variable?

I hope this helps,
 John

--
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontarion, Canada
web: https://socialsciences.mcmaster.ca/jfox/

On 4/7/2022 6:30 AM, Rohan Richard via R-help wrote:
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]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to