Learn R Programming

hcc (version 0.54)

hctest: Test for hidden correlation with one input

Description

Statistical signficance test for hidden correlation given an input x and residuals.

Usage

hctest(x, res)

Arguments

x
the predictor variable
res
residuals, the same length as x

Value

p-value

Examples

Run this code
#Example 1
#in this example, there is no hidden correlation
set.seed(313477)
n <- 50
err <- rnorm(n)
x <- rnorm(n)
y <- 1+2*x+err
res <- resid(lm(y~x))
hctest(x, res)

Run the code above in your browser using DataLab