get_degree: Computes the score statistic

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

Computes the score statistic

Computes the score statistic

Usage

1
2
3
get_degree(x, y, Y)

get_degree(x, y, Y)

Arguments

x

covariate matrix to test

y

vector of main variable

Y

matrix of the rest of the variables. The row number of Y should match the length of y.

Value

double: degree statistic

double: degree statistic

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
n = 30
k = 3
nullX = as.matrix(rnorm(30), ncol=1)
nullY = MASS::mvrnorm(n, rep(0,3), diag(3))
d = get_degree(as.matrix(nullX, ncol=1), nullY[,1], nullY[,2:3])
p = get_p_from_degree(nullY[,1], nullY[,2:3], d)
print(paste("The degree statistic is", d, "and the p-value is", p))
n = 30
k = 3
nullX = as.matrix(rnorm(30), ncol=1)
nullY = MASS::mvrnorm(n, rep(0,3), diag(3))
d = get_degree(as.matrix(nullX, ncol=1), nullY[,1], nullY[,2:3])
p = get_p_from_degree(nullY[,1], nullY[,2:3], d)
print(paste("The degree statistic is", d, "and the p-value is", p))

tk382/covarianceBP documentation built on July 14, 2020, 4:01 p.m.