matregtest: Statistically compares two nested matrix models.

Description Usage Arguments Value Author(s) Examples

View source: R/matregtest.R

Description

A function for doing matrix regression tests of a model against a nested model.

Usage

1
matregtest(mats, pred, drop, numperm)

Arguments

mats

A list of numeric matrices, all assumed to be the same dimensions and symmetric. Diagonals are not used. Off-diagonal non-finite values not allowed. The first entry taken to be the response.

pred

The indices in mats of predictor variables in the more complex of the two models to be compared, should not include 1. Input is numeric value(s), e.g. pred=2, pred =2:3, pred =c(2,3,5).

drop

The indices in mats of predictor variables that are dropped to get from the complex to the simple model. Should be a subset of pred.

numperm

The number of permutations used to do the test

Value

matregtest return an object of class list consisting of

ssr_dat

Sum of squared residuals for the linear regression using all predictors in pred

ssr_perm

Vector of sums of squares of residuals for linear regressions using randomized matrices for the indices in drop

p

The approximate p-value for the test with null hypothesis the simpler model and alternative the more complex one

Author(s)

Lei Zhao, leizhao@ku.edu ; Daniel Reuman, reuman@ku.edu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
v2<-matrix(rnorm(100),10,10)
v2<-v2+t(v2)
v3<-matrix(rnorm(100),10,10)
v3<-v3+t(v3)
v4<-matrix(rnorm(100),10,10)
v4<-v4+t(v4)
err<-matrix(rnorm(100,sd=.05),10,10)
err<-err+t(err)
v1<-1*v2+2*v3+1+err
mats<-list(v1=v1,v2=v2,v3=v3,v4=v4)
resp<-1
pred<-2:4
drop<-4
numperm<-100 
#in a real application numperm should typically 
#be at least 1000
h<-matregtest(mats,pred,drop,numperm)

reumandc/mms documentation built on May 28, 2019, 5:39 p.m.