normalityCheckQQ: Visual posterior check of multivariate normality of the...

View source: R/squeezy.R

normalityCheckQQR Documentation

Visual posterior check of multivariate normality of the linear predictors

Description

Produce a qq-plot to visually check whether the assumption of multivariate normality of the linear predictors is valid for the data and model fit with 'squeezy'.

Usage

normalityCheckQQ(X,groupset,fit.squeezy,nSim=500)

Arguments

X

Observed data; (nxp)-dimensional matrix (p: number of covariates) with each row the observed high-dimensional feature vector of a sample.

groupset

Co-data group set; list with G groups. Each group is a vector containing the indices of the covariates in that group.

fit.squeezy

Model fit obtained by the function squeezy.

nSim

Number of simulated vectors of linear predictors.

Value

The qqplot of the empirical versus theoretical quantiles is plotted. If ‘ggplot2’ is installed, the plot is returned as ‘ggplot’ object.

Examples

#Simulate toy data
n<-100
p<-300
X <- matrix(rnorm(n*p),n,p)
Y <- rnorm(n)
groupset <- list(1:(p/2),(p/2+1):p)
sigmahat <- 2
alpha <- 0.5
tauMR <- c(0.01,0.005)

#Fit group-regularised elastic net model with squeezy
fit.squeezy <- squeezy(Y,X,groupset,alpha=alpha,
                       lambdas=sigmahat/tauMR,sigmasq=sigmahat,
                       lambdaglobal=mean(sigmahat/tauMR))
                       
#Check qq-plot
normalityCheckQQ(X,groupset,fit.squeezy)

squeezy documentation built on May 13, 2022, 5:08 p.m.