# Prediction Problems library(MASS) zlrs = file.choose() source(zlrs) # Connectedness problem for group work (1,1,1) (1,1,3) (1,2,1) (1,3,2) (1,3,5) (2,1,3) (2,1,4) (2,2,1) (2,2,2) (2,2,5) (2,3,1) (3,1,4) (3,1,5) (3,3,1) (3,3,3) (4,1,2) (4,2,2) (4,3,4) # 1)Determine the number of disconnected groups of the # above filled subclasses. # 2)Which subclasses (minimum number) are needed in # order to connect all of these groups? # small prediction problem y = matrix(data=c(128,150,90,110,120),ncol=1) X = matrix(data=c(1,1,1,1,1),ncol=1) herds = c(1,1,2,2,2) sires = c(1,2,1,2,3) Zh = desgn(herds,0) Zs = desgn(sires,0) Z = cbind(Zh,Zs) Gh = id(2)*(1/6) Gs = id(3)*(1/15) G = block(Gh,Gs) dd = c(5,4,5,20,2) RI=diag(dd) # Pigs in litters Litter 1 1, 2, 3, 4, 5 13, 10, 9, 16, 8 2 6, 7, 8, 9 15, 12, 7, 18 3 10, 11, 12, 13, 14, 15 20, 11, 9, 17, 10, 14 ---------------------------------- y = mu + litter + pig + e e = 10 l = 3 p lits = c(1,1,1,1,1,2,2,2,2,3,3,3,3,3,3) pigs = c(1:15) oval = rep(1,length(lits)) y = matrix(c(13,10,9,16,8,15,12,7,18,20,11,9,17,10,14),ncol=1) Xm = desgn(oval,0) Zl = desgn(lits,0) Zp = desgn(pigs,0) Gl = id(3)*10 G2 = id(15)*3 GI = block(G1,G2) # Evaluation of pigs = lits + pigs solutions, SEP of these # pigs unrelated between litters # put in full-sib relationships - compare models #Homework Problem, plant heights y = matrix(data=c(25.3,17.8,20.1,26.1,19.2,24.6,23.7,24.5,26.0,28.4,22.9,25.8), ncol=1) dd = c(40,39,37,35,40,40,33,38,40,30,28,34) RI=diag(dd) FB=c(1,1,1,2,2,2,3,3,3,4,4,4) X =desgn(FB,0) LL=c(1,2,3,1,2,3,1,2,3,1,2,3) Z = desgn(LL,0) dd = c(10,10,10) GI=diag(dd)