diff --git a/404.html b/404.html index 45ea8e9..35db6f7 100644 --- a/404.html +++ b/404.html @@ -43,7 +43,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/LICENSE-text.html b/LICENSE-text.html index 5273d16..131176c 100644 --- a/LICENSE-text.html +++ b/LICENSE-text.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/LICENSE.html b/LICENSE.html index 553bad4..6d12683 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/articles/basic_usage.html b/articles/basic_usage.html index 923ba10..b232077 100644 --- a/articles/basic_usage.html +++ b/articles/basic_usage.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1 @@ -319,9 +319,9 @@

Viewing resultssummary(mnl_pref) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:10:42 2023 +#> Model estimated on: Sun Sep 24 18:53:54 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("price", @@ -404,11 +404,11 @@

Computing and comparing WTP
 wtp(mnl_pref, scalePar = "price")
 #>                Estimate Std. Error  z-value  Pr(>|z|)    
-#> scalePar       0.366555   0.024498  14.9624 < 2.2e-16 ***
-#> feat           1.340699   0.360051   3.7236 0.0001964 ***
-#> brandhiland  -10.136219   0.586111 -17.2940 < 2.2e-16 ***
-#> brandweight   -1.749094   0.181445  -9.6398 < 2.2e-16 ***
-#> brandyoplait   2.003848   0.143388  13.9750 < 2.2e-16 ***
+#> scalePar       0.366555   0.024323  15.0700 < 2.2e-16 ***
+#> feat           1.340699   0.360087   3.7233 0.0001967 ***
+#> brandhiland  -10.136219   0.583007 -17.3861 < 2.2e-16 ***
+#> brandweight   -1.749094   0.180936  -9.6669 < 2.2e-16 ***
+#> brandyoplait   2.003848   0.143863  13.9288 < 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.41553565 0.45763966 -#> 50 13 0.03312986 0.02634094 0.04152155 -#> 51 13 0.19155548 0.17605642 0.20783431 -#> 52 13 0.33846321 0.31907531 0.35885129 -#> 165 42 0.60764778 0.57352897 0.63945706 -#> 166 42 0.02602007 0.01846420 0.03639182 -#> 167 42 0.17803313 0.16174794 0.19504834 -#> 168 42 0.18829902 0.16849875 0.20995724 +#> 49 13 0.43685145 0.41592171 0.45805338 +#> 50 13 0.03312986 0.02626151 0.04172422 +#> 51 13 0.19155548 0.17622939 0.20757981 +#> 52 13 0.33846321 0.31892340 0.35844223 +#> 165 42 0.60764778 0.57399062 0.63985251 +#> 166 42 0.02602007 0.01846794 0.03646702 +#> 167 42 0.17803313 0.16215319 0.19475891 +#> 168 42 0.18829902 0.16826534 0.20947305

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.41573169 0.45769351 -#> 50 13 0.03312947 0.02653650 0.04235600 -#> 51 13 0.19154829 0.17644596 0.20754678 -#> 52 13 0.33846083 0.31857340 0.35764871 -#> 165 42 0.60767120 0.57335900 0.63970646 -#> 166 42 0.02601800 0.01834334 0.03702915 -#> 167 42 0.17802363 0.16228548 0.19430605 -#> 168 42 0.18828717 0.16764561 0.20844789 +#> 49 13 0.43686141 0.41538497 0.45744773 +#> 50 13 0.03312947 0.02643458 0.04212556 +#> 51 13 0.19154829 0.17587214 0.20741709 +#> 52 13 0.33846083 0.31876386 0.35933815 +#> 165 42 0.60767120 0.57206385 0.63972215 +#> 166 42 0.02601800 0.01842897 0.03655713 +#> 167 42 0.17802363 0.16190891 0.19473760 +#> 168 42 0.18828717 0.16817516 0.20885667

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 @@ -515,8 +515,8 @@

Predicting probabilities and outc head(outcomes[c('obsID', 'choice', 'predicted_outcome')]) #> obsID choice predicted_outcome -#> 1 1 0 1 -#> 2 1 0 0 +#> 1 1 0 0 +#> 2 1 0 1 #> 3 1 1 0 #> 4 1 0 0 #> 5 2 1 0 @@ -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.3706468 +#> [1] 0.3747927

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

diff --git a/articles/benchmark.html b/articles/benchmark.html index d9790e6..471b888 100644 --- a/articles/benchmark.html +++ b/articles/benchmark.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/articles/convergence.html b/articles/convergence.html index c380668..3966a0a 100644 --- a/articles/convergence.html +++ b/articles/convergence.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1 @@ -372,10 +372,13 @@

Prep for {mixl}

Estimate WTP space models

-

The same model is now estimated using all five packages.

+

The same model is now estimated using all five packages. We will see +that only {logitr} is able to converge to a solution, while all other +package either fail to converge or converge to only a local minimum.

{logitr}

+

{logitr} converges, even without running a multi-start:

 model_logitr <- logitr(
     data      = yogurt,
@@ -387,10 +390,9 @@ 

{logitr} randPars = c(feat = "n", brand = "n"), startVals = start_wtp, numDraws = numDraws_wtp -)

-

{logitr} converges, even without running a multi-start:

-
-summary(model_logitr)
+) + +summary(model_logitr)
#> =================================================
 #> 
 #> Model estimated on: Sat Oct 01 16:46:57 2022 
@@ -447,9 +449,9 @@ 

{logitr}#> brandhiland -Inf -17.4039453 -13.538553 -13.542027 -9.674388 Inf #> brandweight -Inf -12.2189602 -4.519436 -4.527690 3.182253 Inf #> brandyoplait -Inf 0.6670773 6.648678 6.641070 12.632059 Inf

-

Including a multi-start helps build confidence in the solution +

Including a 10-run multi-start helps build confidence in the solution reached:

-
+
 model_logitr <- logitr(
     data      = yogurt,
     outcome   = 'choice',
@@ -461,32 +463,47 @@ 

{logitr} startVals = start_wtp, numDraws = numDraws_wtp, numMultiStarts = 10 -)

-
-summary(model_logitr)
+) + +summary(model_logitr)
#> =================================================
 #> 
-#> Model estimated on: Sat Oct 01 16:46:57 2022 
+#> Model estimated on: Sun Sep 24 14:02:07 2023 
 #> 
-#> Using logitr version: 0.8.0 
+#> Using logitr version: 1.1.0 
 #> 
 #> Call:
 #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("feat", 
 #>     "brand"), scalePar = "price", randPars = c(feat = "n", brand = "n"), 
-#>     panelID = "id", startVals = start_wtp, numDraws = numDraws_wtp, 
-#>     numCores = numCores)
+#>     panelID = "id", startVals = start_wtp, numMultiStarts = 10, 
+#>     numDraws = numDraws_wtp)
 #> 
 #> Frequencies of alternatives:
 #>        1        2        3        4 
 #> 0.415721 0.029984 0.170989 0.383306 
 #> 
