Skip to content

Commit

Permalink
0.0.4 updates
Browse files Browse the repository at this point in the history
- Changed license to MIT (after doing a bit of reading up on this)
- Added placeholder hex sticker
  • Loading branch information
jhelvy committed Dec 4, 2020
1 parent f8b1c49 commit 7fb5893
Show file tree
Hide file tree
Showing 11 changed files with 53,911 additions and 614 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
^pkgdown$
^\.github$
vignettes/children
^README\.Rmd$
^LICENSE\.md$
^logitr\.Rproj$
^doc$
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Authors@R: c(
email = "[email protected]",
comment = c(ORCID = "0000-0002-2657-9191")))
Description: logitr estimates multinomial (MNL) and mixed logit (MXL) models in R. Models can be estimated using "Preference" space or "Willingness-to-pay" (WTP) space utility parameterizations. The program includes an option to run a multistart optimization loop with random starting points in each iteration, which is useful for non-convex problems like MXL models or models with WTP space utility parameterizations. The main optimization loop uses the nloptr function to minimize the negative log-likelihood function. The package has additional functions for computing and comparing WTP from both preference space and WTP space models and for simulating the expected shares of a set of alternatives using an estimated model.
License: GPL-3
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Expand Down
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2014-2020
COPYRIGHT HOLDER: John Paul Helveston
616 changes: 21 additions & 595 deletions LICENSE.md

Large diffs are not rendered by default.

38 changes: 32 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
# logitr 0.0.3: New simulation functionality
# logitr 0.0.4

Weighted models, new dataset, new encoding features

## Summary of larger updates:

- Added support for estimating weighted regressions
- Added and improved documentation for new datasets: `yogurt`, `cars_china`, `cars_us`
- Exported the `dummyCode()` function for automatically creating dummy-coded variables in a data frame.
- Added support for auto dummy-coding categorical variables prior to model estimation
- Major overhaul of documentation using {pkgdown}

## Summary of smaller updates:

- Changed license to MIT (after doing a bit of reading up on this)
- Fixed dimension-matching issue with user-provided draws for mixed logit models
- Fixed bug in `modelInputs` where `obsID` was not a vector for tibble inputs
- Added placeholder hex sticker


# logitr 0.0.3

New simulation functionality

## Summary of larger updates:

* Added support for simulating shares for a set of alternatives given an estimated model: `simulateShares()`. This is similar to the `predict()` function in mlogit.
* Removed support for using an estimated preference space model as an input in the `options()` function. I found this just far too confusing, and instead encourage users to supply a WTP space model with the computed WTP from a preference space model as starting parameters.
- Added support for simulating shares for a set of alternatives given an estimated model: `simulateShares()`. This is similar to the `predict()` function in mlogit.
- Removed support for using an estimated preference space model as an input in the `options()` function. I found this just far too confusing, and instead encourage users to supply a WTP space model with the computed WTP from a preference space model as starting parameters.

## Summary of smaller updates:

