Learn R Programming

FindIt (version 1.2.0)

ConditionalEffect: Estimating the Conditional Effects with the CausalANOVA.

Description

ConditionalEffect estimates a variety of conditional effects using the ouput from CausalANOVA.

Usage

ConditionalEffect(
  object,
  treat.fac = NULL,
  cond.fac = NULL,
  base.ind = 1,
  round = 3,
  inference = NULL,
  verbose = TRUE
)

Arguments

object

The output from CausalANOAV function.

treat.fac

The name of factor acting as the main treatment variable.

cond.fac

The name of factor acting as the conditioning (moderating) variable.

base.ind

An indicator for the baseline of the treatment factor. Default is 1.

round

Digits to round estimates. Default is 3.

inference

(optional). This argument is mainly for internal use. It indicates whether CausalANOVA has done inference or not.

verbose

Whether it prints the progress.

Value

CondtionalEffects

The summary of estimated conditional effects.

...

Arguments for the internal use.

Details

See Details in CausalANOVA.

References

Egami, Naoki and Kosuke Imai. 2019. Causal Interaction in Factorial Experiments: Application to Conjoint Analysis, Journal of the American Statistical Association. http://imai.fas.harvard.edu/research/files/int.pdf

Lim, M. and Hastie, T. 2015. Learning interactions via hierarchical group-lasso regularization. Journal of Computational and Graphical Statistics 24, 3, 627--654.

Post, J. B. and Bondell, H. D. 2013. ``Factor selection and structural identification in the interaction anova model.'' Biometrics 69, 1, 70--79.

See Also

CausalANOVA.

Examples

Run this code
# NOT RUN {
data(Carlson)
## Specify the order of each factor
Carlson$newRecordF<- factor(Carlson$newRecordF,ordered=TRUE,
                            levels=c("YesLC", "YesDis","YesMP",
                                     "noLC","noDis","noMP","noBusi"))
Carlson$promise <- factor(Carlson$promise,ordered=TRUE,levels=c("jobs","clinic","education"))
Carlson$coeth_voting <- factor(Carlson$coeth_voting,ordered=FALSE,levels=c("0","1"))
Carlson$relevantdegree <- factor(Carlson$relevantdegree,ordered=FALSE,levels=c("0","1"))

## ####################################### 
## Without Screening and Collapsing
## ####################################### 
#################### AMEs and two-way AMIEs ####################
fit2 <- CausalANOVA(formula=won ~ newRecordF + promise + coeth_voting + relevantdegree,
                    int2.formula = ~ newRecordF:coeth_voting,
                    data=Carlson, pair.id=Carlson$contestresp,diff=TRUE,
                    cluster=Carlson$respcodeS, nway=2)
summary(fit2)
plot(fit2, type="ConditionalEffect", fac.name=c("newRecordF","coeth_voting"))
ConditionalEffect(fit2, treat.fac="newRecordF", cond.fac="coeth_voting")
# }

Run the code above in your browser using DataLab