Description Usage Arguments Examples
Performs Wilks likelihood ratio test on the multivariate regression model lm_mod versus the null hypothesis model lm_nullmod. Note that if n_adj=0 (the default) then the return values pval and pvalAdj will be the same. Otherwise, pval will be the unadjusted pvalue (full degrees of freedom), and pvalAdj will be the adjusted pvalue (reduced degrees of freedom).
1 | wilksLambdaTest(lm_mod, lm_nullmod = NULL, n_adj = 0)
|
lm_mod |
fitted model (eg: lm(Y~X)) corresponding to the alternative hypothesis. |
lm_nullmod |
fitted model (eg: lm(Y~1)) corresponding to the null hypothesis, default is lm(Y~1) when lm_nullmod==NULL. |
n_adj |
default=0, subtracted from the error degrees of freedom (for example, may be used to correct for previous testing done on the data). |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | lam = NULL
pval = NULL
for(i in 1:1000) {
x1 = rnorm(100)
x2 = rnorm(100)
y1 = rnorm(100)
y2 = rnorm(100)
A = cbind(y1,y2)
B = cbind(x1,x2)
wi = wilksLambdaTest(lm(A~B), n_adj=0)
lam = c(lam, wi$lambda)
pval = c(pval, wi$pval)
}
hist(lam, freq=F, breaks=100)
curve(dchisq(x, wi$chisq_df), 0, max(lam), lwd=2, xlab = "", ylab = "", add = T)
hist(pval, freq=F, breaks=100)
lam = NULL
pval = NULL
for(i in 1:1000) {
x1 = rnorm(100)
x2 = rnorm(100)
y1 = rnorm(100)
y2 = rnorm(100)
y3 = rnorm(100)
y4 = rnorm(100)
y5 = rnorm(100)
y6 = rnorm(100)
A = cbind(y1,y2,y3,y4,y5,y6)
B = cbind(x1,x2)
wi = wilksLambdaTest(lm(A~B), n_adj=0)
lam = c(lam, wi$lambda)
pval = c(pval, wi$pval)
}
hist(lam, freq=F, breaks=100)
curve(dchisq(x, wi$chisq_df), 0, max(lam), lwd=2, xlab = "", ylab = "", add = T)
hist(pval, freq=F, breaks=100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.