Learn R Programming

postDoubleR (version 1.4.12)

ols_helper: Helper function(least squares).

Description

Helper function that dispatches to OLS for the post-double estimation.

Usage

ols_helper(X, Y, W)

Arguments

X

A matrix of covariates (must be all numeric)

Y

A vector of the target variable, of same length as the number of rows of Y, must be numeric

W

A vector of the treatment variable, of same length as the number of rows of X, must be numeric

Value

A list with two elements: The fitted W model and the fitted Y model.

Details

This function is mostly implemented to provide the option to use ols with cross fitting, though it is assumed that this will be rarely used.

Examples

Run this code
# NOT RUN {
  n = 2000; p = 10
  X = matrix(rnorm(n*p), n, p)
  W = rbinom(n, 1, 0.4 + 0.2 * (X[,1] > 0))
  Y = pmax(X[,1], 0) * W + X[,2] + pmin(X[,3], 0) + rnorm(n)

ols_helper(X = X,Y = Y, W = W)


# }

Run the code above in your browser using DataLab