autoSelectSubset {EffectLiteR}R Documentation

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)

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.

Value

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

Examples

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)

[Package EffectLiteR version 0.4-6 Index]