View source: R/MultiLambdaCVfun.R
| createXXblocks | R Documentation |
Creates list of (unscaled) sample covariance matrices X_b %*% t(X_b) for data blocks b = 1,..., B.
createXXblocks(datablocks, datablocksnew = NULL, which2pair = NULL)
datablocks |
List of data frames or matrices |
datablocksnew |
List of data frames or matrices |
which2pair |
Integer vector of size 2 (or |
The efficiency of multiridge for high-dimendional data relies largely on this function:
all iterative calculation are performed on the out put of this function, which contains B blocks of
nxn matrices. If which2pair != NULL, the function adds a paired covariance block, pairing the two data blocks corresponding to the elements of which2pair. If predictions for new samples are desired, one also needs to specify
datablocksnew, which should have he exact same format as datablocks with matching column dimension (number of variables).
List. Same number of component as datablocks when which2pair = NULL, or augmented with one paired data block.
Dimension is nxn for all components.
createXblocks, which is required when parameter estimates are desired (not needed for prediction). A full demo and data are available from:
https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4
#Example #Simulate Xbl1 <- matrix(rnorm(1000),nrow=10) Xbl2 <- matrix(rnorm(2000),nrow=10) #check whether dimensions are correct ncol(Xbl1)==nrow(Xbl2) #create cross-product XXbl <- createXXblocks(list(Xbl1,Xbl2)) #suppose penalties for two data types equal 5,10, respectively Sigma <- SigmaFromBlocks(XXbl,c(5,10)) #check dimensions (should be n x n) dim(Sigma)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.