mlrGtest <-
function(x,y,regfun=mlrreg,nboot=100,SEED=TRUE){
#
# Test hypothesis that all slopes=0 based
# on some multivariate regression estimator.
# By default the Rousseeuw et al.
# multivariate regression estimator (RADA) is used.
#
# Strategy: Use bootstrap estimate of standard errors followed by
# Hotelling type test.
#
if(SEED)set.seed(2)
estall=regfun(x,y)$coef
est=as.vector(estall[-1,])
n=nrow(x)
JK=ncol(x)*ncol(y)
vals=matrix(0,nrow=nboot,ncol=JK)
for(i in 1:nboot){
bsam=sample(n,replace=TRUE)
vals[i,]=as.vector(regfun(x[bsam,],y[bsam,])$coef[-1,])
}
Sv=cov(vals)
est=as.matrix(est)
k=1/JK
test <- k * crossprod(est, solve(Sv, est))[1, ]
v1=JK-1
v2=n-JK
pval=1-pf(test,v1,v2)
list(test.stat=test,p.value=pval,est=estall)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.