* Updated the `summary()` and main `logitr()` functions to keep the basic information (run #, log-likelihood value, number of iterations, and output status) whenever `numMultistarts` > 1. Previously this information was only kept if `keepAllRuns` was set to `TRUE`.
- Updated the `summary()` and main `logitr()` functions to keep the basic information (run #, log-likelihood value, number of iterations, and output status) whenever `numMultistarts` > 1. Previously this information was only kept if `keepAllRuns` was set to `TRUE`.



# logitr 0.0.2

# logitr 0.0.2: Updates to options and a few small bug fixes
Updates to options and a few small bug fixes

## Summary of larger updates:

Expand All @@ -38,6 +62,8 @@ getting the right logLik value too.



# logitr 0.0.1: Full reboot of logitr!
# logitr 0.0.1

Full reboot of logitr!

Long overdue, I decided to give the logitr program a full overhaul. This is the first version that is compiled as a proper R package that can be directly installed from Github. This version is much more robust and flexible than the prior, clunky collection of R files that I had previously been using to estimate logit models.
80 changes: 80 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
warning = FALSE,
message = FALSE,
comment = "#>",
fig.path = "man/figures/",
fig.retina = 3
)
```

# logitr <a href='https://jhelvy.github.io/logitr/'><img src='man/figures/logitr-hex.png' align="right" height="139" /></a>

<!-- badges: start -->
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![CRAN
status](https://www.r-pkg.org/badges/version/logitr)](https://CRAN.R-project.org/package=logitr)
<!-- badges: end -->

**logitr** estimates multinomial (MNL) and mixed logit (MXL) models in
R. Models can be estimated using “Preference” space or
“Willingness-to-pay” (WTP) space [utility
parameterizations](https://jhelvy.github.io/logitr/articles/utility_models.html).
The current version includes support for:

- Homogeneous multinomial logit (MNL) models
- Heterogeneous mixed logit (MXL) models (with normal and log-normal parameter distributions).
- Preference space utility parameterization.
- WTP space utility parameterization.
- An optional multistart optimization that uses different random starting points in each iteration (useful for non-convex problems like MXL models or models with WTP space parameterizations).

The package also has additional functions for:

- Computing and comparing WTP from both preference space and WTP space models.
- Simulating the expected shares of a set of alternatives using an estimated model.

Note: MXL models assume uncorrelated heterogeneity covariances and are estimated using maximum simulated likelihood based on the algorithms in [Kenneth Train’s](http://eml.berkeley.edu/~train/) book [*Discrete Choice Methods with Simulation, 2nd Edition (New York: Cambridge University Press, 2009)*](http://eml.berkeley.edu/books/choice2.html).

View the [basic usage](https://jhelvy.github.io/logitr/articles/basic_usage.html) page for details on how to use **logitr** to estimate models.

## Installation

The current version is not yet on CRAN, but you can install it from
Github using the **devtools** library:

```{r, eval=FALSE}
devtools::install_github("jhelvy/logitr")
```

Load the library with:
```{r, eval=FALSE}
library(logitr)
```

## Required Libraries

**logitr** requires the [**nloptr**](https://cran.r-project.org/web/packages/nloptr/index.html) library. This is because `nloptr()` allows for both the objective and gradient functions to be computed in a single function. This speeds up computation time considerably because both the objective and gradient functions require many of the same calculations (e.g. computing probabilities).

## Author, Version, and License Information

- Author: *John Paul Helveston* [www.jhelvy.com](http://www.jhelvy.com/)
- Date First Written: *Sunday, September 28, 2014*
- Most Recent Update: `r format(Sys.Date(), format="%B %d %Y")`
- License: [MIT](https://github.com/jhelvy/logitr/blob/master/LICENSE.md)
- [Latest Release](https://github.com/jhelvy/logitr/releases/latest): 0.0.4

# Citation Information

If you use this package for in a publication, I would greatly appreciate it if you cited it. You can get the citation information by typing `citation("logitr")` into R:

```{r}
citation("logitr")
```
50 changes: 39 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@

# logitr
<!-- README.md is generated from README.Rmd. Please edit that file -->

# logitr <a href='https://jhelvy.github.io/logitr/'><img src='man/figures/logitr-hex.png' align="right" height="139" /></a>

<!-- badges: start -->

[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![CRAN
status](https://www.r-pkg.org/badges/version/logitr)](https://CRAN.R-project.org/package=logitr)

<!-- badges: end -->

**logitr** estimates multinomial (MNL) and mixed logit (MXL) models in
Expand Down Expand Up @@ -47,7 +48,15 @@ for details on how to use **logitr** to estimate models.
The current version is not yet on CRAN, but you can install it from
Github using the **devtools** library:

devtools::install_github("jhelvy/logitr")
``` r
devtools::install_github("jhelvy/logitr")
```

Load the library with:

``` r
library(logitr)
```

## Required Libraries

Expand All @@ -59,19 +68,38 @@ computation time considerably because both the objective and gradient
functions require many of the same calculations (e.g. computing
probabilities).

# Author, Version, and License Information
## Author, Version, and License Information

- Author: *John Paul Helveston*
[www.jhelvy.com](http://www.jhelvy.com/)
- Date First Written: *Sunday, September 28, 2014*
- Most Recent Update: *Thursday, Oct 22, 2020*
- License: GPL-3
- Latest Version: 1.2.0
- Most Recent Update: December 04 2020
- License:
[MIT](https://github.com/jhelvy/logitr/blob/master/LICENSE.md)
- [Latest Release](https://github.com/jhelvy/logitr/releases/latest):
0.0.4

# Citation Information

If you use this package for in a publication, I would greatly appreciate
it if you cited it. You can get the citation information by typing this
into R:

citation('logitr')
it if you cited it. You can get the citation information by typing
`citation("logitr")` into R:

``` r
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)
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> 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},
#> url = {https://jhelvy.github.io/logitr/},
#> }
```
23 changes: 23 additions & 0 deletions build.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,26 @@ help(package = 'logitr')

# Install from github
# devtools::install_github('jhelvy/logitr')


# Make hex sticker --------------------

library(hexSticker)
library(latex2exp)
library(ggplot2)
library(showtext)
p <- ggplot() +
theme_void() +
theme_transparent() +
annotate(
geom = "text", x = 0, y = 0,
label = TeX('$\\hat{\\omega} = \\frac{\\hat{\\beta}}{\\hat{\\alpha}}$'),
size = 6)
font_add_google("Fira Sans Condensed")
showtext_auto()
sticker(p,
package = "logitr",
h_fill = "#d9d9d9", h_color = "#007bff",
p_color = "black", p_size = 10,
s_x = 1, s_y = .75, s_width = 1, s_height=1,
p_family = "Fira Sans Condensed", filename = "man/figures/logitr-hex.png")
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ citEntry(
title = "logitr: Random utility logit models with preference and willingness to pay space parameterizations",
author = "John Paul Helveston",
year = "2020",
note = "R package version 1.2.0",
note = "R package version 0.0.4",
url = "https://jhelvy.github.io/logitr/",
textVersion = "John Paul Helveston. logitr: Random utility logit models with preference and willingness to pay space parameterizations (2020)"
)
Binary file added man/figures/logitr-hex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7fb5893

Please sign in to comment.