Calculate (descriptive) marginal means (MMs) from a conjoint design

mm(
  data,
  formula,
  id = ~0,
  weights = NULL,
  feature_order = NULL,
  feature_labels = NULL,
  level_order = c("ascending", "descending"),
  alpha = 0.05,
  h0 = 0,
  ...
)

Arguments

data

A data frame containing variables specified in formula. All RHS variables should be factors.

formula

A formula specifying an outcome (LHS) and conjoint features (RHS) to describe. All variables should be factors; all levels across features should be unique, with constraints specified with an asterisk (*) between features, as in amce.

id

An RHS formula specifying a variable holding respondent identifiers, to be used for clustering standard errors. By default, data are unclustered.

weights

An (optional) RHS formula specifying a variable holding survey weights.

feature_order

An (optional) character vector specifying the names of feature (RHS) variables in the order they should be encoded in the resulting data frame.

feature_labels

A named list of “fancy” feature labels to be used in output. By default, the function looks for a “label” attribute on each variable in formula and uses that for pretty printing. This argument overrides those attributes or otherwise provides fancy labels for this purpose. This should be a list with names equal to variables on the righthand side of formula and character string values; arguments passed here override variable attributes.

level_order

A character string specifying levels (within each feature) should be ordered increasing or decreasing in the final output. This is mostly only consequential for plotting via plot.cj_mm, etc.

alpha

A numeric value indicating the significance level at which to calculate confidence intervals for the MMs (by default 0.95, meaning 95-percent CIs are returned).

h0

A numeric value specifying a null hypothesis value to use when generating z-statistics and p-values.

...

Ignored.

Value

A data frame of class “cj_mm”

Details

mm provides descriptive representations of conjoint data as marginal means (MMs), which represent the mean outcome across all appearances of a particular conjoint feature level, averaging across all other features. In forced choice conjoint designs with two profiles per choice task, MMs by definition average 0.5 with values above 0.5 indicating features that increase profile favorability and values below 0.5 indicating features that decrease profile favorability. For continuous outcomes, MMs can take any value in the full range of the outcome.

But note that if feature levels can co-occur, such that both alternatives share a feature level, then the MMs on forced choice outcomes are bounded by the probability of co-occurrence (as a lower bound) and 1 minus that probability as an upper bound.

Plotting functionality is provided in plot.cj_mm.

See also

Examples

