# createXXblocks: Creates list of (unscaled) sample covariance matrices In multiridge: Fast Cross-Validation for Multi-Penalty Ridge Regression

## Description

Creates list of (unscaled) sample covariance matrices `X_b %*% t(X_b)` for data blocks b = 1,..., B.

## Usage

 `1` ```createXXblocks(datablocks, datablocksnew = NULL, which2pair = NULL) ```

## Arguments

 `datablocks` List of data frames or matrices `datablocksnew` List of data frames or matrices `which2pair` Integer vector of size 2 (or `NULL`)

## Details

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).

## Value

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:
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```#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) ```