From 1f4cd8c66926b0f33120c647142037212f37f285 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 17 May 2023 19:34:03 +0000 Subject: [PATCH] Built site for logitr: 1.1.0@af75474 --- articles/basic_usage.html | 48 ++--- articles/data_formatting.html | 4 +- articles/interactions.html | 10 +- articles/mnl_models.html | 66 +++--- articles/mnl_models_weighted.html | 146 ++++++------- articles/mxl_models.html | 18 +- articles/summarizing_results.html | 344 +++++++++++++++--------------- pkgdown.yml | 2 +- reference/ci.html | 10 +- reference/confint.logitr.html | 10 +- reference/predict.logitr.html | 28 +-- reference/recodeData.html | 2 +- reference/tidy.logitr.html | 6 +- reference/wtp.html | 10 +- reference/wtp.logitr.html | 12 +- 15 files changed, 358 insertions(+), 358 deletions(-) diff --git a/articles/basic_usage.html b/articles/basic_usage.html index cac55d1..654b754 100644 --- a/articles/basic_usage.html +++ b/articles/basic_usage.html @@ -319,7 +319,7 @@

Viewing resultssummary(mnl_pref) #> ================================================= #> -#> Model estimated on: Wed May 17 18:28:51 2023 +#> Model estimated on: Wed May 17 19:31:25 2023 #> #> Using logitr version: 1.1.0 #> @@ -337,7 +337,7 @@

Viewing results#> Model Space: Preference #> Model Run: 1 of 1 #> Iterations: 21 -#> Elapsed Time: 0h:0m:0.04s +#> Elapsed Time: 0h:0m:0.09s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Robust? FALSE @@ -404,11 +404,11 @@

Computing and comparing WTP
 wtp(mnl_pref, scalePar = "price")
 #>                Estimate Std. Error  z-value  Pr(>|z|)    
-#> scalePar       0.366555   0.024438  14.9991 < 2.2e-16 ***
-#> feat           1.340699   0.359225   3.7322 0.0001898 ***
-#> brandhiland  -10.136219   0.583422 -17.3737 < 2.2e-16 ***
-#> brandweight   -1.749094   0.181930  -9.6141 < 2.2e-16 ***
-#> brandyoplait   2.003848   0.143091  14.0040 < 2.2e-16 ***
+#> scalePar       0.366555   0.024385  15.0317 < 2.2e-16 ***
+#> feat           1.340699   0.360192   3.7222 0.0001975 ***
+#> brandhiland  -10.136219   0.584697 -17.3359 < 2.2e-16 ***
+#> brandweight   -1.749094   0.182607  -9.5784 < 2.2e-16 ***
+#> brandyoplait   2.003848   0.143130  14.0002 < 2.2e-16 ***
 #> ---
 #> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The wtp() function divides the non-price parameters by @@ -464,14 +464,14 @@

Predicting probabilities and outc probs #> obsID predicted_prob predicted_prob_lower predicted_prob_upper -#> 49 13 0.43685145 0.41588937 0.45829856 -#> 50 13 0.03312986 0.02630071 0.04179077 -#> 51 13 0.19155548 0.17586637 0.20752156 -#> 52 13 0.33846321 0.31830377 0.35857991 -#> 165 42 0.60764778 0.57398850 0.64113963 -#> 166 42 0.02602007 0.01846559 0.03649793 -#> 167 42 0.17803313 0.16164880 0.19449165 -#> 168 42 0.18829902 0.16819377 0.20905679 +#> 49 13 0.43685145 0.41510050 0.45786634 +#> 50 13 0.03312986 0.02607448 0.04172946 +#> 51 13 0.19155548 0.17633756 0.20814352 +#> 52 13 0.33846321 0.31812694 0.35898805 +#> 165 42 0.60764778 0.57338662 0.64011636 +#> 166 42 0.02602007 0.01839735 0.03635835 +#> 167 42 0.17803313 0.16216350 0.19532604 +#> 168 42 0.18829902 0.16808850 0.20993951