+#> Summary Of Multistart Runs:
+#>    Log Likelihood Iterations Exit Status
+#> 1       -732.2132         86           3
+#> 2       -728.0567         50           3
+#> 3       -734.7358         67           3
+#> 4       -725.4327         68           3
+#> 5       -731.0111         71           3
+#> 6       -731.3684         58           3
+#> 7       -749.7861         72           3
+#> 8       -718.0862         95           3
+#> 9       -745.6384         50           3
+#> 10      -722.1385         68           3
+#> 
+#> Use statusCodes() to view the meaning of each status code
+#> 
 #> Exit Status: 3, Optimization stopped because ftol_rel or ftol_abs was reached.
 #>                                  
 #> Model Type:           Mixed Logit
 #> Model Space:   Willingness-to-Pay
-#> Model Run:                 1 of 1
-#> Iterations:                    85
-#> Elapsed Time:            0h:0m:4s
+#> Model Run:                8 of 10
+#> Iterations:                    95
+#> Elapsed Time:            0h:0m:2s
 #> Algorithm:         NLOPT_LD_LBFGS
 #> Weights Used?:              FALSE
 #> Panel ID:                      id
@@ -494,82 +511,83 @@ 

{logitr}#> #> Model Coefficients: #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.388098 0.050706 7.6538 1.954e-14 *** -#> feat 1.738832 0.725107 2.3980 0.01648 * -#> brandhiland -13.536714 1.810701 -7.4760 7.661e-14 *** -#> brandweight -4.510068 1.015856 -4.4397 9.010e-06 *** -#> brandyoplait 6.663869 0.929658 7.1681 7.605e-13 *** -#> sd_feat 0.491225 1.072013 0.4582 0.64679 -#> sd_brandhiland 5.730571 1.125803 5.0902 3.577e-07 *** -#> sd_brandweight 11.420500 1.727799 6.6099 3.847e-11 *** -#> sd_brandyoplait 8.872470 1.366376 6.4934 8.390e-11 *** +#> scalePar 0.378986 0.048908 7.7490 9.326e-15 *** +#> feat 1.746832 0.725116 2.4090 0.01599 * +#> brandhiland -13.708716 1.788570 -7.6646 1.799e-14 *** +#> brandweight -9.382873 1.543072 -6.0806 1.197e-09 *** +#> brandyoplait 4.251573 0.628295 6.7668 1.316e-11 *** +#> sd_feat -0.930817 0.828995 -1.1228 0.26151 +#> sd_brandhiland -4.841849 0.901030 -5.3737 7.715e-08 *** +#> sd_brandweight 10.849573 1.583590 6.8513 7.321e-12 *** +#> sd_brandyoplait 7.813052 1.129764 6.9157 4.657e-12 *** #> --- -#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> -#> Log-Likelihood: -732.2132421 +#> Log-Likelihood: -718.0862026 #> Null Log-Likelihood: -1710.6872416 -#> AIC: 1482.4264842 -#> BIC: 1528.4886000 -#> McFadden R2: 0.5719771 -#> Adj McFadden R2: 0.5667161 +#> AIC: 1454.1724052 +#> BIC: 1500.2346000 +#> McFadden R2: 0.5802352 +#> Adj McFadden R2: 0.5749742 #> Number of Observations: 1234.0000000 #> #> Summary of 10k Draws for Random Coefficients: -#> Min. 1st Qu. Median Mean 3rd Qu. Max. -#> feat -Inf 1.4071720 1.738457 1.738145 2.069629 Inf -#> brandhiland -Inf -17.4039453 -13.538553 -13.542027 -9.674388 Inf -#> brandweight -Inf -12.2189602 -4.519436 -4.527690 3.182253 Inf -#> brandyoplait -Inf 0.6670773 6.648678 6.641070 12.632059 Inf

+#> Min. 1st Qu. Median Mean 3rd Qu. Max. +#> feat -Inf 1.120009 1.747543 1.748135 2.375291 Inf +#> brandhiland -Inf -16.972056 -13.707162 -13.704227 -10.441231 Inf +#> brandweight -Inf -16.706387 -9.391773 -9.399614 -2.075102 Inf +#> brandyoplait -Inf -1.029171 4.238197 4.231497 9.507132 Inf

{mixl}

First attempt using same starting points as {logitr}

-
+
 model_mixl <- estimate(
     mixl_spec_wtp, start_wtp,
     data_mixl, availabilities,
     nDraws = numDraws_wtp
 )

{mixl} converges to a local minimum:

-
+
 c(logLik(model_logitr), logLik(model_mixl))
-
#> [1]  -732.2132 -1544.8531
-
+
#> [1]  -718.0862 -1544.8531
+
 cbind(coef(model_logitr), coef(model_mixl))
#>                        [,1]        [,2]
-#> scalePar          0.3880976 -2270.55731
-#> feat              1.7388324    42.24281
-#> brandhiland     -13.5367140    24.36731
-#> brandweight      -4.5100684   110.99687
-#> brandyoplait      6.6638687  -492.36959
-#> sd_feat           0.4912255    10.81470
-#> sd_brandhiland    5.7305708    10.23414
-#> sd_brandweight   11.4204997   334.92761
-#> sd_brandyoplait   8.8724698   915.14924
+#> scalePar 0.3789865 -2270.55731 +#> feat 1.7468317 42.24281 +#> brandhiland -13.7087157 24.36731 +#> brandweight -9.3828735 110.99687 +#> brandyoplait 4.2515734 -492.36959 +#> sd_feat -0.9308170 10.81470 +#> sd_brandhiland -4.8418491 10.23414 +#> sd_brandweight 10.8495725 334.92761 +#> sd_brandyoplait 7.8130522 915.14924

Second attempt using {logitr} solution as starting points

-
+
 model_mixl <- estimate(
     mixl_spec_wtp, coef(model_logitr),
     data_mixl, availabilities,
     nDraws = numDraws_wtp
 )
-

Again, {mixl} converges to a local minimum:

-
+

Again, {mixl} converges to a local minimum (though it’s closer than +the previous solution):

+
 c(logLik(model_logitr), logLik(model_mixl))
-
#> [1]  -732.2132 -1544.8531
-
+
#> [1] -718.0862 -761.5228
+
 cbind(coef(model_logitr), coef(model_mixl))
