diff --git a/DESCRIPTION b/DESCRIPTION index 84247b5..a346382 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,12 +1,12 @@ Package: cregg Type: Package Title: Simple Conjoint Tidying, Analysis, and Visualization -Version: 0.2.4 -Date: 2018-07-23 +Version: 0.3.0 +Date: 2018-07-27 Authors@R: c(person("Thomas J.", "Leeper", role = c("aut", "cre"), email = "thosjleeper@gmail.com", comment = c(ORCID = "0000-0003-4097-6326"))) -Description: Simple tidying, analysis, and visualization of conjoint (factorial) experiments, including estimation and visualization of average marginal component effects ('AMCEs') and marginal means ('MMs') for weighted and un-weighted survey data, along with useful reference category diagnostics and statistical tests. Estimation of AMCEs is based upon methods described by Hainmueller, Hopkins, and Yamamoto (2014) . +Description: Simple tidying, analysis, and visualization of conjoint (factorial) experiments, including estimation and visualization of average marginal component effects ('AMCEs') and marginal means ('MMs') for weighted and un-weighted survey data, along with useful reference category diagnostics and statistical tests. Estimation of 'AMCEs' is based upon methods described by Hainmueller, Hopkins, and Yamamoto (2014) . License: MIT + file LICENSE URL: https://github.com/leeper/cregg BugReports: https://github.com/leeper/cregg/issues @@ -16,7 +16,7 @@ Imports: sandwich (>= 2.4-0), survey (>= 3.33), lmtest, - ggplot2, + ggplot2 (>= 2.0), ggstance, scales Suggests: diff --git a/R/amce.R b/R/amce.R index a2f3bca..185b897 100644 --- a/R/amce.R +++ b/R/amce.R @@ -28,7 +28,7 @@ #' data("immigration") #' # estimating AMCEs with constraints #' amce(immigration, ChosenImmigrant ~ Gender + ReasonForApplication * CountryOfOrigin, -#' id = ~CaseID, constraints = list(~ReasonForApplication + CountryOfOrigin)) +#' id = ~CaseID) #' #' # balance testing example #' plot(amce(immigration[!is.na(immigration$ethnocentrism),], diff --git a/R/cj_tidy.R b/R/cj_tidy.R index 73cbfa6..c940bcc 100644 --- a/R/cj_tidy.R +++ b/R/cj_tidy.R @@ -72,7 +72,10 @@ #' #' #' # perform reshape -#' str(long <- cj_tidy(wide_conjoint, profile_variables = list1, task_variables = list2, id = ~ respondent)) +#' str(long <- cj_tidy(wide_conjoint, +#' profile_variables = list1, +#' task_variables = list2, +#' id = ~ respondent)) #' stopifnot(nrow(long) == nrow(wide_conjoint)*4*2) #' #' # recode outcome so it is coded sensibly diff --git a/R/plot_cj_amce.R b/R/plot_cj_amce.R index 2548f2f..07fabd8 100644 --- a/R/plot_cj_amce.R +++ b/R/plot_cj_amce.R @@ -55,9 +55,6 @@ #' d2_1$reasons <- "1,2,3" #' d2_2$reasons <- "1,2" #' plot(rbind(d2_1, d2_2), group = "reasons") -#' -#' # plot AMCEs -#' plot(d2) #' } #' @seealso \code{\link{amce}}, \code{\link{mm}} #' @import ggplot2 diff --git a/man/amce.Rd b/man/amce.Rd index 73c4bc2..176635c 100644 --- a/man/amce.Rd +++ b/man/amce.Rd @@ -55,7 +55,7 @@ amce(taxes, chose_plan ~ taxrate1 + taxrate2 + taxrate3 + data("immigration") # estimating AMCEs with constraints amce(immigration, ChosenImmigrant ~ Gender + ReasonForApplication * CountryOfOrigin, - id = ~CaseID, constraints = list(~ReasonForApplication + CountryOfOrigin)) + id = ~CaseID) # balance testing example plot(amce(immigration[!is.na(immigration$ethnocentrism),], diff --git a/man/cj_tidy.Rd b/man/cj_tidy.Rd index 9f61c6c..79d15fc 100644 --- a/man/cj_tidy.Rd +++ b/man/cj_tidy.Rd @@ -88,7 +88,10 @@ list2 <- list(choice = ~ choice_a + choice_b + choice_c + choice_d, # perform reshape -str(long <- cj_tidy(wide_conjoint, profile_variables = list1, task_variables = list2, id = ~ respondent)) +str(long <- cj_tidy(wide_conjoint, + profile_variables = list1, + task_variables = list2, + id = ~ respondent)) stopifnot(nrow(long) == nrow(wide_conjoint)*4*2) # recode outcome so it is coded sensibly diff --git a/man/plot.Rd b/man/plot.Rd index 6893332..d01537e 100644 --- a/man/plot.Rd +++ b/man/plot.Rd @@ -106,9 +106,6 @@ d2_2 <- cj(reasons12, ChosenImmigrant ~ CountryOfOrigin, id = ~ CaseID, d2_1$reasons <- "1,2,3" d2_2$reasons <- "1,2" plot(rbind(d2_1, d2_2), group = "reasons") - -# plot AMCEs -plot(d2) } } \seealso{