dataset_result: Fit all models for a single dataset

Description Usage Arguments Value Examples

View source: R/NRejections.R

Description

The user does not need to call this function. For a single dataset, fits separate OLS models for W outcomes with or without centering the test statistics to enforce the global null.

Usage

1
2
3
4
5
6
7
8
9
dataset_result(
  d,
  X,
  C = NA,
  Ys,
  alpha = 0.05,
  center.stats = TRUE,
  bhat.orig = NA
)

Arguments

d

Dataframe

X

Single quoted name of covariate of interest

C

Vector of quoted covariate names

Ys

W-vector of quoted outcome names

alpha

Alpha level for individual tests

center.stats

Should test statistics be centered by original-sample estimates to enforce global null?

bhat.orig

Estimated coefficients for covariate of interest in original sample (W-vector). Can be left NA for non-centered stats.

Value

Returns a list containing the number of observed rejections (rej), the coefficient estimates of interest for each outcome model (bhats), their t-values (tvals), their uncorrected p-values at level alpha (pvals), and a matrix of residuals from each model (resid). The latter is used for residual resampling under the global null.

Examples

1
2
3
4
5
6
7
samp.res = dataset_result( X = "complaints",
           C = c("privileges", "learning"),
           Ys = c("rating", "raises"),
           d = attitude,
           center.stats = FALSE,
           bhat.orig = NA,  # bhat.orig is a single value now for just the correct Y
           alpha = 0.05 )

NRejections documentation built on July 9, 2020, 5:08 p.m.