Skip to contents

This main function analyzes a conjoint data set and produces measurement error-corrected estimates of either marginal means or average marginal component effects, ready for plotting. It accepts a projoint_data object, and optionally a projoint_qoi object for users who wish to specify more complex quantities of interest.

Usage

projoint(
  .data,
  .qoi = NULL,
  .by_var = NULL,
  .structure = "profile_level",
  .estimand = "mm",
  .se_method = "analytical",
  .irr = NULL,
  .remove_ties = TRUE,
  .ignore_position = NULL,
  .n_sims = NULL,
  .n_boot = NULL,
  .weights_1 = NULL,
  .clusters_1 = NULL,
  .se_type_1 = "classical",
  .weights_2 = NULL,
  .clusters_2 = NULL,
  .se_type_2 = "classical"
)

# S3 method for projoint_results
print(x, ...)

# S3 method for projoint_results
summary(object, ...)

Arguments

.data

A projoint_data object

.qoi

A projoint_qoi object. If NULL, defaults to producing all MMs and all AMCEs.

.by_var

A dichotomous variable (character) used for subgroup analysis

.structure

Either "profile_level" (default) or "choice_level". If .qoi is set, the value of structure from .qoi overrides this value.

.estimand

Either "mm" for marginal mean or "amce" for average marginal component effect. If .qoi is set, the value of estimand from .qoi overrides this value.

.se_method

By default, c("analytic", "simulation", "bootstrap") description

.irr

NULL (default) if IRR is to be calculated using the repeated task. Otherwise, a numerical value

.remove_ties

Logical: should ties be removed before estimation? Defaults to TRUE.

.ignore_position

NULL (default) if .structure = "choice_level". Set to TRUE if you ignore the position of profile (left or right); FALSE if the relative positioning of profiles matters for analysis. If .structure = "choice_level" and this argument is NULL, it is automatically reset to TRUE.

.n_sims

The number of simulations. Relevant only if .se_method == "simulation"

.n_boot

The number of bootstrapped samples. Relevant only if .se_method == "bootstrap"

.weights_1

the weight to estimate IRR (see lm_robust): NULL (default)

.clusters_1

the clusters to estimate IRR (see lm_robust): NULL (default)

.se_type_1

the standard error type to estimate IRR (see lm_robust): "classical" (default)

.weights_2

the weight to estimate MM or AMCE (see lm_robust): NULL (default)

.clusters_2

the clusters to estimate MM or AMCE (see lm_robust): NULL (default)

.se_type_2

the standard error type to estimate MM or AMCE (see lm_robust): "classical" (default)

x

A projoint_results object

...

Optional arguments; currently none accepted

object

A projoint_results object

Value

A projoint_results object

Examples


library(projoint)

data("exampleData1")
head(exampleData1)
#> # A tibble: 6 × 185
#>   ResponseId      choice1_repeated_fli…¹ choice1 choice2 choice3 choice4 choice5
#>   <chr>           <chr>                  <chr>   <chr>   <chr>   <chr>   <chr>  
#> 1 R_1M3TDihZzq9z… Community B            Commun… Commun… Commun… Commun… Commun…
#> 2 R_3HtXzkcSSlfi… Community B            Commun… Commun… Commun… Commun… Commun…
#> 3 R_yjYj0jtOY98X… Community B            Commun… Commun… Commun… Commun… Commun…
#> 4 R_1dKd05O6FTOV… Community B            Commun… Commun… Commun… Commun… Commun…
#> 5 R_1otDp642wWYl… Community A            Commun… Commun… Commun… Commun… Commun…
#> 6 R_2BnD3fuJMRKZ… Community A            Commun… Commun… Commun… Commun… Commun…
#> # ℹ abbreviated name: ¹​choice1_repeated_flipped
#> # ℹ 178 more variables: choice6 <chr>, choice7 <chr>, choice8 <chr>,
#> #   race <chr>, party_1 <chr>, party_2 <chr>, party_3 <chr>, party_4 <chr>,
#> #   ideology <chr>, honesty <chr>, `K-1-1` <chr>, `K-1-1-1` <chr>,
#> #   `K-1-2` <chr>, `K-1-1-2` <chr>, `K-1-3` <chr>, `K-1-1-3` <chr>,
#> #   `K-1-4` <chr>, `K-1-1-4` <chr>, `K-1-5` <chr>, `K-1-1-5` <chr>,
#> #   `K-1-6` <chr>, `K-1-1-6` <chr>, `K-1-7` <chr>, `K-1-1-7` <chr>, …

outcomes <- paste0("choice", seq(from = 1, to = 8, by = 1))
outcomes <- c(outcomes, "choice1_repeated_flipped")

reshaped_data <- reshape_projoint(
  .dataframe = exampleData1, 
  .outcomes = outcomes)

projoint(reshaped_data) 
#> [A projoint output]
#>  Estimand: mm 
#>  Structure: profile_level 
#>  IRR: Estimated 
#>  Tau: 0.1721281 
#>  Remove ties: TRUE 
#>  SE methods: analytical