-
#>                        [,1]        [,2]
-#> scalePar          0.3880976 -2270.55731
-#> feat              1.7388324    42.24281
-#> brandhiland     -13.5367140    24.36731
-#> brandweight      -4.5100684   110.99687
-#> brandyoplait      6.6638687  -492.36959
-#> sd_feat           0.4912255    10.81470
-#> sd_brandhiland    5.7305708    10.23414
-#> sd_brandweight   11.4204997   334.92761
-#> sd_brandyoplait   8.8724698   915.14924
+
#>                        [,1]          [,2]
+#> scalePar          0.3789865    0.01959803
+#> feat              1.7468317   66.46247619
+#> brandhiland     -13.7087157 -172.32720627
+#> brandweight      -9.3828735 -114.92946558
+#> brandyoplait      4.2515734    6.24519288
+#> sd_feat          -0.9308170  -36.14686337
+#> sd_brandhiland   -4.8418491 -227.05348964
+#> sd_brandweight   10.8495725  198.52035799
+#> sd_brandyoplait   7.8130522  173.44727278

{gmnl} @@ -577,7 +595,7 @@

{gmnl}

First attempt using same starting points as {logitr}. Note that additional starting parameters must be added as the {gmnl} approach to estimating WTP is a slightly different model.

-
+
 model_gmnl <- gmnl(
     data = data_gmnl,
     formula = choice ~ price + feat + brand | 0 | 0 | 0 | 1,
@@ -593,24 +611,24 @@ 

{gmnl} R = numDraws_wtp )

{gmnl} converges to a local minimum:

-
+
 c(logLik(model_logitr), logLik(model_gmnl))
-
#> [1]  -732.2132 -1710.6872
-
+
#> [1]  -718.0862 -1710.6872
+
 cbind(coef(model_logitr), coef(model_gmnl))
#>                        [,1]         [,2]
-#> feat              0.3880976    8.1540692
-#> brandhiland       1.7388324    4.4266391
-#> brandweight     -13.5367140   20.9581382
-#> brandyoplait     -4.5100684  -93.0969112
-#> het.(Intercept)   6.6638687 -440.5183170
-#> sd.feat           0.4912255    2.4208585
-#> sd.brandhiland    5.7305708    0.1085233
-#> sd.brandweight   11.4204997   53.2376327
-#> sd.brandyoplait   8.8724698   95.0008933
-#> tau               0.3880976  653.9956379
+#> feat 0.3789865 8.1540692 +#> brandhiland 1.7468317 4.4266391 +#> brandweight -13.7087157 20.9581382 +#> brandyoplait -9.3828735 -93.0969112 +#> het.(Intercept) 4.2515734 -440.5183170 +#> sd.feat -0.9308170 2.4208585 +#> sd.brandhiland -4.8418491 0.1085233 +#> sd.brandweight 10.8495725 53.2376327 +#> sd.brandyoplait 7.8130522 95.0008933 +#> tau 0.3789865 653.9956379

Second attempt using {logitr} solution as starting points:

-
+
 model_gmnl <- gmnl(
     data = data_gmnl,
     formula = choice ~ price + feat + brand | 0 | 0 | 0 | 1,
@@ -625,16 +643,29 @@ 

{gmnl} start = c(coef(model_logitr), 0.1, 0.1, 0), R = numDraws_wtp )

-
#> Error in optim(par = c(feat = 1.74, brandhiland = -13.54, brandweight = -4.51,  :
-#> initial value in 'vmmin' is not finite
-

In this case, {gmnl} fails due to an error with the starting values -provided.

+

Again, {gmnl} converges to a local minimum:

+
+c(logLik(model_logitr), logLik(model_gmnl))
+
#> [1] -718.0862 -944.3339
+
+cbind(coef(model_logitr), coef(model_gmnl))
+
#>                        [,1]       [,2]
+#> feat              0.3789865   2.321317
+#> brandhiland       1.7468317 -18.785933
+#> brandweight     -13.7087157  -5.977394
+#> brandyoplait     -9.3828735   1.761744
+#> het.(Intercept)   4.2515734   6.168432
+#> sd.feat          -0.9308170   2.830422
+#> sd.brandhiland   -4.8418491   6.358857
+#> sd.brandweight   10.8495725  10.600978
+#> sd.brandyoplait   7.8130522   5.455189
+#> tau               0.3789865   8.230516

{apollo}

First attempt using same starting points as {logitr}:

-
+
 model_apollo <- apollo_estimate(
     apollo_beta          = start_wtp,
     apollo_fixed         = NULL,
@@ -642,24 +673,26 @@ 

{apollo} apollo_inputs = apollo_inputs_wtp, estimate_settings = list(printLevel = 0) )

-

{apollo} converges to a local minimum:

-
-c(logLik(model_logitr), logLik(model_apollo))
-
#> [1] -732.2132 -776.5525
-
+

{apollo} fails to converge and just returns the starting +coefficients:

+
+c(logLik(model_logitr), model_apollo$LLout)
+
#>                 model 
+#>  -718.0862 -2928.4048 
+
 cbind(coef(model_logitr), coef(model_apollo))
-
#>                        [,1]          [,2]
-#> scalePar          0.3880976    0.02264706
-#> feat              1.7388324   52.92881692
-#> brandhiland     -13.5367140 -129.27886303
-#> brandweight      -4.5100684 -104.76878544
-#> brandyoplait      6.6638687   23.77062341
-#> sd_feat           0.4912255   11.06432598
-#> sd_brandhiland    5.7305708  -86.57222932
-#> sd_brandweight   11.4204997  164.38217567
-#> sd_brandyoplait   8.8724698  156.45076147
+
#>                        [,1]
+#> scalePar          0.3789865
+#> feat              1.7468317
+#> brandhiland     -13.7087157
+#> brandweight      -9.3828735
+#> brandyoplait      4.2515734
+#> sd_feat          -0.9308170
+#> sd_brandhiland   -4.8418491
+#> sd_brandweight   10.8495725
+#> sd_brandyoplait   7.8130522

Second attempt using {logitr} solution as starting points:

-
+
 model_apollo <- apollo_estimate(
     apollo_beta          = coef(model_logitr),
     apollo_fixed         = NULL,
@@ -667,22 +700,23 @@ 

{apollo} apollo_inputs = apollo_inputs_wtp, estimate_settings = list(printLevel = 0) )

-

Again, {apollo} converges to a local minimum:

-
-c(logLik(model_logitr), logLik(model_apollo))
-
#> [1] -732.2132 -772.6268
-
-cbind(coef(model_logitr), coef(model_apollo))
+

This time {apollo} converges to a local minimum:

