Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


EffectLiteR (version 0.5-1)

autoSelectSubset: Autoselect Subset for Aggregated Effects

Description

Automatically selects a subset of the original dataset for computing specific aggregated effects. The subset is selected such that it is as close as possible to the user supplied newdata frame. The function uses exact matching for categorical covariates (and the treatment if specified) and matching based on the Mahalanobis distance for continuous covariates.

Usage

autoSelectSubset(obj, newdata, nsub = 10)

Value

Vector of integers indicating the rows to use for computing the aggregated effects. Can directly be used in computeAggregatedEffects

Arguments

obj

Object of class effectlite.

newdata

A data.frame with a single row, containing the same continuous and categorical covariates (and potentially the treatment variable) as used when fitting the EffectLiteR model in obj.

nsub

Integer. How many data points should be used for matching the continous covariates. Will be ignored if no values for continuous covariates are specified.

Examples

Run this code
m1 <- effectLite(y="dv", z=c("z1"), k=c("k1"), x="x", 
control="control", data=example01, fixed.cell=TRUE, fixed.z=TRUE)
newdata <- data.frame(k1=NA, z1=1)
agg.subset <- autoSelectSubset(m1, newdata)

Run the code above in your browser using DataLab