The resulting probs data frame contains the expected probabilities for each alternative. The lower and upper predictions reflect a 95% confidence interval (controlled by the ci @@ -490,14 +490,14 @@

Predicting probabilities and outc probs #> obsID predicted_prob predicted_prob_lower predicted_prob_upper -#> 49 13 0.43686141 0.41502426 0.45797286 -#> 50 13 0.03312947 0.02650355 0.04217146 -#> 51 13 0.19154829 0.17591274 0.20743355 -#> 52 13 0.33846083 0.31864993 0.35881966 -#> 165 42 0.60767120 0.57272993 0.63995931 -#> 166 42 0.02601800 0.01834336 0.03662927 -#> 167 42 0.17802363 0.16167136 0.19454780 -#> 168 42 0.18828717 0.16771143 0.20895599 +#> 49 13 0.43686141 0.41500273 0.45732387 +#> 50 13 0.03312947 0.02651562 0.04225451 +#> 51 13 0.19154829 0.17649648 0.20765143 +#> 52 13 0.33846083 0.31811553 0.35899316 +#> 165 42 0.60767120 0.57254068 0.63953302 +#> 166 42 0.02601800 0.01828537 0.03671188 +#> 167 42 0.17802363 0.16233934 0.19457039 +#> 168 42 0.18828717 0.16798574 0.20913435

You can also use the predict() method to predict outcomes by setting type = "outcome" (the default value is "prob" for predicting probabilities). If no new data are @@ -527,7 +527,7 @@

Predicting probabilities and outc chosen <- subset(outcomes, choice == 1) chosen$correct <- chosen$choice == chosen$predicted_outcome sum(chosen$correct) / nrow(chosen) -#> [1] 0.3735489 +#> [1] 0.3727197

See the “Predicting Probabilities and Choices from Estimated Models” vignette for more details about making predictions.

diff --git a/articles/data_formatting.html b/articles/data_formatting.html index 32486e6..a23d6c1 100644 --- a/articles/data_formatting.html +++ b/articles/data_formatting.html @@ -251,7 +251,7 @@

Creating dummy coded variablessummary(mnl_pref_dummies) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:30 2023 +#> Model estimated on: Wed May 17 19:32:21 2023 #> #> Using logitr version: 1.1.0 #> @@ -269,7 +269,7 @@

Creating dummy coded variables#> Model Space: Preference #> Model Run: 1 of 1 #> Iterations: 18 -#> Elapsed Time: 0h:0m:0.03s +#> Elapsed Time: 0h:0m:0.07s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Robust? FALSE diff --git a/articles/interactions.html b/articles/interactions.html index 0c59ff1..ca27738 100644 --- a/articles/interactions.html +++ b/articles/interactions.html @@ -167,7 +167,7 @@

Interactions with continuous var summary(model_price_feat) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:34 2023 +#> Model estimated on: Wed May 17 19:32:27 2023 #> #> Using logitr version: 1.1.0 #> @@ -234,7 +234,7 @@

Interactions with discrete variabl summary(model_price_brand) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:35 2023 +#> Model estimated on: Wed May 17 19:32:28 2023 #> #> Using logitr version: 1.1.0 #> @@ -326,7 +326,7 @@

Interactions with indiv summary(model_price_group) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:36 2023 +#> Model estimated on: Wed May 17 19:32:29 2023 #> #> Using logitr version: 1.1.0 #> @@ -344,7 +344,7 @@

Interactions with indiv #> Model Space: Preference #> Model Run: 1 of 1 #> Iterations: 26 -#> Elapsed Time: 0h:0m:0.03s +#> Elapsed Time: 0h:0m:0.04s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Robust? FALSE @@ -393,7 +393,7 @@

Interactions in mixed logit modelssummary(model_price_feat_mxl) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:36 2023 +#> Model estimated on: Wed May 17 19:32:29 2023 #> #> Using logitr version: 1.1.0 #> diff --git a/articles/mnl_models.html b/articles/mnl_models.html index fe6ed68..9700d2a 100644 --- a/articles/mnl_models.html +++ b/articles/mnl_models.html @@ -221,7 +221,7 @@

Preference space modelsummary(mnl_pref) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:43 2023 +#> Model estimated on: Wed May 17 19:32:40 2023 #> #> Using logitr version: 1.1.0 #> @@ -239,7 +239,7 @@

Preference space model#> Model Space: Preference #> Model Run: 1 of 1 #> Iterations: 21 -#> Elapsed Time: 0h:0m:0.05s +#> Elapsed Time: 0h:0m:0.04s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Robust? FALSE @@ -271,11 +271,11 @@

Preference space modelwtp_mnl_pref <- wtp(mnl_pref, scalePar = "price") wtp_mnl_pref #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.366555 0.024291 15.0900 < 2.2e-16 *** -#> feat 1.340699 0.357400 3.7513 0.000176 *** -#> brandhiland -10.136219 0.582442 -17.4030 < 2.2e-16 *** -#> brandweight -1.749094 0.181311 -9.6469 < 2.2e-16 *** -#> brandyoplait 2.003848 0.142894 14.0233 < 2.2e-16 *** +#> scalePar 0.366555 0.024353 15.0516 < 2.2e-16 *** +#> feat 1.340699 0.358430 3.7405 0.0001837 *** +#> brandhiland -10.136219 0.586129 -17.2935 < 2.2e-16 *** +#> brandweight -1.749094 0.181998 -9.6105 < 2.2e-16 *** +#> brandyoplait 2.003848 0.143658 13.9487 < 2.2e-16 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 @@ -316,7 +316,7 @@

WTP space modelsummary(mnl_wtp) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:44 2023 +#> Model estimated on: Wed May 17 19:32:42 2023 #> #> Using logitr version: 1.1.0 #> @@ -332,15 +332,15 @@

WTP space model#> Summary Of Multistart Runs: #> Log Likelihood Iterations Exit Status #> 1 -2656.888 84 3 -#> 2 -2656.888 32 3 -#> 3 -2656.888 39 3 -#> 4 -2656.888 52 3 -#> 5 -2656.888 36 3 -#> 6 -2656.888 48 3 -#> 7 -2656.888 40 3 -#> 8 -2804.564 77 4 -#> 9 -2656.888 41 3 -#> 10 -2656.888 39 3 +#> 2 -2656.888 45 3 +#> 3 -2656.888 38 3 +#> 4 -2656.888 32 3 +#> 5 -2656.888 40 3 +#> 6 -2656.888 42 3 +#> 7 -2656.888 53 3 +#> 8 -2656.888 43 3 +#> 9 -2656.888 44 3 +#> 10 -2656.888 54 3 #> #> Use statusCodes() to view the meaning of each status code #> @@ -348,26 +348,26 @@

WTP space model#> #> Model Type: Multinomial Logit #> Model Space: Willingness-to-Pay -#> Model Run: 3 of 10 -#> Iterations: 39 -#> Elapsed Time: 0h:0m:0.13s +#> Model Run: 6 of 10 +#> Iterations: 42 +#> Elapsed Time: 0h:0m:0.16s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Robust? FALSE #> #> Model Coefficients: #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.366585 0.024366 15.0449 < 2.2e-16 *** -#> feat 1.340628 0.355867 3.7672 0.0001651 *** -#> brandhiland -10.135673 0.576075 -17.5944 < 2.2e-16 *** -#> brandweight -1.749099 0.179898 -9.7227 < 2.2e-16 *** -#> brandyoplait 2.003808 0.142377 14.0740 < 2.2e-16 *** +#> scalePar 0.366580 0.024366 15.0446 < 2.2e-16 *** +#> feat 1.340621 0.355871 3.7671 0.0001651 *** +#> brandhiland -10.135823 0.576099 -17.5939 < 2.2e-16 *** +#> brandweight -1.749152 0.179905 -9.7227 < 2.2e-16 *** +#> brandyoplait 2.003775 0.142380 14.0734 < 2.2e-16 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> Log-Likelihood: -2656.8878780 #> Null Log-Likelihood: -3343.7419990 -#> AIC: 5323.7757560 +#> AIC: 5323.7757561 #> BIC: 5352.7168000 #> McFadden R2: 0.2054148 #> Adj McFadden R2: 0.2039195 @@ -376,7 +376,7 @@

WTP space model
 coef(mnl_wtp)
 #>     scalePar         feat  brandhiland  brandweight brandyoplait 
-#>    0.3665854    1.3406285  -10.1356726   -1.7490991    2.0038083
+#> 0.3665801 1.3406205 -10.1358229 -1.7491524 2.0037746

Compare WTP from both models @@ -395,12 +395,12 @@

Compare WTP from both models
 wtpCompare(mnl_pref, mnl_wtp, scalePar = 'price')
 #>                       pref           wtp  difference
-#> scalePar         0.3665546     0.3665854  0.00003086
-#> feat             1.3406987     1.3406285 -0.00007022
-#> brandhiland    -10.1362190   -10.1356726  0.00054637
-#> brandweight     -1.7490940    -1.7490991 -0.00000512
-#> brandyoplait     2.0038476     2.0038083 -0.00003928
-#> logLik       -2656.8878790 -2656.8878780  0.00000102

+#> scalePar 0.3665546 0.3665801 0.00002559 +#> feat 1.3406987 1.3406205 -0.00007819 +#> brandhiland -10.1362190 -10.1358229 0.00039607 +#> brandweight -1.7490940 -1.7491524 -0.00005844 +#> brandyoplait 2.0038476 2.0037746 -0.00007300 +#> logLik -2656.8878790 -2656.8878780 0.00000096

References diff --git a/articles/mnl_models_weighted.html b/articles/mnl_models_weighted.html index 5d512c2..de3b65f 100644 --- a/articles/mnl_models_weighted.html +++ b/articles/mnl_models_weighted.html @@ -288,7 +288,7 @@

Unweighted modelsummary(mnl_wtp_unweighted) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:52 2023 +#> Model estimated on: Wed May 17 19:32:50 2023 #> #> Using logitr version: 1.1.0 #> @@ -306,15 +306,15 @@

Unweighted model#> Summary Of Multistart Runs: #> Log Likelihood Iterations Exit Status #> 1 -4616.952 26 3 -#> 2 -4616.952 47 3 -#> 3 -4616.952 33 3 +#> 2 -4616.952 31 3 +#> 3 -4616.952 36 3 #> 4 -4616.952 33 3 -#> 5 -4616.952 37 3 -#> 6 -4616.952 33 3 -#> 7 -4616.952 33 3 +#> 5 -4616.952 35 3 +#> 6 -4616.952 31 3 +#> 7 -4616.952 34 3 #> 8 -4616.952 35 3 -#> 9 -4616.952 41 3 -#> 10 -4616.952 35 3 +#> 9 -4616.952 32 3 +#> 10 -4616.952 29 3 #> #> Use statusCodes() to view the meaning of each status code #> @@ -322,9 +322,9 @@

Unweighted model#> #> Model Type: Multinomial Logit #> Model Space: Willingness-to-Pay -#> Model Run: 6 of 10 -#> Iterations: 33 -#> Elapsed Time: 0h:0m:0.46s +#> Model Run: 1 of 10 +#> Iterations: 26 +#> Elapsed Time: 0h:0m:0.41s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Cluster ID: obsnum @@ -332,28 +332,28 @@

Unweighted model#> #> Model Coefficients: #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.0738772 0.0021927 33.6919 < 2.2e-16 *** -#> hev 0.8061909 0.9990694 0.8069 0.4197000 -#> phev10 1.1657885 1.0615045 1.0982 0.2720990 -#> phev20 1.6479525 1.0617508 1.5521 0.1206363 -#> phev40 2.5804164 1.0499342 2.4577 0.0139832 * -#> bev75 -16.0462234 1.2541317 -12.7947 < 2.2e-16 *** -#> bev100 -13.0034333 1.2388579 -10.4963 < 2.2e-16 *** -#> bev150 -9.5736424 1.1641824 -8.2235 2.220e-16 *** -#> american 2.3439701 0.7979731 2.9374 0.0033097 ** -#> japanese -0.3750364 0.7998373 -0.4689 0.6391477 -#> chinese -10.2690333 0.8859476 -11.5910 < 2.2e-16 *** -#> skorean -6.0310659 0.8514325 -7.0834 1.406e-12 *** -#> phevFastcharge 2.8783329 0.8028788 3.5850 0.0003371 *** -#> bevFastcharge 2.9188603 0.9181366 3.1791 0.0014773 ** -#> opCost -1.6360157 0.0686287 -23.8386 < 2.2e-16 *** -#> accelTime -1.6969437 0.1638077 -10.3594 < 2.2e-16 *** +#> scalePar 0.0738778 0.0021929 33.6898 < 2.2e-16 *** +#> hev 0.8068260 0.9990687 0.8076 0.4193335 +#> phev10 1.1649982 1.0615103 1.0975 0.2724267 +#> phev20 1.6473977 1.0617543 1.5516 0.1207625 +#> phev40 2.5795310 1.0499377 2.4568 0.0140164 * +#> bev75 -16.0458997 1.2541305 -12.7944 < 2.2e-16 *** +#> bev100 -13.0033090 1.2388653 -10.4961 < 2.2e-16 *** +#> bev150 -9.5736990 1.1641920 -8.2235 2.220e-16 *** +#> american 2.3429451 0.7979690 2.9361 0.0033233 ** +#> japanese -0.3756939 0.7998368 -0.4697 0.6385600 +#> chinese -10.2706045 0.8859927 -11.5922 < 2.2e-16 *** +#> skorean -6.0320195 0.8514460 -7.0844 1.396e-12 *** +#> phevFastcharge 2.8797097 0.8028928 3.5867 0.0003349 *** +#> bevFastcharge 2.9187141 0.9181393 3.1789 0.0014781 ** +#> opCost -1.6360512 0.0686316 -23.8382 < 2.2e-16 *** +#> accelTime -1.6970892 0.1638118 -10.3600 < 2.2e-16 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> -#> Log-Likelihood: -4616.9517814 +#> Log-Likelihood: -4616.9517826 #> Null Log-Likelihood: -6328.0067827 -#> AIC: 9265.9035627 +#> AIC: 9265.9035652 #> BIC: 9372.4426000 #> McFadden R2: 0.2703940 #> Adj McFadden R2: 0.2678655 @@ -391,7 +391,7 @@

Weighted modelsummary(mnl_wtp_weighted) #> ================================================= #> -#> Model estimated on: Wed May 17 18:29:59 2023 +#> Model estimated on: Wed May 17 19:32:57 2023 #> #> Using logitr version: 1.1.0 #> @@ -409,15 +409,15 @@

Weighted model#> Summary Of Multistart Runs: #> Log Likelihood Iterations Exit Status #> 1 -3425.633 19 3 -#> 2 -3425.630 29 3 +#> 2 -3425.630 30 3 #> 3 -3425.630 36 3 -#> 4 -3425.630 35 3 -#> 5 -3425.630 40 3 -#> 6 -3425.630 35 3 +#> 4 -3425.630 33 3 +#> 5 -3425.630 32 3 +#> 6 -3425.631 31 3 #> 7 -3425.630 31 3 -#> 8 -3425.630 32 3 -#> 9 -3425.630 31 3 -#> 10 -3425.630 34 3 +#> 8 -3425.631 32 3 +#> 9 -3425.630 30 3 +#> 10 -3425.630 33 3 #> #> Use statusCodes() to view the meaning of each status code #> @@ -426,8 +426,8 @@

Weighted model#> Model Type: Multinomial Logit #> Model Space: Willingness-to-Pay #> Model Run: 5 of 10 -#> Iterations: 40 -#> Elapsed Time: 0h:0m:0.66s +#> Iterations: 32 +#> Elapsed Time: 0h:0m:0.52s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: TRUE #> Cluster ID: obsnum @@ -435,28 +435,28 @@

Weighted model#> #> Model Coefficients: #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.0522795 0.0040687 12.8492 < 2.2e-16 *** -#> hev -1.1758683 2.9133668 -0.4036 0.6864984 -#> phev10 0.0265942 3.1280749 0.0085 0.9932166 -#> phev20 1.6941837 3.0997759 0.5466 0.5846877 -#> phev40 2.6495634 2.9852244 0.8876 0.3747779 -#> bev75 -20.1349508 3.6670440 -5.4908 4.002e-08 *** -#> bev100 -19.4947351 3.6254792 -5.3771 7.568e-08 *** -#> bev150 -13.6893064 3.4925869 -3.9195 8.872e-05 *** -#> american 8.1871667 2.4052996 3.4038 0.0006645 *** -#> japanese 0.9346216 2.3603846 0.3960 0.6921334 -#> chinese -19.0078993 2.8540909 -6.6599 2.741e-11 *** -#> skorean -9.5102158 2.5234279 -3.7688 0.0001641 *** -#> phevFastcharge 3.9437386 2.3624511 1.6693 0.0950496 . -#> bevFastcharge 3.3409177 2.8086482 1.1895 0.2342387 -#> opCost -1.5976793 0.1948623 -8.1990 2.220e-16 *** -#> accelTime -1.1719317 0.4834765 -2.4240 0.0153520 * +#> scalePar 0.0522802 0.0040692 12.8477 < 2.2e-16 *** +#> hev -1.1759230 2.9133332 -0.4036 0.6864812 +#> phev10 0.0275925 3.1280324 0.0088 0.9929619 +#> phev20 1.6951258 3.0997321 0.5469 0.5844735 +#> phev40 2.6498632 2.9851953 0.8877 0.3747192 +#> bev75 -20.1369865 3.6672530 -5.4910 3.996e-08 *** +#> bev100 -19.4972368 3.6256767 -5.3775 7.551e-08 *** +#> bev150 -13.6923748 3.4928176 -3.9202 8.849e-05 *** +#> american 8.1885941 2.4053423 3.4043 0.0006633 *** +#> japanese 0.9346745 2.3603608 0.3960 0.6921139 +#> chinese -19.0089809 2.8542987 -6.6598 2.743e-11 *** +#> skorean -9.5105002 2.5234705 -3.7688 0.0001640 *** +#> phevFastcharge 3.9431709 2.3624156 1.6691 0.0950923 . +#> bevFastcharge 3.3436607 2.8087265 1.1905 0.2338679 +#> opCost -1.5975145 0.1948500 -8.1987 2.220e-16 *** +#> accelTime -1.1717659 0.4834731 -2.4236 0.0153657 * #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> -#> Log-Likelihood: -3425.6302879 +#> Log-Likelihood: -3425.6302864 #> Null Log-Likelihood: -4360.5909275 -#> AIC: 6883.2605759 +#> AIC: 6883.2605728 #> BIC: 6989.7997000 #> McFadden R2: 0.2144115 #> Adj McFadden R2: 0.2107422 @@ -476,22 +476,22 @@

Compare results Weighted = coef(mnl_wtp_weighted) ) #> Unweighted Weighted -#> scalePar 0.07387721 0.05227947 -#> hev 0.80619092 -1.17586835 -#> phev10 1.16578853 0.02659420 -#> phev20 1.64795248 1.69418372 -#> phev40 2.58041643 2.64956343 -#> bev75 -16.04622335 -20.13495083 -#> bev100 -13.00343327 -19.49473507 -#> bev150 -9.57364241 -13.68930638 -#> american 2.34397013 8.18716672 -#> japanese -0.37503638 0.93462157 -#> chinese -10.26903329 -19.00789934 -#> skorean -6.03106588 -9.51021583 -#> phevFastcharge 2.87833291 3.94373859 -#> bevFastcharge 2.91886035 3.34091773 -#> opCost -1.63601572 -1.59767932 -#> accelTime -1.69694375 -1.17193173