+
+c(logLik(model_logitr), model_apollo$LLout)
+
#>               model 
+#> -718.0862 -769.7493 
+
+cbind(coef(model_logitr), model_apollo$betaStop)
#>                        [,1]          [,2]
-#> scalePar          0.3880976  2.180707e-03
-#> feat              1.7388324  7.365495e+02
-#> brandhiland     -13.5367140 -2.378832e+03
-#> brandweight      -4.5100684 -1.382908e+03
-#> brandyoplait      6.6638687  1.571897e+02
-#> sd_feat           0.4912255 -3.484523e+02
-#> sd_brandhiland    5.7305708  9.805109e+02
-#> sd_brandweight   11.4204997  1.899130e+03
-#> sd_brandyoplait   8.8724698  1.211976e+03
+#> scalePar 0.3789865 2.376434e-04 +#> feat 1.7468317 5.213661e+03 +#> brandhiland -13.7087157 -1.622643e+04 +#> brandweight -9.3828735 -1.529634e+04 +#> brandyoplait 4.2515734 4.573893e+03 +#> sd_feat -0.9308170 6.131294e+02 +#> sd_brandhiland -4.8418491 -9.461200e+03 +#> sd_brandweight 10.8495725 1.260092e+04 +#> sd_brandyoplait 7.8130522 1.347027e+04
diff --git a/articles/data_formatting.html b/articles/data_formatting.html index 409b52a..b610d04 100644 --- a/articles/data_formatting.html +++ b/articles/data_formatting.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1
@@ -251,9 +251,9 @@

Creating dummy coded variablessummary(mnl_pref_dummies) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:11:30 2023 +#> Model estimated on: Sun Sep 24 18:54:30 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt2, outcome = "choice", obsID = "obsID", pars = c("price", @@ -269,7 +269,7 @@

Creating dummy coded variables#> Model Space: Preference #> Model Run: 1 of 1 #> Iterations: 18 -#> Elapsed Time: 0h:0m:0.17s +#> Elapsed Time: 0h:0m:0.04s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Robust? FALSE diff --git a/articles/index.html b/articles/index.html index de443af..c6188cd 100644 --- a/articles/index.html +++ b/articles/index.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1

diff --git a/articles/interactions.html b/articles/interactions.html index b5e4844..74f131d 100644 --- a/articles/interactions.html +++ b/articles/interactions.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1
@@ -167,9 +167,9 @@

Interactions with continuous var summary(model_price_feat) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:11:36 2023 +#> Model estimated on: Sun Sep 24 18:54:34 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("price", @@ -234,9 +234,9 @@

Interactions with discrete variabl summary(model_price_brand) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:11:37 2023 +#> Model estimated on: Sun Sep 24 18:54:35 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("price", @@ -252,7 +252,7 @@

Interactions with discrete variabl #> Model Space: Preference #> Model Run: 1 of 1 #> Iterations: 37 -#> Elapsed Time: 0h:0m:0.08s +#> Elapsed Time: 0h:0m:0.06s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Robust? FALSE @@ -326,9 +326,9 @@

Interactions with indiv summary(model_price_group) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:11:38 2023 +#> Model estimated on: Sun Sep 24 18:54:36 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("price", @@ -344,7 +344,7 @@

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

Interactions in mixed logit modelssummary(model_price_feat_mxl) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:11:39 2023 +#> Model estimated on: Sun Sep 24 18:54:36 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("price", diff --git a/articles/mnl_models.html b/articles/mnl_models.html index ce3cab3..44054cb 100644 --- a/articles/mnl_models.html +++ b/articles/mnl_models.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1

@@ -221,9 +221,9 @@

Preference space modelsummary(mnl_pref) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:11:48 2023 +#> Model estimated on: Sun Sep 24 18:54:44 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("price", @@ -239,7 +239,7 @@

Preference space model#> Model Space: Preference #> Model Run: 1 of 1 #> Iterations: 21 -#> Elapsed Time: 0h:0m:0.09s +#> 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.024335 15.0627 < 2.2e-16 *** -#> feat 1.340699 0.359607 3.7282 0.0001928 *** -#> brandhiland -10.136219 0.584794 -17.3330 < 2.2e-16 *** -#> brandweight -1.749094 0.180721 -9.6784 < 2.2e-16 *** -#> brandyoplait 2.003848 0.143548 13.9594 < 2.2e-16 *** +#> scalePar 0.366555 0.024394 15.0267 < 2.2e-16 *** +#> feat 1.340699 0.359066 3.7338 0.0001886 *** +#> brandhiland -10.136219 0.586624 -17.2789 < 2.2e-16 *** +#> brandweight -1.749094 0.182142 -9.6029 < 2.2e-16 *** +#> brandyoplait 2.003848 0.143192 13.9941 < 2.2e-16 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

@@ -316,9 +316,9 @@

WTP space modelsummary(mnl_wtp) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:11:50 2023 +#> Model estimated on: Sun Sep 24 18:54:45 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("feat", @@ -332,15 +332,15 @@

WTP space model#> Summary Of Multistart Runs: #> Log Likelihood Iterations Exit Status #> 1 -2656.888 84 3 -#> 2 -2656.888 38 3 -#> 3 -2656.888 44 3 -#> 4 -2656.888 41 3 -#> 5 -2656.888 48 3 -#> 6 -2656.888 35 3 -#> 7 -2656.888 45 3 -#> 8 -2656.888 38 3 -#> 9 -2803.899 95 3 -#> 10 -2656.888 38 3 +#> 2 -2656.888 37 3 +#> 3 -2656.888 64 3 +#> 4 -2656.888 44 3 +#> 5 -2656.888 47 3 +#> 6 -2656.888 48 3 +#> 7 -2656.888 43 3 +#> 8 -2803.759 90 3 +#> 9 -2656.888 43 3 +#> 10 -2656.888 44 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: 8 of 10 -#> Iterations: 38 -#> Elapsed Time: 0h:0m:0.13s +#> Model Run: 6 of 10 +#> Iterations: 48 +#> Elapsed Time: 0h:0m:0.15s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: FALSE #> Robust? FALSE #> #> Model Coefficients: #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.366582 0.024366 15.0447 < 2.2e-16 *** -#> feat 1.340603 0.355868 3.7671 0.0001651 *** -#> brandhiland -10.135783 0.576092 -17.5940 < 2.2e-16 *** -#> brandweight -1.749083 0.179898 -9.7226 < 2.2e-16 *** -#> brandyoplait 2.003824 0.142377 14.0740 < 2.2e-16 *** +#> scalePar 0.366586 0.024366 15.0448 < 2.2e-16 *** +#> feat 1.340584 0.355865 3.7671 0.0001651 *** +#> brandhiland -10.135766 0.576092 -17.5940 < 2.2e-16 *** +#> brandweight -1.749031 0.179893 -9.7226 < 2.2e-16 *** +#> brandyoplait 2.003796 0.142378 14.0738 < 2.2e-16 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> -#> Log-Likelihood: -2656.8878779 +#> Log-Likelihood: -2656.8878781 #> Null Log-Likelihood: -3343.7419990 -#> AIC: 5323.7757559 +#> 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.3665824    1.3406028  -10.1357831   -1.7490833    2.0038244

+#> 0.3665863 1.3405842 -10.1357665 -1.7490311 2.0037959

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.3665824  0.00002782
-#> feat             1.3406987     1.3406028 -0.00009584
-#> brandhiland    -10.1362190   -10.1357831  0.00043595
-#> brandweight     -1.7490940    -1.7490833  0.00001069
-#> brandyoplait     2.0038476     2.0038244 -0.00002325
-#> logLik       -2656.8878790 -2656.8878779  0.00000106

