These tutorials use real-life data sets to help you explore and learn how to use ASReml-R.
GBLUP using ASReml-R 4
Genomic Best Linear Unbiased Prediction, or GBLUP, is a genomic selection method that uses genetic relationships derived from molecular markers to estimate the genetic merit of an individual.
https://downloads.vsni.digital/ba24e516941e9f647f589bd68dacffab49af435c/ASReml-R_4_GBLUP.zip
Book referenced in this video
Genetic Data Analysis for Plant and Animal Breeding
https://link.springer.com/book/10.1007/978-3-319-55177-7
Computing the G matrix (and its inverse) from marker data in R
A critical component of GBLUP analysis is the estimation of the ‘G matrix’ or kinship matrix, and the calculation of its inverse. There are many ways to compute a G matrix and its inverse from marker data. In this tutorial, we’ll show you a couple of ways.
https://downloads.vsni.digital/8635f3aa41fe03ab2a6b34750e33fb65cf8958ea/GMatrix.zip
Book referenced in this video
Genetic Data Analysis for Plant and Animal Breeding
https://link.springer.com/book/10.1007/978-3-319-55177-7
Dose-response analysis in toxicology (e-learning course free sample)
Dose-response analyses are used in many fields such as pharmacology, entomology, biology, etc. The idea is to determine the efficacy and safety, or even lethality, of a given drug or toxic element. This video looks at a study on flies: it examines the toxicology profiles of different forms of selenium and then calculates the effective concentration at which 50% of the fly mortality occurs.
Random coefficient regression using ASReml-R 4
Random coefficient regression can be used when we want to explore the relationship between a response variable (y) and a continuous explanatory variable (x) and we have repeated measurements of x and y on individual subjects.
Data source: RatGrowth.txt
https://vsnidownloads.s3.eu-west-2.amazonaws.com/130fd7da93a9ad8e9525104d753b025c3d62a178/RatGrowth.txt
R script
##################################
# RANDOM COEFFICIENT REGRESSION
# Using Rat Growth Example
##################################
# Description:
# These data originated from an experiment to study the effect of drugs on the growth rates of rats.
# There were three treatment groups (control, thyroxin and thiouracil) and the weight of the rats
# were measured weekly.
# Reference:
# Box, G. (1950). Problems in the Analysis of Growth and Wear Curves. Biometrics 6(4), 362-389.
# Set working directory
setwd(“C:/Users/jane/Desktop/RatGrowth”)
# Load data and explore its structure
RatGrowth<-read.table(“RatGrowth.txt”,header=TRUE)
head(RatGrowth)
tail(RatGrowth)
str(RatGrowth)
# Convert rat to a factor
RatGrowth$rat<-as.factor(RatGrowth$rat)
str(RatGrowth)
# Plot the data
library(lattice)
xyplot(weight~time|drug,data=RatGrowth,type=”l”,groups=rat)
# Calculate time centered and time centered squared
RatGrowth$timec<-RatGrowth$time-mean(RatGrowth$time)
RatGrowth$timecSQ<-RatGrowth$timec^2
head(RatGrowth)
# Data frame with thiouracil
RatGrowth_thiouracil<-RatGrowth[RatGrowth$drug %in% “thiouracil”,]
# Loading asreml library
library(asreml)
# Random coefficient regression model for thiouracil drug
RCModel_thiouracil<-asreml(fixed=weight~timec+timecSQ,
random=~str(~rat+timec:rat+timecSQ:rat,~corgh(3):id(rat)),
data=RatGrowth_thiouracil,maxit=20)
plot(RCModel_thiouracil) # residual plots
summary(RCModel_thiouracil)$varcomp # variance components
summary(RCModel_thiouracil,coef=TRUE)$coef.fixed # fixed effects
summary(RCModel_thiouracil,coef=TRUE)$coef.random # random effects
wald.asreml(RCModel_thiouracil,denDF=’algebraic’)$Wald # Wald tests
# Random coefficient regression model for all data
RCModel<-asreml(fixed=weight~timec+timecSQ+drug+drug:timec+drug:timecSQ,
random=~str(~rat+timec:rat+timecSQ:rat,~corgh(3):id(rat)),
data=RatGrowth)
plot(RCModel) # residual plots
summary(RCModel)$varcomp # variance components
summary(RCModel,coef=TRUE)$coef.fixed # fixed effects
summary(RCModel,coef=TRUE)$coef.random # random effects
wald.asreml(RCModel,denDF=’algebraic’)$Wald # Wald tests
# Plot of the predicted means
# Note: The values of timec and timecSQ change in parallel.
predTime<-predict(RCModel,classify=”drug:timec:timecSQ”,
levels=list(drug=c( 1,1,1,1,1, 2,2,2,2,2, 3,3,3,3,3),
timec=c( -2,-1,0,1,2, -2,-1,0,1,2, -2,-1,0,1,2),
timecSQ=c(4,1,0,1,4, 4,1,0,1,4, 4,1,0,1,4)),
parallel=TRUE,sed=FALSE)$pvals
head(predTime)
tail(predTime)
xyplot(predicted.value~(timec+mean(RatGrowth$time)),groups=drug,data=predTime,
type=”l”,lwd=2,auto.key=TRUE)
Creating and fitting a mixed effects model in ASReml-R4
Repeated measures
A repeated measures analysis is needed when a trait is measured on the same individual over time.
# load the asreml package
library(asreml)
# print the first and last few rows
head(grassUV)
tail(grassUV)
library(ggplot2)
ggplot(data = grassUV,
aes(x = Time, y = y, group = Plant, colour=Plant)) +
geom_line() + facet_grid(. ~ Tmt)
grass
####### Uniform Model
# Univariate
grassUV.uniform <- asreml(y ~ Tmt + Time + Tmt:Time,
residual = ~Plant:cor(Time),
data =grassUV)
summary(grassUV.uniform)$bic
# Multivariate
grass.uniform <- asreml(cbind(y1, y3, y5, y7, y10) ~ Tmt + trait + Tmt:trait,
residual = ~Plant:cor(trait),
data = grass)
summary(grass.uniform)$bic
####### Power Model
# Convert to Univariate
grassConvert<-reshape(grass, direction=”long”, varying=3:7, sep = “”)
grassConvert<-grassConvert[order(grassConvert$Plant,grassConvert$time),]
grassConvert$time<-factor(grassConvert$time)
# Univariate
grassUV.power <- asreml(y ~ Tmt + Time + Tmt:Time,
residual = ~Plant:exp(Time),
data =grassUV)
summary(grassUV.power)$bic
plot(grassUV$Time,grassUV.power$resid)
####### Heterogeneous Power Model
grassUV.hetpower <- asreml(y ~ Tmt + Time + Tmt:Time,
residual = ~Plant:exph(Time),
data =grassUV)
summary(grassUV.hetpower)$bic
####### Antedependence Model
# Univariate
grassUV.ante <- asreml(y ~ Tmt + Time + Tmt:Time,
residual = ~Plant:ante(Time),
data =grassUV)
summary(grassUV.ante)$bic
# Multivariate
grass.ante <- asreml(cbind(y1, y3, y5, y7, y10) ~ trait + Tmt + trait:Tmt,
residual = ~Plant:ante(trait),
data = grass)
summary(grass.ante)$bic
####### Unstructured Model
# Univariate
grassUV.us <- asreml(y ~ Tmt + Time + Tmt:Time,
residual = ~Plant:us(Time),
data =grassUV)
summary(grassUV.us)$bic
# Multivariate
grass.us <- asreml(cbind(y1, y3, y5, y7, y10) ~ trait + Tmt + trait:Tmt,
residual = ~Plant:us(trait),
data = grass)
summary(grass.us)$bic
####### BICs
summary(grassUV.uniform)$bic
summary(grassUV.power)$bic
summary(grassUV.hetpower)$bic
summary(grassUV.ante)$bic
summary(grassUV.us)$bic
####### Wald tests for chosen model
# Univariate
wald(grassUV.ante)
# Multivariate
wald(grass.ante)
####### Predicted treatment by time means
# Univariate
predict(grassUV.ante, classify = “Tmt:Time”)
# Multivariate
predict(grass.ante, classify = “Tmt:trait”)
Split-plot design
A split-plot design is recommended when a factor that you want to analyse can’t be changed as easily as your other factors.
# load the asreml package
library(asreml)
# load the ‘oats’ data set – an internal data set in the ASReml package
data(oats)
# display the data set using View function
View(oats)
# use str function to investigate structure
str(oats)
# Split Plot Design analysis model
oats.asr <- asreml(fixed = yield ~ Variety + Nitrogen + Variety:Nitrogen,
random = ~ Blocks + Blocks:Wplots,
data = oats)
# look at the residuals
plot(oats.asr)
# summarise the variance components
summary(oats.asr)$varcomp
# fixed(or random) effects
summary(oats.asr, coef = TRUE)$coef.fixed
summary(oats.asr, coef = TRUE)$coef.random
# denDF = “none” and ssType = “incremental” (the defaults)
wald(oats.asr, denDF = “default”)
#Prediction
oatsN.pv <- predict(oats.asr, classify = “Nitrogen”, sed = T)
str(oatsN.pv)
# predicted means
oatsN.pv$pvals
# full matrix of SEDs
oatsN.pv$sed
# minimum, mean and maximum SED
oatsN.pv$avsed
Specifying variance structures using genetic and other relationships
This video describes how to include known variance structures, such as pedigree information, into a linear mixed model analysis using ASReml-R version 4.
https://downloads.vsni.digital/08f57ebf544cb1522eaf4656d76f4f1c4d43e254/genetic_relationships.zip
Spatial analysis of a field trial
A spatial analysis can improve the estimation of treatment effects by modelling more accurately the spatial distribution of error effects in a field trial.