+#> scalePar 0.07387776 0.05228021 +#> hev 0.80682602 -1.17592304 +#> phev10 1.16499818 0.02759252 +#> phev20 1.64739765 1.69512581 +#> phev40 2.57953096 2.64986315 +#> bev75 -16.04589966 -20.13698653 +#> bev100 -13.00330902 -19.49723681 +#> bev150 -9.57369897 -13.69237484 +#> american 2.34294510 8.18859409 +#> japanese -0.37569387 0.93467454 +#> chinese -10.27060451 -19.00898092 +#> skorean -6.03201950 -9.51050018 +#> phevFastcharge 2.87970966 3.94317090 +#> bevFastcharge 2.91871408 3.34366072 +#> opCost -1.63605116 -1.59751447 +#> accelTime -1.69708921 -1.17176590

Here is a comparison of the log-likelihood for the weighted and unweighted models:

diff --git a/articles/mxl_models.html b/articles/mxl_models.html
index a2bf086..519339e 100644
--- a/articles/mxl_models.html
+++ b/articles/mxl_models.html
@@ -352,15 +352,15 @@ 

Preference space modelwtp_mxl_pref <- wtp(mxl_pref, scalePar = "price") wtp_mxl_pref #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.448338 0.039985 11.2127 < 2.2e-16 *** -#> feat 1.733046 0.499848 3.4671 0.000526 *** -#> brandhiland -14.202148 1.387538 -10.2355 < 2.2e-16 *** -#> brandweight -8.182853 0.980271 -8.3475 < 2.2e-16 *** -#> brandyoplait 2.503674 0.410001 6.1065 1.018e-09 *** -#> sd_feat 1.265776 0.503179 2.5156 0.011884 * -#> sd_brandhiland -7.096979 0.959374 -7.3975 1.388e-13 *** -#> sd_brandweight 9.138487 0.952093 9.5983 < 2.2e-16 *** -#> sd_brandyoplait 7.274160 0.773141 9.4086 < 2.2e-16 *** +#> scalePar 0.448338 0.039784 11.2692 < 2.2e-16 *** +#> feat 1.733046 0.501358 3.4567 0.0005468 *** +#> brandhiland -14.202148 1.383382 -10.2663 < 2.2e-16 *** +#> brandweight -8.182853 0.978438 -8.3632 < 2.2e-16 *** +#> brandyoplait 2.503674 0.412457 6.0701 1.278e-09 *** +#> sd_feat 1.265776 0.504957 2.5067 0.0121864 * +#> sd_brandhiland -7.096979 0.953170 -7.4457 9.637e-14 *** +#> sd_brandweight 9.138487 0.948601 9.6336 < 2.2e-16 *** +#> sd_brandyoplait 7.274160 0.769986 9.4471 < 2.2e-16 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

