Core workhorse for computing marginal means (MMs) or AMCEs from a conjoint design, with optional intra-respondent reliability (IRR) correction.
Usage
pj_estimate(
.data,
.structure,
.estimand,
.att_choose,
.lev_choose,
.att_notchoose,
.lev_notchoose,
.att_choose_b,
.lev_choose_b,
.att_notchoose_b,
.lev_notchoose_b,
.se_method,
.irr,
.remove_ties,
.ignore_position,
.n_sims,
.n_boot,
.weights_1,
.clusters_1,
.se_type_1,
.weights_2,
.clusters_2,
.se_type_2,
.auto_cluster = TRUE,
.seed = NULL
)
Arguments
- .data
A
projoint_data
object created byreshape_projoint
ormake_projoint_data
.- .structure
Either
"profile_level"
or"choice_level"
.- .estimand
Either
"mm"
(marginal mean) or"amce"
(average marginal component effect).- .att_choose
Attribute for the chosen profile/feature.
- .lev_choose
Level(s) for the chosen profile/feature. Length 1 for
profile_level
; may be 1+ forchoice_level
.- .att_notchoose
Attribute for the not-chosen profile/feature (required for
choice_level
).- .lev_notchoose
Level(s) for the not-chosen profile/feature (required for
choice_level
).- .att_choose_b
(AMCE only) Baseline attribute for comparison.
- .lev_choose_b
(AMCE only) Baseline level(s) for comparison.
- .att_notchoose_b
(AMCE only, choice-level only) Baseline attribute for the not-chosen profile.
- .lev_notchoose_b
(AMCE only, choice-level only) Baseline level(s) for the not-chosen profile.
- .se_method
One of
"analytical"
,"simulation"
, or"bootstrap"
.- .irr
NULL
(default) to estimate IRR from repeated tasks; otherwise a numeric IRR value.- .remove_ties
Logical; should ties be removed before estimation? Defaults to
TRUE
.- .ignore_position
Logical; only for
choice_level
. IfTRUE
(default), ignore profile position (left/right).- .n_sims
Integer; required if
.se_method == "simulation"
.- .n_boot
Integer; required if
.se_method == "bootstrap"
.- .weights_1
(Optional) Bare (unquoted) column with weights for IRR estimation; passed to
lm_robust
.- .clusters_1
(Optional) Bare (unquoted) column with clusters for IRR estimation; passed to
lm_robust
.- .se_type_1
SE type for IRR estimation; passed to
lm_robust
. IfNULL
, estimatr defaults are used (HC2 when unclustered; CR2 when clustered).- .weights_2
(Optional) Bare (unquoted) column with weights for MM/AMCE estimation; passed to
lm_robust
.- .clusters_2
(Optional) Bare (unquoted) column with clusters for MM/AMCE estimation; passed to
lm_robust
.- .se_type_2
SE type for MM/AMCE estimation; passed to
lm_robust
. IfNULL
, estimatr defaults are used (HC2 when unclustered; CR2 when clustered).- .auto_cluster
Logical; if
TRUE
(default), auto-cluster onid
when present and no.clusters_*
are supplied; auto-clustering only occurs when the corresponding.se_type_*
isNULL
. Seeprojoint
.- .seed
Optional integer. If supplied, sets a temporary RNG seed for reproducible simulation/bootstrap inside this call and restores the previous RNG state on exit.
Value
A data frame with rows for the requested estimand(s) and columns:
estimand
: one of"mm_uncorrected"
,"mm_corrected"
,"amce_uncorrected"
,"amce_corrected"
.estimate
,se
,conf.low
,conf.high
,tau
.
Details
IRR is clipped to [0.5, 1)
(with a tiny epsilon) to avoid boundary issues.
For choice-level MMs, ties must be removed (.remove_ties = TRUE
).
When .seed
is supplied, the previous RNG state is restored on exit.