Description Usage Arguments Value References Examples
model_pAMCE
implements the model-based approach to estimate the pAMCE. See de la Cuesta, Egami, and Imai (2019+) for details. More examples are available at the GitHub page of factorEx
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
formula |
Formula |
formula_three |
Formula for three-way interactions (optional) |
data |
Data |
reg |
TRUE (regularization) or FALSE (no regularization). Default is TRUE |
ord_fac |
Whether we assume each factor is ordered. When not specified, we assume all of them are ordered |
pair |
Whether we use a paired-choice conjoint design |
pair_id |
Unique identifiers for pairs in the paired-choice conjoint design (optional) |
cross_int |
Include interactions across profiles. Default is FALSE. |
cluster_id |
Unique identifiers for computing cluster standard errors (optional). |
target_dist |
Target profile distributions to be used. This argument should be 'list' |
target_type |
Types of target profile distributions. 'marginal' or 'target_data'. See Examples for details. |
difference |
Whether we compute the differences between the multiple pAMCEs. Default is FALSE. |
cv_type |
(optimal only when 'reg = TRUE“) 'cv.1Std“ (stronger regularization; default) or 'cv.min' (weaker regularization). |
nfolds |
Number of cross validation folds. Default is 5. |
boot |
The number of bootstrap samples. |
seed |
Seed for bootstrap. |
numCores |
Number of cores to be used for parallel computing. If not specified, detect the number of available cores internally. |
model_pAMCE
returns an object of pAMCE
class.
AMCE
: Estimates of the pAMCE for all factors.
boot_AMCE
: Estimates of the pAMCE for all factors in each bootstrap sample.
boot_coef
: Estimates of coefficients for the linear probability model in each bootstrap sample.
approach
: "model_based"
input
: Input into the function.
...
: Values for internal use.
de la Cuesta, Egami, and Imai. (2019+). Improving the External Validity of Conjoint Analysis: The Essential Role of Profile Distribution. (Working Paper). Available at https://scholar.princeton.edu/sites/default/files/negami/files/conjoint_profile.pdf.
Egami and Imai. (2019). Causal Interaction in Factorial Experiments: Application to Conjoint Analysis. Journal of the American Statistical Association, Vol.114, No.526 (June), pp. 529–540. Available at https://scholar.princeton.edu/sites/default/files/negami/files/causalint.pdf.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # Small example
target_dist_marginal <- OnoBurden$target_dist_marginal
OnoBurden_data <- OnoBurden$OnoBurden_data
OnoBurden_data_small <- OnoBurden_data[1:300, ]
target_dist_marginal_small <- target_dist_marginal[c("gender", "race")]
# model-based estimation without regularization
out_model_s <-
model_pAMCE(formula = Y ~ gender + race,
data = OnoBurden_data_small, reg = FALSE,
pair_id = OnoBurden_data_small$pair_id,
cluster_id = OnoBurden_data_small$id,
target_dist = target_dist_marginal_small,
target_type = "marginal")
# Example
data("OnoBurden")
OnoBurden_data <- OnoBurden$OnoBurden_data
OnoBurden_data_cong <- OnoBurden_data[OnoBurden_data$office == "Congress", ]
target_dist_marginal <- OnoBurden$target_dist_marginal
# model-based estimation with regularization
out_model <-
model_pAMCE(formula = Y ~ gender + age + family + race + experience + party + pos_security,
data = OnoBurden_data_cong,
pair_id = OnoBurden_data_cong$pair_id,
cluster_id = OnoBurden_data_cong$id,
target_dist = target_dist_marginal, target_type = "marginal")
summary(out_model, factor_name = c("gender"))
# decompose the difference in the pAMCEs
decompose_pAMCE(out_model, effect_name = c("gender", "Female"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.