+#> scalePar 0.3665546 0.3665863 0.00003179 +#> feat 1.3406987 1.3405842 -0.00011446 +#> brandhiland -10.1362190 -10.1357665 0.00045253 +#> brandweight -1.7490940 -1.7490311 0.00006283 +#> brandyoplait 2.0038476 2.0037959 -0.00005172 +#> logLik -2656.8878790 -2656.8878781 0.00000094

References diff --git a/articles/mnl_models_weighted.html b/articles/mnl_models_weighted.html index d1293bc..9cc4739 100644 --- a/articles/mnl_models_weighted.html +++ b/articles/mnl_models_weighted.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1

@@ -288,9 +288,9 @@

Unweighted modelsummary(mnl_wtp_unweighted) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:11:57 2023 +#> Model estimated on: Sun Sep 24 18:54:50 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = cars_us, outcome = "choice", obsID = "obsnum", @@ -306,15 +306,15 @@

Unweighted model#> Summary Of Multistart Runs: #> Log Likelihood Iterations Exit Status #> 1 -4616.952 26 3 -#> 2 -4616.952 39 3 -#> 3 -4616.953 33 3 +#> 2 -4616.952 34 3 +#> 3 -4616.952 33 3 #> 4 -4616.952 33 3 -#> 5 -4616.952 34 3 -#> 6 -4616.952 31 3 +#> 5 -4616.952 31 3 +#> 6 -4616.952 44 3 #> 7 -4616.952 32 3 #> 8 -4616.952 34 3 #> 9 -4616.952 35 3 -#> 10 -4616.952 34 3 +#> 10 -4616.952 30 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: 2 of 10 -#> Iterations: 39 -#> Elapsed Time: 0h:0m:0.63s +#> Model Run: 1 of 10 +#> Iterations: 26 +#> Elapsed Time: 0h:0m:0.32s #> 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.0738775 0.0021929 33.6898 < 2.2e-16 *** -#> hev 0.8068054 0.9990706 0.8076 0.4193463 -#> phev10 1.1660674 1.0615090 1.0985 0.2719863 -#> phev20 1.6478188 1.0617552 1.5520 0.1206679 -#> phev40 2.5797504 1.0499382 2.4570 0.0140083 * -#> bev75 -16.0466183 1.2541608 -12.7947 < 2.2e-16 *** -#> bev100 -13.0037471 1.2388796 -10.4964 < 2.2e-16 *** -#> bev150 -9.5739236 1.1642004 -8.2236 2.220e-16 *** -#> american 2.3440130 0.7979785 2.9374 0.0033094 ** -#> japanese -0.3747328 0.7998400 -0.4685 0.6394202 -#> chinese -10.2689837 0.8859558 -11.5909 < 2.2e-16 *** -#> skorean -6.0310620 0.8514398 -7.0834 1.407e-12 *** -#> phevFastcharge 2.8791002 0.8028869 3.5859 0.0003359 *** -#> bevFastcharge 2.9190774 0.9181479 3.1793 0.0014763 ** -#> opCost -1.6360692 0.0686325 -23.8381 < 2.2e-16 *** -#> accelTime -1.6970402 0.1638110 -10.3597 < 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.9517791 +#> Log-Likelihood: -4616.9517826 #> Null Log-Likelihood: -6328.0067827 -#> AIC: 9265.9035583 +#> AIC: 9265.9035652 #> BIC: 9372.4426000 #> McFadden R2: 0.2703940 #> Adj McFadden R2: 0.2678655 @@ -391,9 +391,9 @@

Weighted modelsummary(mnl_wtp_weighted) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:12:03 2023 +#> Model estimated on: Sun Sep 24 18:54:56 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = cars_us, outcome = "choice", obsID = "obsnum", @@ -409,15 +409,15 @@

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

Weighted model#> #> Model Type: Multinomial Logit #> Model Space: Willingness-to-Pay -#> Model Run: 8 of 10 -#> Iterations: 32 +#> Model Run: 10 of 10 +#> Iterations: 31 #> Elapsed Time: 0h:0m:0.25s #> Algorithm: NLOPT_LD_LBFGS #> Weights Used?: TRUE @@ -435,28 +435,28 @@

Weighted model#> #> Model Coefficients: #> Estimate Std. Error z-value Pr(>|z|) -#> scalePar 0.0522818 0.0040686 12.8501 < 2.2e-16 *** -#> hev -1.1759207 2.9132323 -0.4036 0.686472 -#> phev10 0.0274315 3.1279260 0.0088 0.993003 -#> phev20 1.6947303 3.0996216 0.5468 0.584548 -#> phev40 2.6496902 2.9850975 0.8876 0.374735 -#> bev75 -20.1357359 3.6669785 -5.4911 3.994e-08 *** -#> bev100 -19.4961611 3.6254620 -5.3776 7.550e-08 *** -#> bev150 -13.6916179 3.4926244 -3.9202 8.849e-05 *** -#> american 8.1874091 2.4052120 3.4040 0.000664 *** -#> japanese 0.9340320 2.3602854 0.3957 0.692305 -#> chinese -19.0061383 2.8538012 -6.6599 2.739e-11 *** -#> skorean -9.5099893 2.5233318 -3.7688 0.000164 *** -#> phevFastcharge 3.9430181 2.3623185 1.6691 0.095091 . -#> bevFastcharge 3.3442426 2.8086030 1.1907 0.233766 -#> opCost -1.5974621 0.1948306 -8.1992 2.220e-16 *** -#> accelTime -1.1717589 0.4834516 -2.4237 0.015362 * +#> scalePar 0.0522855 0.0040694 12.8484 < 2.2e-16 *** +#> hev -1.1765154 2.9130990 -0.4039 0.6863078 +#> phev10 0.0273509 3.1277829 0.0087 0.9930230 +#> phev20 1.6939199 3.0994821 0.5465 0.5847106 +#> phev40 2.6488455 2.9849477 0.8874 0.3748631 +#> bev75 -20.1366029 3.6670067 -5.4913 3.990e-08 *** +#> bev100 -19.4965663 3.6254222 -5.3777 7.543e-08 *** +#> bev150 -13.6917652 3.4925485 -3.9203 8.845e-05 *** +#> american 8.1871800 2.4051216 3.4041 0.0006639 *** +#> japanese 0.9323712 2.3601827 0.3950 0.6928119 +#> chinese -19.0065866 2.8539031 -6.6599 2.741e-11 *** +#> skorean -9.5093157 2.5232289 -3.7687 0.0001641 *** +#> phevFastcharge 3.9432860 2.3622329 1.6693 0.0950570 . +#> bevFastcharge 3.3452076 2.8085114 1.1911 0.2336158 +#> opCost -1.5975190 0.1948450 -8.1989 2.220e-16 *** +#> accelTime -1.1718357 0.4834399 -2.4240 0.0153526 * #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> -#> Log-Likelihood: -3425.6302867 +#> Log-Likelihood: -3425.6302912 #> Null Log-Likelihood: -4360.5909275 -#> AIC: 6883.2605734 +#> AIC: 6883.2605825 #> 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.07387753 0.05228181 -#> hev 0.80680536 -1.17592070 -#> phev10 1.16606745 0.02743152 -#> phev20 1.64781881 1.69473030 -#> phev40 2.57975041 2.64969018 -#> bev75 -16.04661833 -20.13573592 -#> bev100 -13.00374707 -19.49616111 -#> bev150 -9.57392362 -13.69161794 -#> american 2.34401299 8.18740911 -#> japanese -0.37473279 0.93403196 -#> chinese -10.26898371 -19.00613826 -#> skorean -6.03106198 -9.50998930 -#> phevFastcharge 2.87910022 3.94301807 -#> bevFastcharge 2.91907740 3.34424257 -#> opCost -1.63606917 -1.59746215 -#> accelTime -1.69704020 -1.17175887 +#> scalePar 0.07387776 0.05228554 +#> hev 0.80682602 -1.17651540 +#> phev10 1.16499818 0.02735086 +#> phev20 1.64739765 1.69391989 +#> phev40 2.57953096 2.64884548 +#> bev75 -16.04589966 -20.13660291 +#> bev100 -13.00330902 -19.49656631 +#> bev150 -9.57369897 -13.69176516 +#> american 2.34294510 8.18718003 +#> japanese -0.37569387 0.93237121 +#> chinese -10.27060451 -19.00658656 +#> skorean -6.03201950 -9.50931569 +#> phevFastcharge 2.87970966 3.94328598 +#> bevFastcharge 2.91871408 3.34520758 +#> opCost -1.63605116 -1.59751896 +#> accelTime -1.69708921 -1.17183571

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 0c6bbdf..8af73b7 100644
--- a/articles/mxl_models.html
+++ b/articles/mxl_models.html
@@ -44,7 +44,7 @@
       
       
         logitr
