IMCE {cjbart} | R Documentation |
Heterogeneous Effects Analysis of Conjoint Results
Description
IMCE
calculates the individual-level marginal component effects from a BART-estimated conjoint model.
Usage
IMCE(
data,
model,
attribs,
ref_levels,
method = "bayes",
alpha = 0.05,
keep_omce = FALSE,
cores = 1,
skip_checks = FALSE
)
Arguments
data |
A data.frame, containing all attributes, covariates, the outcome and id variables to analyze. |
model |
A model object, the result of running |
attribs |
Vector of attribute names for which IMCEs will be predicted |
ref_levels |
Vector of reference levels, used to calculate marginal effects |
method |
Character string, setting the variance estimation method to use. When method is "parametric", a typical combined variance estimate is employed; when |
alpha |
Number between 0 and 1 – the significance level used to compute confidence/posterior intervals. When |
keep_omce |
Boolean, indicating whether to keep the OMCE-level results (default = |
cores |
Number of CPU cores used during prediction phase |
skip_checks |
Boolean, indicating whether to check the structure of the data (default = |
Details
The OMCE estimates are the result of subtracting the predicted value of each observation under the reference-level category from the predicted value of each observation under the given attribute level. If an attribute has k levels, then this will yield k-1 estimates per observation. The IMCE is the average of the OMCEs for each individual within the data.
Value
IMCE
returns an object of type "cjbart", a list object.
omce |
A data.frame containing the observation-level marginal effects |
imce |
A data.frame containing the individual-level marginal effects |
imce_upper |
A data.frame containing the upper bound of the IMCE confidence/credible interval |
imce_lower |
A data.frame containing the lower bound of the IMCE confidence/credible interval |
att_levels |
A vector containing the attribute levels |
See Also
Examples
subjects <- 5
rounds <- 2
profiles <- 2
obs <- subjects*rounds*profiles
fake_data <- data.frame(A = sample(c("a1","a2"), obs, replace = TRUE),
B = sample(c("b1","b2"), obs, replace = TRUE),
id1 = rep(1:subjects, each=rounds),
stringsAsFactors = TRUE)
fake_data$Y <- sample(c(0,1), obs, replace = TRUE)
cj_model <- cjbart(data = fake_data,
Y = "Y",
id = "id1")
## Skip if not Unix due to longer CPU time
if (.Platform$OS.type=='unix') {
het_effects <- IMCE(data = fake_data,
model = cj_model,
attribs = c("A","B"),
ref_levels = c("a1","b1"),
cores = 1)
summary(het_effects)
}