# NOT RUN {
id<-1:20
sex<-sample(c("Male", "Female"),20, replace=TRUE)
offspring<-c(rep(0,18),1,1)
lat<-rnorm(20)
long<-rnorm(20)
mating_type<-gl(2,10, label=c("+", "-"))
test.data<-data.frame(id, offspring, lat, long, mating_type, sex)
res1<-expression(varPed("offspring", restrict=0))
var1<-expression(varPed(c("lat", "long"), gender="Male",
relational="OFFSPRING"))
var2<-expression(varPed(c("mating_type"), gender="Female",
relational="MATE"))
var3<-expression(varPed("mating_type", gender="Male"))
PdP<-PdataPed(formula=list(res1, var1, var2, var3), data=test.data)
X.list<-getXlist(PdP)
X.list$X$"19"$XSs
# For the first offspring we have the design matrix for sires
# The first column represents the distance between each male
# and each offspring. The second column indicates the male's
# mating type. Note that contrasts are set up with the first
# male so the indicator variables may be negative.
matrix(X.list$X$"19"$XDSs, ncol=length(X.list$X$"19"$dam.id),
nrow=length(X.list$X$"19"$sire.id))
# incidence matrix indicating whether Females (columns) and Males (rows)
# are the same mating type. Again this is a contrast with the first
# parental combination (which is +/+) so 0 actually represents parents
# with the same mating type.
# }
Run the code above in your browser using DataLab