parcorr.pvalue: Partial correlation, p-value and t-statistic associated with...

Description Usage Arguments Value Examples

View source: R/main_functions.R

Description

Partial correlation, p-value and t-statistic associated with the regression between response y and a covariate x after adjustment for a covariate z.

Usage

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

Arguments

factor.z

logical. If TRUE, the fixed variable z is a factor variable.

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.

z

(n by 1) matrix of additional fixed covariate affecting response variable. Can be NULL.

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
8
x = matrix(rnorm(100, 0, 1),100,1)
colnames(x) <- paste0("X",1:ncol(x))
z = matrix(rbinom(100, 1, 0.5),100,1)
y = matrix(z[,1] + 2*x[,1] + rnorm(100, 0, 1), 100)
colnames(y) <- "y"
delta <- NULL

output <- parcorr.pvalue(factor.z=TRUE,x,y,z,delta,regression.type="linear")

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