-        1.1.0
+        1.1.1
       
     
@@ -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.039945 11.2239 < 2.2e-16 *** -#> feat 1.733046 0.502082 3.4517 0.000557 *** -#> brandhiland -14.202148 1.391315 -10.2077 < 2.2e-16 *** -#> brandweight -8.182853 0.980744 -8.3435 < 2.2e-16 *** -#> brandyoplait 2.503674 0.411365 6.0863 1.156e-09 *** -#> sd_feat 1.265776 0.504623 2.5084 0.012129 * -#> sd_brandhiland -7.096979 0.961135 -7.3840 1.537e-13 *** -#> sd_brandweight 9.138487 0.950784 9.6115 < 2.2e-16 *** -#> sd_brandyoplait 7.274160 0.774724 9.3894 < 2.2e-16 *** +#> scalePar 0.448338 0.039835 11.2550 < 2.2e-16 *** +#> feat 1.733046 0.502171 3.4511 0.0005583 *** +#> brandhiland -14.202148 1.394634 -10.1834 < 2.2e-16 *** +#> brandweight -8.182853 0.978382 -8.3637 < 2.2e-16 *** +#> brandyoplait 2.503674 0.412885 6.0639 1.329e-09 *** +#> sd_feat 1.265776 0.504290 2.5100 0.0120725 * +#> sd_brandhiland -7.096979 0.963663 -7.3646 1.776e-13 *** +#> sd_brandweight 9.138487 0.947991 9.6398 < 2.2e-16 *** +#> sd_brandyoplait 7.274160 0.770389 9.4422 < 2.2e-16 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 diff --git a/articles/predict.html b/articles/predict.html index f00efea..4cdd700 100644 --- a/articles/predict.html +++ b/articles/predict.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/articles/summarizing_results.html b/articles/summarizing_results.html index f387907..18cb263 100644 --- a/articles/summarizing_results.html +++ b/articles/summarizing_results.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1 @@ -153,9 +153,9 @@

Extracting summary tablessummary(model) #> ================================================= #> -#> Model estimated on: Tue Jun 27 21:12:25 2023 +#> Model estimated on: Sun Sep 24 18:55:19 2023 #> -#> Using logitr version: 1.1.0 +#> Using logitr version: 1.1.1 #> #> Call: #> logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("price", @@ -171,7 +171,7 @@

Extracting summary tables#> 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 @@ -235,11 +235,11 @@

The {broom} package#> # A tibble: 5 × 7 #> 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.746 -0.534 -#> 3 brandyoplait 0.735 0.0806 9.11 0 0.574 0.897 -#> 4 feat 0.491 0.120 4.09 0.0000425 0.256 0.725 -#> 5 price -0.367 0.0244 -15.0 0 -0.414 -0.317 +#> 1 brandhiland -3.72 0.145 -25.6 0 -3.99 -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.574 0.892 +#> 4 feat 0.491 0.120 4.09 0.0000425 0.259 0.727 +#> 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.53 +-0.75, -0.54 <0.001 @@ -784,13 +784,13 @@

The {gtsummary} package feat 0.49 -0.25, 0.72 +0.26, 0.73 <0.001 price -0.37 --0.42, -0.32 +-0.41, -0.32 <0.001 @@ -811,23 +811,23 @@

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

-
- @@ -1282,7 +1282,7 @@

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

The {gtsummary} package Newspaper ad shown? 0.49 -0.26, 0.72 +0.26, 0.73 <0.001 @@ -1344,23 +1344,23 @@

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

-
- @@ -1842,34 +1842,34 @@

The {gtsummary} package-0.75, -0.53 <0.001 -0.64 --0.75, -0.54 +-0.75, -0.53 <0.001     yoplait 0.73 -0.58, 0.90 +0.58, 0.89 <0.001 0.72 -0.56, 0.88 +0.57, 0.88 <0.001 feat 0.49 -0.25, 0.73 +0.26, 0.72 <0.001 1.2 -0.41, 1.9 +0.42, 1.9 0.002 price -0.37 --0.42, -0.32 +-0.41, -0.32 <0.001 -0.36 --0.40, -0.31 +-0.41, -0.31 <0.001 diff --git a/articles/utility_models.html b/articles/utility_models.html index 2743faa..4b08a95 100644 --- a/articles/utility_models.html +++ b/articles/utility_models.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1

diff --git a/authors.html b/authors.html index 89d74c5..b1329bd 100644 --- a/authors.html +++ b/authors.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/index.html b/index.html index 38ed2a9..2a1caac 100644 --- a/index.html +++ b/index.html @@ -44,7 +44,7 @@ logitr - 1.1.0 + 1.1.1 @@ -185,7 +185,6 @@

Citation Information into R:

 citation("logitr")
