cjbae_formula: Conjoint formula conversion for Bayesian analysis

Description Usage Arguments Details Examples

Description

Convert standard tidy conjoint function (data, formula, id) input into the input for a 'brms' model.

Usage

1

Arguments

data

A tidy, long-format conjoint dataframe.

formula

A formula specifying an AMCE/MM model, to be converted for bayesian analysis. All variables should be factors.

id

A variable, within data, containing respondent IDs.

Details

cjbae_formula takes three arguments: 'data', 'formula', and 'id', and uses these to specify a formula to be passed to 'brm()', to facilitate bayesian analysis of conjoint experiments otherwise analysed using 'cregg'. This function is integrated into other 'cjbae()' functions and only necessary in isolation if you are directly using 'brms()'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#load example data from cregg
library(cregg)
data(immigration)
#with simple input formula
cjbae_formula(data = immigration, formula = ChosenImmigrant ~ Gender + Job, id = CaseID)
#or matched positionally
cjbae_formula(immigration, ChosenImmigrant ~ Gender + Job, CaseID)
#can pre-specify longer input formula
f1 <- ChosenImmigrant ~ Gender + Education + LanguageSkills +
CountryOfOrigin + Job + JobExperience + JobPlans +
ReasonForApplication + PriorEntry
cjbae_formula(immigration, f1, CaseID)

mbarnfield/cjbae documentation built on June 23, 2019, 3:32 a.m.