diff --git a/articles/summarizing_results.html b/articles/summarizing_results.html index 17017fd..633c0e4 100644 --- a/articles/summarizing_results.html +++ b/articles/summarizing_results.html @@ -153,7 +153,7 @@

Extracting summary tablessummary(model) #> ================================================= #> -#> Model estimated on: Wed May 17 18:30:31 2023 +#> Model estimated on: Wed May 17 19:33:30 2023 #> #> Using logitr version: 1.1.0 #> @@ -236,10 +236,10 @@

The {broom} package#> term estimate std.error statistic p.value conf.low conf.high #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 brandhiland -3.72 0.145 -25.6 0 -4.00 -3.43 -#> 2 brandweight -0.641 0.0545 -11.8 0 -0.750 -0.535 -#> 3 brandyoplait 0.735 0.0806 9.11 0 0.577 0.890 -#> 4 feat 0.491 0.120 4.09 0.0000425 0.254 0.727 -#> 5 price -0.367 0.0244 -15.0 0 -0.415 -0.320 +#> 2 brandweight -0.641 0.0545 -11.8 0 -0.747 -0.532 +#> 3 brandyoplait 0.735 0.0806 9.11 0 0.577 0.891 +#> 4 feat 0.491 0.120 4.09 0.0000425 0.261 0.729 +#> 5 price -0.367 0.0244 -15.0 0 -0.415 -0.319 -
- @@ -772,7 +772,7 @@

