# call software (data will be included) library(pedigreemm) # data pre-processing milk <- within(milk, sdMilk <- milk / sd(milk)) # look at the data str(milk) head(milk) tail(milk) # run model lactation as covariate system.time( fm1 <- pedigreemm(sdMilk ~ lact + log(dim) + (1|id) + (1|herd), data = milk, pedigree = list(id = pedCowsR)) ) summary(fm1) anova(fm1) # compare with model excluding log(dim) system.time( fm2 <- pedigreemm(sdMilk ~ lact + (1|id) + (1|herd), data = milk, pedigree = list(id = pedCowsR)) ) summary(fm2) anova(fm1, fm2) # run model lactation as factor fm1c <- pedigreemm(sdMilk ~ factor(lact) + log(dim) + (1|id) + (1|herd), data = milk, pedigree = list(id = pedCowsR)) summary(fm1c) # including permament environmental effects # potential confunding with genetic effects due to low information... milk <- within(milk, idPE <- id) system.time( fm3 <- pedigreemm(sdMilk ~ lact + log(dim) + (1|id) + (1|idPE) + (1|herd), data = milk, pedigree = list(id = pedCowsR)) ) summary(fm3) # run model lactation as factor fm4 <- pedigreemm(sdMilk ~ factor(lact) + log(dim) + (1|id) + (1|herd), data = milk, pedigree = list(id = pedCowsR)) summary(fm4)