-#> 
 #> To cite logitr in publications use:
 #> 
 #>   Helveston JP (2023). "logitr: Fast Estimation of Multinomial and
diff --git a/news/index.html b/news/index.html
index 034baaa..c2410da 100644
--- a/news/index.html
+++ b/news/index.html
@@ -17,7 +17,7 @@
       
       
         logitr
-        1.1.0
+        1.1.1
       
     
@@ -97,6 +97,10 @@

Changelog

+ +
  • Updated the convergence.Rmd vignette to not run any actual code using other packages to fix issue on CRAN where not all packages are available on all platforms. Now the results are hard-coded in place.
  • +
+
  • Modified predict() method to use the interval and level arguments of more standard predict() methods.
  • Added ci() function.
  • diff --git a/pkgdown.yml b/pkgdown.yml index d5d6477..8b4f769 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-06-27T21:09Z +last_built: 2023-09-24T18:53Z urls: reference: https://jhelvy.github.io/logitr/reference article: https://jhelvy.github.io/logitr/articles diff --git a/reference/apolloModeChoiceData.html b/reference/apolloModeChoiceData.html index e9bcac2..8450909 100644 --- a/reference/apolloModeChoiceData.html +++ b/reference/apolloModeChoiceData.html @@ -22,7 +22,7 @@ logitr - 1.1.0 + 1.1.1
diff --git a/reference/augment.logitr.html b/reference/augment.logitr.html index 7a78070..e10ba2d 100644 --- a/reference/augment.logitr.html +++ b/reference/augment.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/cars_china.html b/reference/cars_china.html index 9fb1e18..091ffc0 100644 --- a/reference/cars_china.html +++ b/reference/cars_china.html @@ -23,7 +23,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/cars_us.html b/reference/cars_us.html index b5eeda9..9d00b98 100644 --- a/reference/cars_us.html +++ b/reference/cars_us.html @@ -23,7 +23,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/ci.html b/reference/ci.html index fc71773..9e92349 100644 --- a/reference/ci.html +++ b/reference/ci.html @@ -19,7 +19,7 @@ logitr - 1.1.0 + 1.1.1 @@ -140,11 +140,11 @@

Examples

# Compute a confidence interval ci(coef_draws, level = 0.95) #> mean lower upper -#> price -0.3664219 -0.4146429 -0.3181950 -#> feat 0.4904642 0.2513380 0.7239711 -#> brandhiland -3.7148090 -3.9958394 -3.4295248 -#> brandweight -0.6415058 -0.7477549 -0.5338245 -#> brandyoplait 0.7341273 0.5760748 0.8942999 +#> price -0.3666368 -0.4152213 -0.3193260 +#> feat 0.4904272 0.2556531 0.7219505 +#> brandhiland -3.7150440 -3.9982866 -3.4259300 +#> brandweight -0.6407809 -0.7496428 -0.5347985 +#> brandyoplait 0.7351498 0.5789712 0.8933858
diff --git a/reference/confint.logitr.html b/reference/confint.logitr.html index 39f06b5..5705c76 100644 --- a/reference/confint.logitr.html +++ b/reference/confint.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 @@ -148,11 +148,11 @@

Examples

# Compute a confidence interval confint(mnl_pref) #> 2.5 % 97.5 % -#> price -0.4143429 -0.3199686 -#> feat 0.2602212 0.7265358 -#> brandhiland -4.0017995 -3.4329399 -#> brandweight -0.7475883 -0.5337024 -#> brandyoplait 0.5814295 0.8930725 +#> price -0.4138755 -0.3191798 +#> feat 0.2568774 0.7241786 +#> brandhiland -4.0003038 -3.4306720 +#> brandweight -0.7488202 -0.5334936 +#> brandyoplait 0.5759035 0.8935131 diff --git a/reference/dummyCode.html b/reference/dummyCode.html index 1f42941..b2f8e8f 100644 --- a/reference/dummyCode.html +++ b/reference/dummyCode.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/electricity.html b/reference/electricity.html index 0eda22f..8f4c4cd 100644 --- a/reference/electricity.html +++ b/reference/electricity.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/fitted.logitr.html b/reference/fitted.logitr.html index a5611d5..6f0f554 100644 --- a/reference/fitted.logitr.html +++ b/reference/fitted.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/fquantile.html b/reference/fquantile.html index b6b7d24..118aac6 100644 --- a/reference/fquantile.html +++ b/reference/fquantile.html @@ -24,7 +24,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/glance.logitr.html b/reference/glance.logitr.html index 2f9def5..8ae100e 100644 --- a/reference/glance.logitr.html +++ b/reference/glance.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/index.html b/reference/index.html index c1b87e3..c091f95 100644 --- a/reference/index.html +++ b/reference/index.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/logit_probs.html b/reference/logit_probs.html index 480a222..8b69567 100644 --- a/reference/logit_probs.html +++ b/reference/logit_probs.html @@ -26,7 +26,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/logitr.html b/reference/logitr.html index 4b510c7..b826542 100644 --- a/reference/logitr.html +++ b/reference/logitr.html @@ -23,7 +23,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/miscmethods.logitr.html b/reference/miscmethods.logitr.html index 5dda3b8..c27d58a 100644 --- a/reference/miscmethods.logitr.html +++ b/reference/miscmethods.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/model.frame.logitr.html b/reference/model.frame.logitr.html index 1d33019..2235e1c 100644 --- a/reference/model.frame.logitr.html +++ b/reference/model.frame.logitr.html @@ -18,7 +18,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/model.matrix.logitr.html b/reference/model.matrix.logitr.html index 1a1f5b8..a06c8c3 100644 --- a/reference/model.matrix.logitr.html +++ b/reference/model.matrix.logitr.html @@ -19,7 +19,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/predict.logitr.html b/reference/predict.logitr.html index b86bc73..19c0edf 100644 --- a/reference/predict.logitr.html +++ b/reference/predict.logitr.html @@ -19,7 +19,7 @@ logitr - 1.1.0 + 1.1.1 @@ -276,38 +276,38 @@

Examples

