estSLSE {causalSLSE}R Documentation

Least Squares Estimate of cslseModel or slseModel Objects

Description

This is the main function to estimate cslseModel or slseModel objects. It generates the basis functions based on the knots specified in the model and estimates it by least squares.

Usage

## S3 method for class 'cslseModel'
estSLSE(model, selKnots, ...)

## S3 method for class 'slseModel'
estSLSE(model, selKnots, ...)

Arguments

model

A model of class cslseModel or slseModel.

selKnots

An optional list of integers to select the knots from the list of knots specified by the model. If the model is a cslseModel object, it must be a named list with the names being either "treated", "nontreated" or both. By default, the knots from the model stored in the element knots are used.

...

Additional arguments to pass to other methods. Currently not used.

Details

The method for slseModel objects generates the matrix of basis functions implied by the set of knots included in the model and estimate the model by the least squares. Let Y be the outcome and U be the matrix of basis functions. Then, the function estimates the model using the code lm(Y~U).

For cslseModel, we could estimate the model using lm(Y~Z+I(Z-1)+I(U0*(1-Z))+I(U1*Z)), where Z is a binary variable equal to 1 for the treated and 0 for the nontreated, and U0 and U1 are the matrices of basis functions for the nontreated and treated, but the model is estimated separately for each group. Therefore, the function estSLSE.cslseModel calls the function estSLSE.slseModel for each slseModel objects included in the cslseModel object.

Value

It returns an object of class slseFit or cslseFit depending on which method is called. An object of class slseFit is a list with the following elements:

LSE

This is the least squares estimate of the semiparametric model. It is an object of class lm.

model

An object of class slseModel. It is the model that is being estimated. The model may have been created by slseModel or modified by selSLSE or update.

An object of class cslseFit is a list of slseFit objects, one for each treatment group. It also contains the following additional attributes:

treatedVar

The name of the variable in the dataset that represents the treatment indicator.

groupInd

A named vector with the value of the treatment indicator corresponding do each treatment group.

Examples

data(simDat3)

## Estimating a causal semiparametric model

mod1 <- cslseModel(Y ~ Z | ~ X1 * X2, data = simDat3)
fit1 <- estSLSE(mod1)

## Estimating a semiparametric model

mod2 <- slseModel(Y ~ X1 * X2, data = simDat3)
fit2 <- estSLSE(mod2)

[Package causalSLSE version 0.3-1 Index]