mlrreg.Stest <-
function(x,y,nboot=100,SEED=TRUE){
#
# Test hypothesis that all slopes=0 based on Rousseeuw et al.
# multivariate regression estimator
#
# Strategy: Use bootstrap estimate of standard errors followed by
# Hotelling type test.
#
if(SEED)set.seed(2)
est=as.vector(mlrreg(x,y)$coef[-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(mlrreg(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=est)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.