The {gtsummary} package     weight -0.64 --0.75, -0.54 +-0.74, -0.54 <0.001 @@ -784,7 +784,7 @@

The {gtsummary} package feat 0.49 -0.26, 0.73 +0.26, 0.72 <0.001 @@ -811,23 +811,23 @@

The {gtsummary} package brand = "Yogurt's brand" ) )

-
- @@ -1282,13 +1282,13 @@

The {gtsummary} package     weight -0.64 --0.75, -0.54 +-0.75, -0.53 <0.001     yoplait 0.73 -0.57, 0.89 +0.58, 0.89 <0.001 @@ -1344,23 +1344,23 @@

The {gtsummary} package tbls = list(t1, t2), tab_spanner = c("**Baseline**", "**Interaction**") )

-
- @@ -1851,16 +1851,16 @@

The {gtsummary} package0.57, 0.89 <0.001 0.72 -0.57, 0.88 +0.57, 0.89 <0.001 feat 0.49 -0.26, 0.73 +0.26, 0.72 <0.001 1.2 -0.42, 1.9 +0.43, 1.9 0.002 @@ -1878,7 +1878,7 @@

The {gtsummary} package -0.09 --0.18, 0.00 +-0.18, 0.01 0.068 diff --git a/pkgdown.yml b/pkgdown.yml index f3e5751..18022f1 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -13,7 +13,7 @@ articles: predict: predict.html summarizing_results: summarizing_results.html utility_models: utility_models.html -last_built: 2023-05-17T18:28Z +last_built: 2023-05-17T19:30Z urls: reference: https://jhelvy.github.io/logitr/reference article: https://jhelvy.github.io/logitr/articles diff --git a/reference/ci.html b/reference/ci.html index 26e140c..ae3c7f9 100644 --- a/reference/ci.html +++ b/reference/ci.html @@ -140,11 +140,11 @@