level = 0.95 ) #> obsID predicted_prob predicted_prob_lower predicted_prob_upper -#> 1 13 0.43685145 0.41555759 0.4582467 -#> 2 13 0.03312986 0.02640190 0.0416749 -#> 3 13 0.19155548 0.17589922 0.2080637 -#> 4 13 0.33846321 0.31766880 0.3583736 -#> 5 42 0.60764778 0.57261921 0.6410699 -#> 6 42 0.02602007 0.01845304 0.0367001 -#> 7 42 0.17803313 0.16172799 0.1950276 -#> 8 42 0.18829902 0.16782581 0.2097794 +#> 1 13 0.43685145 0.41557188 0.45829550 +#> 2 13 0.03312986 0.02621036 0.04183873 +#> 3 13 0.19155548 0.17578099 0.20739364 +#> 4 13 0.33846321 0.31832456 0.35862273 +#> 5 42 0.60764778 0.57375622 0.64040015 +#> 6 42 0.02602007 0.01852866 0.03684098 +#> 7 42 0.17803313 0.16185829 0.19459582 +#> 8 42 0.18829902 0.16797946 0.20950011 # Predict outcomes predict(mnl_pref, newdata = data, obsID = "obsID", type = "outcome") #> obsID predicted_outcome -#> 1 13 0 -#> 2 13 1 +#> 1 13 1 +#> 2 13 0 #> 3 13 0 #> 4 13 0 #> 5 42 0 #> 6 42 0 -#> 7 42 0 -#> 8 42 1 +#> 7 42 1 +#> 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 0 +#> 1 13 0.43685145 1 #> 2 13 0.03312986 0 -#> 3 13 0.19155548 1 +#> 3 13 0.19155548 0 #> 4 13 0.33846321 0 -#> 5 42 0.60764778 1 +#> 5 42 0.60764778 0 #> 6 42 0.02602007 0 #> 7 42 0.17803313 0 -#> 8 42 0.18829902 0 +#> 8 42 0.18829902 1 diff --git a/reference/predictChoices.html b/reference/predictChoices.html index d33e0b8..28b30d2 100644 --- a/reference/predictChoices.html +++ b/reference/predictChoices.html @@ -18,7 +18,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/predictProbs.html b/reference/predictProbs.html index 815c7f8..5274dea 100644 --- a/reference/predictProbs.html +++ b/reference/predictProbs.html @@ -18,7 +18,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/recodeData.html b/reference/recodeData.html index 6dc09e0..5e98455 100644 --- a/reference/recodeData.html +++ b/reference/recodeData.html @@ -24,7 +24,7 @@ logitr - 1.1.0 + 1.1.1 @@ -157,7 +157,7 @@

Examples

result$formula #> ~price + feat + brand + price * brand -#> <environment: 0x7fc6bd452b58> +#> <environment: 0x7f92710c8a08> result$pars #> [1] "price" "feat" "brandhiland" #> [4] "brandweight" "brandyoplait" "price:brandhiland" diff --git a/reference/reexports.html b/reference/reexports.html index d191315..5b664fd 100644 --- a/reference/reexports.html +++ b/reference/reexports.html @@ -24,7 +24,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/residuals.logitr.html b/reference/residuals.logitr.html index 4fe4c8a..cc63903 100644 --- a/reference/residuals.logitr.html +++ b/reference/residuals.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/runtimes.html b/reference/runtimes.html index 483e9dc..6e36e8c 100644 --- a/reference/runtimes.html +++ b/reference/runtimes.html @@ -21,7 +21,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/se.html b/reference/se.html index ee46ccb..961df18 100644 --- a/reference/se.html +++ b/reference/se.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/se.logitr.html b/reference/se.logitr.html index 2c64add..dff9f6c 100644 --- a/reference/se.logitr.html +++ b/reference/se.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/simulateShares.html b/reference/simulateShares.html index 43a77b1..1022a8d 100644 --- a/reference/simulateShares.html +++ b/reference/simulateShares.html @@ -18,7 +18,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/statusCodes.html b/reference/statusCodes.html index 255fac3..2d58bda 100644 --- a/reference/statusCodes.html +++ b/reference/statusCodes.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/tidy.logitr.html b/reference/tidy.logitr.html index e490ac6..46eb311 100644 --- a/reference/tidy.logitr.html +++ b/reference/tidy.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 @@ -164,10 +164,10 @@

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.748 -0.537 -#> 3 brandyoplait 0.735 0.0806 9.11 0 0.578 0.889 -#> 4 feat 0.491 0.120 4.09 0.0000425 0.251 0.732 -#> 5 price -0.367 0.0244 -15.0 0 -0.414 -0.318 +#> 2 brandweight -0.641 0.0545 -11.8 0 -0.746 -0.534 +#> 3 brandyoplait 0.735 0.0806 9.11 0 0.579 0.891 +#> 4 feat 0.491 0.120 4.09 0.0000425 0.253 0.729 +#> 5 price -0.367 0.0244 -15.0 0 -0.415 -0.320 diff --git a/reference/vcov.logitr.html b/reference/vcov.logitr.html index 42a4f64..b3065b7 100644 --- a/reference/vcov.logitr.html +++ b/reference/vcov.logitr.html @@ -18,7 +18,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/wtp.html b/reference/wtp.html index e226460..0fefd8e 100644 --- a/reference/wtp.html +++ b/reference/wtp.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 @@ -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.024266 15.1059 < 2.2e-16 *** -#> feat 1.340699 0.358873 3.7359 0.0001871 *** -#> brandhiland -10.136219 0.583198 -17.3804 < 2.2e-16 *** -#> brandweight -1.749094 0.181496 -9.6371 < 2.2e-16 *** -#> brandyoplait 2.003848 0.143494 13.9646 < 2.2e-16 *** +#> scalePar 0.366555 0.024364 15.0447 < 2.2e-16 *** +#> feat 1.340699 0.359542 3.7289 0.0001923 *** +#> brandhiland -10.136219 0.583884 -17.3600 < 2.2e-16 *** +#> brandweight -1.749094 0.181578 -9.6327 < 2.2e-16 *** +#> brandyoplait 2.003848 0.143284 13.9852 < 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 45937ac..e318095 100644 --- a/reference/wtp.logitr.html +++ b/reference/wtp.logitr.html @@ -17,7 +17,7 @@ logitr - 1.1.0 + 1.1.1 @@ -147,11 +147,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.024349 15.0544 < 2.2e-16 *** -#> feat 1.340699 0.359676 3.7275 0.0001934 *** -#> brandhiland -10.136219 0.584817 -17.3323 < 2.2e-16 *** -#> brandweight -1.749094 0.181484 -9.6377 < 2.2e-16 *** -#> brandyoplait 2.003848 0.143665 13.9481 < 2.2e-16 *** +#> scalePar 0.366555 0.024403 15.0210 < 2.2e-16 *** +#> feat 1.340699 0.357281 3.7525 0.0001751 *** +#> brandhiland -10.136219 0.583776 -17.3632 < 2.2e-16 *** +#> brandweight -1.749094 0.181970 -9.6120 < 2.2e-16 *** +#> brandyoplait 2.003848 0.143578 13.9565 < 2.2e-16 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 diff --git a/reference/wtpCompare.html b/reference/wtpCompare.html index 3540f61..544133c 100644 --- a/reference/wtpCompare.html +++ b/reference/wtpCompare.html @@ -18,7 +18,7 @@ logitr - 1.1.0 + 1.1.1 diff --git a/reference/yogurt.html b/reference/yogurt.html index f083c6e..c230652 100644 --- a/reference/yogurt.html +++ b/reference/yogurt.html @@ -24,7 +24,7 @@ logitr - 1.1.0 + 1.1.1