effect_anova_rnd = function(args){
#select x
mm = args$mm
assign = attr(mm,"assign")
select_x = assign==args$i
select_within = assign == (args$link[3,args$i])
##zmat
z = khatrirao(a = args$mm_id, b = mm[,select_within,drop=F])
z = qr.resid(qr(mm),z)
qr_z = qr(z)
qr_d = qr(mm[,!select_x,drop=F])
rdx = qr.resid(qr_d,mm[,select_x,drop=F])
qr_rdx = qr(rdx)
qr_rdz = qr(qr.resid(qr_d,z))
SSn = sum(qr.fitted(qr_rdx,args$y)^2)
SSd = sum(qr.fitted(qr_rdz,args$y)^2)
MSEn = SSn/ qr_rdx$rank
MSEd = SSd/ qr_rdz$rank
Fstat = MSEn/MSEd
out= c(SSn = SSn, dfn = qr_rdx$rank,
SSd = SSd, dfd = qr_rdz$rank,
MSEn = MSEn, MSEd = MSEd,
'F' = Fstat, 'parametric P(>F)' = 1-pf(q =Fstat, df1 = qr_rdx$rank, df2 =qr_rdz$rank))
out
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.