Examples

# Compute a confidence interval ci(coef_draws, level = 0.95) #> mean lower upper -#> price -0.3666488 -0.4140668 -0.3195878 -#> feat 0.4912846 0.2646471 0.7258013 -#> brandhiland -3.7157486 -3.9986151 -3.4292255 -#> brandweight -0.6410142 -0.7471432 -0.5355991 -#> brandyoplait 0.7355946 0.5773214 0.8944731 +#> price -0.3669877 -0.4141219 -0.3192457 +#> feat 0.4920455 0.2551335 0.7296374 +#> brandhiland -3.7202021 -4.0124526 -3.4276317 +#> brandweight -0.6413431 -0.7501142 -0.5339297 +#> brandyoplait 0.7347424 0.5766444 0.8919727

diff --git a/reference/confint.logitr.html b/reference/confint.logitr.html index c7e548e..88f7c42 100644 --- a/reference/confint.logitr.html +++ b/reference/confint.logitr.html @@ -148,11 +148,11 @@

Examples

# Compute a confidence interval
confint(mnl_pref) #> 2.5 % 97.5 % -#> price -0.4150911 -0.3192591 -#> feat 0.2602301 0.7221981 -#> brandhiland -4.0075944 -3.4373634 -#> brandweight -0.7471106 -0.5330946 -#> brandyoplait 0.5786719 0.8883971 +#> price -0.4141253 -0.3188122 +#> feat 0.2518615 0.7238302 +#> brandhiland -4.0016676 -3.4235072 +#> brandweight -0.7469393 -0.5337439 +#> brandyoplait 0.5759043 0.8896868 diff --git a/reference/predict.logitr.html b/reference/predict.logitr.html index d51e2c1..b8d68a6 100644 --- a/reference/predict.logitr.html +++ b/reference/predict.logitr.html @@ -276,34 +276,34 @@

