Learn R Programming

MarginalMaxTest (version 1.0.1)

marginal.test: Test for marginal effects of predictors on a scalar response

Description

Test for marginal effects of predictors on a scalar response

Usage

marginal.test(x, y, B = 199L, method = "adaptive")

Value

A list containing the p-value and computation time

Arguments

x

A numeric matrix of predictors

y

A numeric vector of responses

B

Number of bootstrap samples (default 199)

method

Method for p-value calculation: "max", "sum", or "adaptive"

Examples

Run this code
# Generate sample data
set.seed(47)
n <- 200
p <- 10
x <- matrix(rnorm(n*p), n, p)
y <- 0.25*x[,1] + rnorm(n)
# Run the test
marginal.test(x, y, B = 200, method = "adaptive")
marginal.test(x, y, B = 200, method = "max")
marginal.test(x, y, B = 200, method = "sum")

Run the code above in your browser using DataLab