corr.pvalue: Pearson correlation, p-value and t-statistic associated with...

Description Usage Arguments Value Examples

View source: R/main_functions.R

Description

Pearson correlation, p-value and t-statistic associated with the regression between response y and a covariate x

Usage

1
2
3
4
5
6
7
8
9
corr.pvalue(
  x,
  y,
  delta,
  method = "pearson",
  alternative = "two.sided",
  ttest.pvalue = FALSE,
  regression.type
)

Arguments

x

(n by 1) matrix corresponding to a covariate vector where n is the sample size.

y

(n by 1) a matrix corresponding to the response variable. If regression.type is "cox", y contains the observed event times.

delta

(n by 1) a matrix that denotes censoring when regression.type is "cox" (1 denotes survival event is observed, 0 denotes the survival event is censored). Can be NULL.

method

character indicating the type of correlation to compute. Default if "pearson"

alternative

character indicating whether the p-value is computed using one-sided or two-sided testing. Default is "two-sided".

ttest.pvalue

logical indicator. If TRUE, p-value for each covariate is computed from univariate linear/cox regression of the response on each covariate. If FALSE, the p-value is computed from correlation coefficients between the response and each covariate. Default is FALSE.

regression.type

a character indicator that is either "linear" for linear regression or "cox" for Cox proportional hazards regression. Default is "linear".

Value

Examples

1
2
3
4
5
6
7
x = matrix(rnorm(100, 0, 1),100,1)
colnames(x) <- paste0("X",1:ncol(x))
y = matrix(2*x[,1]+ rnorm(100, 0, 1), 100)
colnames(y) <- "y"
delta <- NULL

output <- corr.pvalue(x,y,delta,regression.type="linear")

rakheon/d2wlasso documentation built on Feb. 26, 2020, 10:39 p.m.