Examples

level = 0.95 ) #> obsID predicted_prob predicted_prob_lower predicted_prob_upper -#> 1 13 0.43685145 0.41598072 0.45816232 -#> 2 13 0.03312986 0.02630597 0.04156102 -#> 3 13 0.19155548 0.17613333 0.20762724 -#> 4 13 0.33846321 0.31859962 0.35847547 -#> 5 42 0.60764778 0.57384742 0.63996450 -#> 6 42 0.02602007 0.01826759 0.03654384 -#> 7 42 0.17803313 0.16196085 0.19463527 -#> 8 42 0.18829902 0.16826980 0.20930494 +#> 1 13 0.43685145 0.41556913 0.45821635 +#> 2 13 0.03312986 0.02615338 0.04146475 +#> 3 13 0.19155548 0.17600910 0.20766037 +#> 4 13 0.33846321 0.31858515 0.35856919 +#> 5 42 0.60764778 0.57358867 0.64099010 +#> 6 42 0.02602007 0.01846143 0.03615926 +#> 7 42 0.17803313 0.16184731 0.19443858 +#> 8 42 0.18829902 0.16806301 0.20975590 # Predict outcomes predict(mnl_pref, newdata = data, obsID = "obsID", type = "outcome") #> obsID predicted_outcome -#> 1 13 1 +#> 1 13 0 #> 2 13 0 #> 3 13 0 -#> 4 13 0 -#> 5 42 0 +#> 4 13 1 +#> 5 42 1 #> 6 42 0 -#> 7 42 1 +#> 7 42 0 #> 8 42 0 # Predict outcomes and probabilities predict(mnl_pref, newdata = data, obsID = "obsID", type = c("prob", "outcome")) #> obsID predicted_prob predicted_outcome -#> 1 13 0.43685145 1 +#> 1 13 0.43685145 0 #> 2 13 0.03312986 0 #> 3 13 0.19155548 0 -#> 4 13 0.33846321 0 +#> 4 13 0.33846321 1 #> 5 42 0.60764778 1 #> 6 42 0.02602007 0 #> 7 42 0.17803313 0 diff --git a/reference/recodeData.html b/reference/recodeData.html index cdb3aac..11a8825 100644 --- a/reference/recodeData.html +++ b/reference/recodeData.html @@ -157,7 +157,7 @@

