Skip to contents

Print out a summary from the conjoint analysis

Usage

conjoint_walk(dim, margins, amces, importance, ...)

Arguments

dim

dimension of analysis

margins

margins

amces

amces

importance

importance

...

other argument

Value

print some line for a notebook..

Details

* Marginal Means

* Average Marginal Component Effects (AMCEs)

* Average Marginal Component Effects (AMCEs)

* Importance Weights

Examples

kobodata <-  system.file("data-demo/conjoint_data.xlsx", package = "VulnerabilityScoreCalibration")
koboform <-  system.file("data-demo/conjoint_form.xlsx", package = "VulnerabilityScoreCalibration") 

cj <- conjoint_review(kobodata, koboform) 
#> New names:
#>  `` -> `...1`
#>  `` -> `...2`
#>  `` -> `...3`
#> Warning: There were 12 warnings in `dplyr::mutate()`.
#> The first warning was:
#>  In argument: `margins = list(cregg::mm(data, stats::as.formula(formula), id =
#>   ~email))`.
#>  In row 1.
#> Caused by warning in `logLik.svyglm()`:
#> ! svyglm not fitted by maximum likelihood.
#>  Run `dplyr::last_dplyr_warnings()` to see the 11 remaining warnings.
cjdata <- cj[["cjdata"]]
## Get a summary of all dimensions
purrr::pwalk(cjdata, conjoint_walk)
#> ---
#> 
#> PerfilDemografico
#> ---
#> 
#> ## Average Marginal Component Effects (AMCEs) - Bar 
#> 

#> 
#> 
#> ## Average Marginal Component Effects (AMCEs) - Point 
#> 
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).

#> 
#> 
#> ## Marginal Means
#> 

#> 
#> 
#> ## Importance Weights
#> 
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).

#> 
#> 
#> ---
#> 
#> NecesidadesBasicas
#> ---
#> 
#> ## Average Marginal Component Effects (AMCEs) - Bar 
#> 

#> 
#> 
#> ## Average Marginal Component Effects (AMCEs) - Point 
#> 
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).

#> 
#> 
#> ## Marginal Means
#> 

#> 
#> 
#> ## Importance Weights
#> 
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).

#> 
#> 
#> ---
#> 
#> AfrontamientoProteccion
#> ---
#> 
#> ## Average Marginal Component Effects (AMCEs) - Bar 
#> 

#> 
#> 
#> ## Average Marginal Component Effects (AMCEs) - Point 
#> 
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).

#> 
#> 
#> ## Marginal Means
#> 

#> 
#> 
#> ## Importance Weights
#> 
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).
#> Warning: Removed 1 rows containing missing values (`geom_segment()`).

#> 
#> 

## Save a csv extract of the weights
# purrr::walk2(cjdata$dim, cjdata$amces, ~write_csv(.y, fs::path(.x, ext = "csv")))

#all <- purrr::walk2(cjdata$amces,  ~cbind())

all <-purrr::pwalk(cjdata$amces, rbind)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
#> Warning: number of columns of result is not a multiple of vector length (arg 2)
all2 <- dplyr::bind_rows(cjdata$amces, .id = "column_label")