initRandrotW {randRotation} | R Documentation

## Internal function

### Description

Internal function

### Usage

    initRandrotW(Y, X, coef.h, coef.d, weights, cormat, cholCinv, tcholC)

### Arguments

`Y` | a data matrix with `features x samples` dimensions or a list with elements `E`, `design` and `weights` (see `Details`). Missing values (`NA`) are allowed but e.g. lead to NAs for all samples of the respective features in the rotated dataset and should thus be avoided. We highly recommend avoiding missing values by e.g. replacing them by imputation or removing features containing NAs.
`X` | the design matrix of the experiment with `samples x coefficients` dimensions. For `initBatchRandrot`, specify the design matrix without the batch variable. A warning is generated if `X[,coef.d]` does not have full rank, see Details.
`coef.h` | single integer or vector of integers specifying the "hypothesis coefficients" (`H0` coefficients). `coef.h` should correspond to the last columns in `X` (see `Details`). If available, `attr(X, "coef.h")` is used, see `contrastModel`. By default, all coefficients are set as `H0` coefficients. If `coef.h` is set `-1`, no coefficient is set as `H0` coefficient.
`coef.d` | Determined coefficients. These are all other coefficients that are not hypothesis coefficients (see also `initRandrot`).
`weights` | numerical matrix of finite positive weights > 0 (as in weighted least squares regression. Dimensions must be equal to dimensions of `Y`.
`cormat` | the sample correlation matrix with `samples x samples` dimensions. Must be a real symmetric positive-definite square matrix. See `Details` for usage in `initBatchRandrot`.
`cholCinv` | Inverse of the Cholesky factorisation of `cormat`.
`tcholC` | Transposed of the Cholesky factorisation of `cormat`.

### Value

An initialised `initRandrotW` object.

### Author(s)

Peter Hettegger

### Examples

    # For further examples see '?rotateStat' and package vignette.

    #set.seed(0)

    # Dataframe of phenotype data (sample information)
    # We simulate 2 sample classes processed in 3 batches
    pdata <- data.frame(phenotype = rep(c("Control", "Cancer"), c(5,5)))
    features <- 100

    # Matrix with random gene expression data
    edata <- matrix(rnorm(features * nrow(pdata)), features)
    rownames(edata) <- paste("feature", 1:nrow(edata))

    mod1 <- model.matrix(~phenotype, pdata)

    ### Simulate weights
    weights <- matrix(rbeta(features * nrow(pdata), 2, 2)+0.1, features)

    # Initialisation of the random rotation class
    init1 <- initRandrot(Y = edata, X = mod1, coef.h = 2,
                            weights = weights)
    init1

[Package randRotation version 1.6.0 Index]