Examples

result$formula #> ~price + feat + brand + price * brand -#> <environment: 0x7fb5f6a33d60> +#> <environment: 0x7f96fed93f28> result$pars #> [1] "price" "feat" "brandhiland" #> [4] "brandweight" "brandyoplait" "price:brandhiland" diff --git a/reference/tidy.logitr.html b/reference/tidy.logitr.html index a871c8e..cf2a915 100644 --- a/reference/tidy.logitr.html +++ b/reference/tidy.logitr.html @@ -164,9 +164,9 @@

Examples

#> term estimate std.error statistic p.value conf.low conf.high #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 brandhiland -3.72 0.145 -25.6 0 -4.00 -3.43 -#> 2 brandweight -0.641 0.0545 -11.8 0 -0.749 -0.536 -#> 3 brandyoplait 0.735 0.0806 9.11 0 0.577 0.893 -#> 4 feat 0.491 0.120 4.09 0.0000425 0.251 0.727 +#> 2 brandweight -0.641 0.0545 -11.8 0 -0.748 -0.536 +#> 3 brandyoplait 0.735 0.0806 9.11 0 0.578 0.900 +#> 4 feat 0.491 0.120 4.09 0.0000425 0.260 0.725 #> 5 price -0.367 0.0244 -15.0 0 -0.415 -0.319 diff --git a/reference/wtp.html b/reference/wtp.html index 9afb2a3..bac1966 100644 --- a/reference/wtp.html +++ b/reference/wtp.html @@ -146,11 +146,11 @@

Examples

# Compute the WTP implied from the preference space model wtp(mnl_pref, scalePar = "price") #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.366555 0.024356 15.0496 < 2.2e-16 *** -#> feat 1.340699 0.358140 3.7435 0.0001815 *** -#> brandhiland -10.136219 0.582916 -17.3888 < 2.2e-16 *** -#> brandweight -1.749094 0.180986 -9.6642 < 2.2e-16 *** -#> brandyoplait 2.003848 0.143223 13.9911 < 2.2e-16 *** +#> scalePar 0.366555 0.024485 14.9707 < 2.2e-16 *** +#> feat 1.340699 0.360007 3.7241 0.000196 *** +#> brandhiland -10.136219 0.588307 -17.2295 < 2.2e-16 *** +#> brandweight -1.749094 0.182507 -9.5837 < 2.2e-16 *** +#> brandyoplait 2.003848 0.143229 13.9905 < 2.2e-16 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 diff --git a/reference/wtp.logitr.html b/reference/wtp.logitr.html index 8e6ff26..913f328 100644 --- a/reference/wtp.logitr.html +++ b/reference/wtp.logitr.html @@ -146,12 +146,12 @@

Examples

# Compute the WTP implied from the preference space model wtp(mnl_pref, scalePar = "price") -#> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.366555 0.024339 15.0605 < 2.2e-16 *** -#> feat 1.340699 0.358726 3.7374 0.0001859 *** -#> brandhiland -10.136219 0.585479 -17.3127 < 2.2e-16 *** -#> brandweight -1.749094 0.181797 -9.6211 < 2.2e-16 *** -#> brandyoplait 2.003848 0.143730 13.9417 < 2.2e-16 *** +#> Estimate Std. Error z-value Pr(>|z|) +#> scalePar 0.36656 0.02445 14.9920 < 2.2e-16 *** +#> feat 1.34070 0.35814 3.7435 0.0001815 *** +#> brandhiland -10.13622 0.58650 -17.2825 < 2.2e-16 *** +#> brandweight -1.74909 0.18253 -9.5824 < 2.2e-16 *** +#> brandyoplait 2.00385 0.14330 13.9837 < 2.2e-16 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1