# \donttest{ data(immigration) # marginal means mm(immigration, ChosenImmigrant ~ Gender + Education + LanguageSkills, id = ~ CaseID, h0 = 0.5)
#> outcome statistic feature level #> 1 ChosenImmigrant mm Gender Female #> 2 ChosenImmigrant mm Gender Male #> 3 ChosenImmigrant mm Educational Attainment No Formal #> 4 ChosenImmigrant mm Educational Attainment 4th Grade #> 5 ChosenImmigrant mm Educational Attainment 8th Grade #> 6 ChosenImmigrant mm Educational Attainment High School #> 7 ChosenImmigrant mm Educational Attainment Two-Year College #> 8 ChosenImmigrant mm Educational Attainment College Degree #> 9 ChosenImmigrant mm Educational Attainment Graduate Degree #> 10 ChosenImmigrant mm Language Skills Fluent English #> 11 ChosenImmigrant mm Language Skills Broken English #> 12 ChosenImmigrant mm Language Skills Tried English but Unable #> 13 ChosenImmigrant mm Language Skills Used Interpreter #> estimate std.error z p lower upper #> 1 0.5117812 0.004176882 2.820574 4.793778e-03 0.5035947 0.5199677 #> 2 0.4877013 0.004353571 -2.824964 4.728592e-03 0.4791685 0.4962342 #> 3 0.3895112 0.010396937 -10.627053 2.230500e-26 0.3691336 0.4098888 #> 4 0.4222002 0.010291045 -7.559951 4.032206e-14 0.4020301 0.4423703 #> 5 0.4444444 0.010183074 -5.455676 4.878681e-08 0.4244860 0.4644029 #> 6 0.5075226 0.010189329 0.738279 4.603449e-01 0.4875518 0.5274933 #> 7 0.5655860 0.010227744 6.412561 1.430949e-10 0.5455400 0.5856320 #> 8 0.5888945 0.010268403 8.657096 4.839344e-18 0.5687688 0.6090202 #> 9 0.5812686 0.010393398 7.819251 5.313867e-15 0.5608979 0.6016393 #> 10 0.5875280 0.007305481 11.981136 4.461689e-33 0.5732095 0.6018464 #> 11 0.5261628 0.007490787 3.492662 4.782307e-04 0.5114811 0.5408445 #> 12 0.4592973 0.007417263 -5.487558 4.075292e-08 0.4447598 0.4738349 #> 13 0.4243392 0.007564513 -10.002066 1.492498e-23 0.4095131 0.4391654
# higher-order marginal means with feature interactions immigration$language_entry <- interaction(immigration$LanguageSkills, immigration$PriorEntry, sep = "_") mm(immigration, ChosenImmigrant ~ language_entry, id = ~CaseID)
#> outcome statistic feature #> 1 ChosenImmigrant mm language_entry #> 2 ChosenImmigrant mm language_entry #> 3 ChosenImmigrant mm language_entry #> 4 ChosenImmigrant mm language_entry #> 5 ChosenImmigrant mm language_entry #> 6 ChosenImmigrant mm language_entry #> 7 ChosenImmigrant mm language_entry #> 8 ChosenImmigrant mm language_entry #> 9 ChosenImmigrant mm language_entry #> 10 ChosenImmigrant mm language_entry #> 11 ChosenImmigrant mm language_entry #> 12 ChosenImmigrant mm language_entry #> 13 ChosenImmigrant mm language_entry #> 14 ChosenImmigrant mm language_entry #> 15 ChosenImmigrant mm language_entry #> 16 ChosenImmigrant mm language_entry #> 17 ChosenImmigrant mm language_entry #> 18 ChosenImmigrant mm language_entry #> 19 ChosenImmigrant mm language_entry #> 20 ChosenImmigrant mm language_entry #> level estimate std.error #> 1 Fluent English_Never 0.5963939 0.01794824 #> 2 Broken English_Never 0.5000000 0.01868574 #> 3 Tried English but Unable_Never 0.4211248 0.01813613 #> 4 Used Interpreter_Never 0.4209703 0.01908138 #> 5 Fluent English_Once as Tourist 0.6330409 0.01802151 #> 6 Broken English_Once as Tourist 0.5700000 0.01790043 #> 7 Tried English but Unable_Once as Tourist 0.5195936 0.01831354 #> 8 Used Interpreter_Once as Tourist 0.4458509 0.01830720 #> 9 Fluent English_Many Times as Tourist 0.6222222 0.01744591 #> 10 Broken English_Many Times as Tourist 0.5759768 0.01828850 #> 11 Tried English but Unable_Many Times as Tourist 0.5082956 0.01909682 #> 12 Used Interpreter_Many Times as Tourist 0.4579025 0.01945735 #> 13 Fluent English_Six Months with Family 0.6250000 0.01770276 #> 14 Broken English_Six Months with Family 0.6008902 0.01855907 #> 15 Tried English but Unable_Six Months with Family 0.5243902 0.01786358 #> 16 Used Interpreter_Six Months with Family 0.4843305 0.01840726 #> 17 Fluent English_Once w/o Authorization 0.4651163 0.01854707 #> 18 Broken English_Once w/o Authorization 0.3865906 0.01829631 #> 19 Tried English but Unable_Once w/o Authorization 0.3211144 0.01759690 #> 20 Used Interpreter_Once w/o Authorization 0.3151261 0.01724809 #> z p lower upper #> 1 33.22854 4.168770e-242 0.5612160 0.6315718 #> 2 26.75837 9.867229e-158 0.4633766 0.5366234 #> 3 23.22022 2.845436e-119 0.3855787 0.4566710 #> 4 22.06184 7.353720e-108 0.3835714 0.4583691 #> 5 35.12697 2.613148e-270 0.5977194 0.6683624 #> 6 31.84281 1.655498e-222 0.5349158 0.6050842 #> 7 28.37210 4.469109e-177 0.4836997 0.5554875 #> 8 24.35385 5.277043e-131 0.4099695 0.4817324 #> 9 35.66578 1.341493e-278 0.5880289 0.6564156 #> 10 31.49393 1.051800e-217 0.5401320 0.6118217 #> 11 26.61677 4.341482e-156 0.4708666 0.5457247 #> 12 23.53365 1.846108e-122 0.4197668 0.4960382 #> 13 35.30524 4.880534e-273 0.5903032 0.6596968 #> 14 32.37718 5.752405e-230 0.5645151 0.6372653 #> 15 29.35527 2.046636e-189 0.4893783 0.5594022 #> 16 26.31193 1.400650e-152 0.4482529 0.5204081 #> 17 25.07761 8.729019e-139 0.4287647 0.5014679 #> 18 21.12943 4.266321e-99 0.3507305 0.4224507 #> 19 18.24834 2.132739e-74 0.2866251 0.3556037 #> 20 18.27020 1.429226e-74 0.2813204 0.3489317
# }