Description Usage Arguments Value Author(s) Examples
Function to rank models using a leave-n-out cross validation (LNOCV) procedure for matrix regression models
1 |
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. |
model.names |
A list of models to run LNOCV on. If not specified runs all combinations of predictors. Specification needs to be as numeric values that correspond to mats elements. Examples of model specifications: 2, 2:3, c(2,3,5). |
n |
The number of sampling locations to leave out. Must be at least 2. |
maxruns |
The maximum number of leave-n-outs to do - to be used if choose(dim(mats[[1]]),n) is very large. Inf to use (or try to use) all LNOs. If maxruns is a number, then LNOs are selected randomly and hence may include repeats. |
rank.mod |
Logical. If |
mmsrank
Return a data frame with columns for
model.names |
The name of the model, based on the indices of included predictors in mats |
lno.score |
The out-of-sample forecast accuracy (mean squared error) |
num.pos |
The possible number of LNOs for the given n and number of locations |
num.att |
The total number of LNOs attempted |
num.rnk |
The number of LNOs that did not result in a rank deficiency regression problem, and so could be used for testing out-of-sample predictions |
num.usd |
The number of LNOs that could be used in the end (possibly less than num.rnk because of NAs in the input matrices) |
Tom Anderson, anderstl@gmail.edu; Daniel Reuman, reuman@ku.edu; Jon Walter, jaw3es@virginia.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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=.1),10,10)
err<-err+t(err)
v1<-1*v2+2*v3+3*v4+1+err
mats<-list(v1=v1,v2=v2,v3=v3,v4=v4)
model.names<-NA
n<-2
maxruns<-Inf
h<-mmsrank(mats=mats,model.names=model.names,
n=n,maxruns=maxruns,rank.mod=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.