1、导入数据和模型library(asreml) # load the packagedata(“harvey”) head(harvey)str(harvey) ped <- harvey[,1:3] ainv <- asreml.Ainverse(ped)$ginvhead(ainv)
2、运行单性状模型y2m1 <- asreml(y2 ~ Line, random = ~ ped(Calf), ginverse =list(Calf=ainv),data=harv髫潋啜缅ey) summary(m1)$varcomp > summary(m1)$varcomp gamma component std.error z.ratio constraint ped(Calf)!ped 1.6e-06 2.562243e-03 4.601925e-04 5.567764 Boundary R!variance 1.0e+00 1.601402e+03 2.876203e+02 5.567764 Positive可以看到,ped的方差组分基本为0,残差R为287
3、运行单性状模型y3m2 <- asreml(y3 ~ Line, random = ~ ped(Calf), ginverse =list(Calf=ainv),data=harvey) summary(m2)$varcomp # ped is 500, R is 410**可以看到ped为500,残差R为410