1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| file<-read.csv2("file.csv", na.strings = "NA",header = TRUE)
head(file)
str(file)
file$sug<-as.numeric(file$sug)
file$temp<-as.factor(file$temp)
library(lme4)
library(car)
##Measured variable : sug (binary data: 0 means no sugar and 1 means sugar)
##fixed effect to observed: temp, var and interaction temp, var
##replicates = rep (5 biological replicates per sug analysis)
#split plot design?
# 2 temperatures (temp)
# 6 varieties (var)
#observation of the sugar content (sug) on 5 biological replicates
#model without random factor (rep) / glm function
model_global = glm(sug ~ temp * var , family="binomial", data =file)
Anova(model_global)
#warning:
# Warning messages:
# 1: glm.fit: fitted probabilities numerically 0 or 1 occurred
# 2: glm.fit: fitted probabilities numerically 0 or 1 occurred
# 3: glm.fit: fitted probabilities numerically 0 or 1 occurred
#model with random factor (rep) / glmer fuction
model_global_int = glmer(sug ~ temp * var + (1 | rep), family=binomial, data =file)
Anova(model_global_int)
#Warning messages:
# 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
# unable to evaluate scaled gradient
# 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
# Hessian is numerically singular: parameters are not uniquely determined
model_global_plus = glmer(sug ~ temp + var + (1 | rep), family=binomial, data =file)
Anova(model_global_plus)
#Error in pwrssUpdate(pp, resp, tol = tolPwrss, GQmat = GQmat, compDev = compDev, :
# (maxstephalfit) PIRLS step-halvings failed to reduce deviance in pwrssUpdate |
Partager