diff --git a/NEWS.md b/NEWS.md
index b702ddad..97be8aaa 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,7 @@
## Summary of larger updates:
- Added support for auto creating interactions amongst variables
+- exported `getCoefTable()` function
## Summary of smaller updates:
diff --git a/README.Rmd b/README.Rmd
index 57b85563..2e9d1a7c 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -10,12 +10,12 @@ knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
comment = "#>",
- fig.path = "man/figures/",
+ fig.path = "man/figs/",
fig.retina = 3
)
```
-# logitr
+# logitr
[![Lifecycle:
diff --git a/README.md b/README.md
index d947e1d3..42c36da3 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-# logitr
+# logitr
@@ -88,8 +88,8 @@ citation("logitr")
#>
#> To cite logitr in publications use:
#>
-#> John Paul Helveston. logitr: Random utility logit models with
-#> preference and willingness to pay space parameterizations (2020)
+#> John Paul Helveston (2020). logitr: Random utility logit models with
+#> preference and willingness to pay space parameterizations.
#>
#> A BibTeX entry for LaTeX users is
#>
@@ -97,7 +97,7 @@ citation("logitr")
#> title = {logitr: Random utility logit models with preference and willingness to pay space parameterizations},
#> author = {John Paul Helveston},
#> year = {2020},
-#> note = {R package version 0.0.4},
+#> note = {R package version 0.0.5},
#> url = {https://jhelvy.github.io/logitr/},
#> }
```
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 95470f18..4fcb67d3 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -54,6 +54,7 @@ reference:
contents:
- summary.logitr
- coef.logitr
+ - getCoefTable
- statusCodes
- title: "Computing and Comparing WTP"
desc: "Functions for computing and comparing WTP from estimated models."
diff --git a/inst/example/simulations.R b/inst/example/simulations.R
index d5387fc4..23888e7c 100644
--- a/inst/example/simulations.R
+++ b/inst/example/simulations.R
@@ -49,16 +49,6 @@ sim_mxl_pref
sim_mxl_wtp <- simulateShares(mxl_wtp, alts, priceName = 'price')
sim_mxl_wtp
-# Plot simulation results from preference space MNL model:
-library(ggplot2)
-sim_mnl_pref$alt <- row.names(sim_mnl_pref)
-ggplot(sim_mnl_pref, aes(x = alt, y = share_mean)) +
- geom_bar(stat = 'identity', width = 0.7, fill = "dodgerblue") +
- geom_errorbar(aes(ymin = share_low, ymax = share_high), width = 0.2) +
- scale_y_continuous(limits = c(0, 1)) +
- labs(x = 'Alternative', y = 'Expected Share') +
- theme_bw()
-
# Save results
saveRDS(sim_mnl_pref,
here::here('inst', 'extdata', 'sim_mnl_pref.Rds'))
@@ -68,3 +58,19 @@ saveRDS(sim_mxl_pref,
here::here('inst', 'extdata', 'sim_mxl_pref.Rds'))
saveRDS(sim_mxl_wtp,
here::here('inst', 'extdata', 'sim_mxl_wtp.Rds'))
+
+# Plot simulation results from each model:
+library(ggplot2)
+
+sims <- rbind(sim_mnl_pref, sim_mnl_wtp, sim_mxl_pref, sim_mxl_wtp)
+sims$model <- c(rep("mnl_pref", 4), rep("mnl_wtp", 4),
+ rep("mxl_pref", 4), rep("mxl_wtp", 4))
+sims$alt <- rep(row.names(alts), 4)
+
+ggplot(sims, aes(x = alt, y = share_mean, fill = model)) +
+ geom_bar(stat = 'identity', width = 0.7, position = "dodge") +
+ geom_errorbar(aes(ymin = share_low, ymax = share_high),
+ width = 0.2, position = position_dodge(width = 0.7)) +
+ scale_y_continuous(limits = c(0, 1)) +
+ labs(x = 'Alternative', y = 'Expected Share') +
+ theme_bw()
diff --git a/inst/extdata/sim_mnl_pref.Rds b/inst/extdata/sim_mnl_pref.Rds
index 512c919c..5b93fd27 100644
Binary files a/inst/extdata/sim_mnl_pref.Rds and b/inst/extdata/sim_mnl_pref.Rds differ
diff --git a/inst/extdata/sim_mnl_wtp.Rds b/inst/extdata/sim_mnl_wtp.Rds
index a94d02d8..d9342f9a 100644
Binary files a/inst/extdata/sim_mnl_wtp.Rds and b/inst/extdata/sim_mnl_wtp.Rds differ
diff --git a/inst/extdata/sim_mxl_pref.Rds b/inst/extdata/sim_mxl_pref.Rds
index 41300c37..3e5b7041 100644
Binary files a/inst/extdata/sim_mxl_pref.Rds and b/inst/extdata/sim_mxl_pref.Rds differ
diff --git a/inst/extdata/sim_mxl_wtp.Rds b/inst/extdata/sim_mxl_wtp.Rds
index 34e88ba3..973f521e 100644
Binary files a/inst/extdata/sim_mxl_wtp.Rds and b/inst/extdata/sim_mxl_wtp.Rds differ
diff --git a/man/figures/logitr-hex.ai b/man/figs/logitr-hex.ai
similarity index 100%
rename from man/figures/logitr-hex.ai
rename to man/figs/logitr-hex.ai
diff --git a/man/figures/logitr-hex.png b/man/figs/logitr-hex.png
similarity index 100%
rename from man/figures/logitr-hex.png
rename to man/figs/logitr-hex.png
diff --git a/next_release.md b/next_release.md
index f2ef8f4c..60637317 100644
--- a/next_release.md
+++ b/next_release.md
@@ -1,14 +1,6 @@
-# logitr 0.0.5
+# logitr 0.0.6
## Summary of larger updates:
-- Added support for creating interactions amongst variables
## Summary of smaller updates:
-
-- Added new documentation for prepping data:
- - overall structure
- - dummyCode() function
- - handling interactions
-- All vignettes proof-read with lots of small changes to examples
-- Added a hex sticker
diff --git a/vignettes/figs/unnamed-chunk-11-1.png b/vignettes/figs/unnamed-chunk-11-1.png
new file mode 100644
index 00000000..526d6890
Binary files /dev/null and b/vignettes/figs/unnamed-chunk-11-1.png differ
diff --git a/vignettes/mnl_models_weighted.Rmd b/vignettes/mnl_models_weighted.Rmd
index 52b136e0..39f96f0e 100644
--- a/vignettes/mnl_models_weighted.Rmd
+++ b/vignettes/mnl_models_weighted.Rmd
@@ -158,7 +158,7 @@ summary(mnl_wtp_weighted)
# Compare results
-Here is a comparison of the coefficients between the weighted and unweighted models. All of the significant coefficients:
+Here is a comparison of the coefficients between the weighted and unweighted models. All of the significant coefficients have the same sign, but the magnitudes shift some based on the differential weighting of each individual choice in the weighted model:
```{r}
coef_compare <- data.frame(
@@ -167,7 +167,7 @@ coef_compare <- data.frame(
coef_compare
```
-Compare the log-likelihood between the weighted and unweighted models:
+Here is a comparison of the log-likelihood for the weighted and unweighted models:
```{r}
logLik_compare <- c(
diff --git a/vignettes/simulations.Rmd b/vignettes/simulations.Rmd
index ce8421e0..56cb24c9 100644
--- a/vignettes/simulations.Rmd
+++ b/vignettes/simulations.Rmd
@@ -13,6 +13,7 @@ knitr::opts_chunk$set(
collapse = TRUE,
warning = FALSE,
message = FALSE,
+ fig.path = "figs/",
fig.retina = 3,
comment = "#>"
)
@@ -60,6 +61,10 @@ You can also use WTP space models to simulate shares, but you must provide the a
```{r, eval=FALSE}
sim_mnl_wtp <- simulateShares(mnl_wtp, alts, priceName = 'price')
```
+```
+#> **Using results for model 1 of 10,
+#> the best model (largest log-likelihood) from the multistart**
+```
```{r}
sim_mnl_wtp
```
@@ -83,3 +88,24 @@ sim_mxl_wtp <- simulateShares(mxl_wtp, alts, priceName = 'price')
```{r}
sim_mxl_wtp
```
+
+Here is a bar plot of the results from each model:
+
+```{r, fig.width=6, fig.height=4}
+library(ggplot2)
+
+sims <- rbind(sim_mnl_pref, sim_mnl_wtp, sim_mxl_pref, sim_mxl_wtp)
+sims$model <- c(rep("mnl_pref", 4), rep("mnl_wtp", 4),
+ rep("mxl_pref", 4), rep("mxl_wtp", 4))
+sims$alt <- rep(row.names(alts), 4)
+
+ggplot(sims, aes(x = alt, y = share_mean, fill = model)) +
+ geom_bar(stat = 'identity', width = 0.7, position = "dodge") +
+ geom_errorbar(aes(ymin = share_low, ymax = share_high),
+ width = 0.2, position = position_dodge(width = 0.7)) +
+ scale_y_continuous(limits = c(0, 1)) +
+ labs(x = 'Alternative', y = 'Expected Share') +
+ theme_bw()
+```
+
+# References