From 3ea8ba17d27e993ce2226f90a89c18bb3740de99 Mon Sep 17 00:00:00 2001 From: melff Date: Wed, 27 Dec 2023 13:32:49 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20melff/mc?= =?UTF-8?q?logit@215d695517c119043cc9fbff3820d2db172bd9d4=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- articles/approximations.html | 60 +++++++++++++++++++++++---------- articles/baseline-logit.html | 33 +++++++++++++----- articles/conditional-logit.html | 40 ++++++++++++++++------ articles/fitting-mclogit.html | 32 +++++++++++++++--- articles/random-effects.html | 24 +++++++++++-- pkgdown.yml | 2 +- 6 files changed, 146 insertions(+), 45 deletions(-) diff --git a/articles/approximations.html b/articles/approximations.html index e9e0f62..0b7c3b2 100644 --- a/articles/approximations.html +++ b/articles/approximations.html @@ -222,7 +222,7 @@

Laplace approximationSince this quadratic expansion—let us call it \(\ell^*_{\text{Lapl}}(\boldsymbol{y},\boldsymbol{b})\)—is a (multivariate) quadratic function of \(\boldsymbol{b}\), the integral of its exponential does have a closed-form solution (the relevant formula can -be found in harville:matrix.algebra).

+be found in Harville (1997)).

For purposes of estimation, the resulting approximate log-likelihood is more useful:

\[ @@ -246,8 +246,7 @@

Penalized quasi-likelihood (PQL)If one disregards the dependence of \(\tilde{\boldsymbol{H}}\) on \(\boldsymbol{\alpha}\) and \(\boldsymbol{b}\), then \(\tilde{\boldsymbol{b}}\) maximizes not only \(\ell_{\text{cpl}}(\boldsymbol{y},\boldsymbol{b})\) but also \(\ell^*_{\text{Lapl}}\). This -motivates the following IWLS/Fisher scoring equations for \(\hat{\boldsymbol{\alpha}}\) and \(\tilde{\boldsymbol{b}}\) (see -breslow.clayton:approximate.inference.glmm and this page):

+motivates the following IWLS/Fisher scoring equations for \(\hat{\boldsymbol{\alpha}}\) and \(\tilde{\boldsymbol{b}}\) (see Breslow and Clayton (1993) and this page):

\[ \begin{aligned} \begin{bmatrix} @@ -288,7 +287,7 @@

Penalized quasi-likelihood (PQL)

-

which can be solved to compute \(hat{\boldsymbol{\alpha}}\) and \(\tilde{\boldsymbol{b}}\) (for given \(\boldsymbol{\Sigma}\))

+

which can be solved to compute \(\hat{\boldsymbol{\alpha}}\) and \(\tilde{\boldsymbol{b}}\) (for given \(\boldsymbol{\Sigma}\))

Here

\[ \boldsymbol{V} = @@ -299,8 +298,8 @@

Penalized quasi-likelihood (PQL)

-

Following breslow.clayton:approximate.inference.glmm the -variance parameters in \(\boldsymbol{Sigma}\) are estimated by +

Following Breslow and Clayton (1993) +the variance parameters in \(\boldsymbol{\Sigma}\) are estimated by minimizing

\[ q_1 = @@ -313,7 +312,7 @@

Penalized quasi-likelihood (PQL)

This motivates the following algorithm, which is strongly inspired by the glmmPQL() function in Brian Ripley’s R package -MASS:

+MASS (Venables and Ripley 2002):

  1. Create some suitable starting values for \(\boldsymbol{\pi}\), \(\boldsymbol{W}\), and \(\boldsymbol{y}^*\)
  2. @@ -337,10 +336,11 @@

    Penalized quasi-likelihood (PQL)glmmPQL() it does not use the -lme() function from package nlme for this, -because the weighting matrix \(\boldsymbol{W}\) is non-diagonal. Instead, -\(q_1\) or \(q_2\) are minimized using the function -nlminb from the standard R package “stats”.

    +lme() function from package nlme (Pinheiro and Bates 2000) for this, because the +weighting matrix \(\boldsymbol{W}\) is +non-diagonal. Instead, \(q_1\) or \(q_2\) are minimized using the function +nlminb from the standard R package “stats” or some +other optimizer chosen by the user.

    @@ -349,7 +349,7 @@

    The Solomon-Cox approximation and

    The Solomon-Cox approximation

    -

    The (first-order) Solomon approximation is based on the quadratic +

    The (first-order) Solomon approximation (Solomon and Cox 1992) is based on the quadratic expansion the integrand

    \[ \ell_{\text{cpl}}(\boldsymbol{y},\boldsymbol{b})\approx @@ -392,13 +392,12 @@

    The Solomon-Cox approximation

    Marginal quasi-likelhood (MQL)

    -

    The resulting estimation technique is very similar to PQL (again, see -breslow.clayton:approximate.inference.glmm for a -discussion). The only difference is the construction of the “working -dependent” variable \(\boldsymbol{y}^*\). With PQL it is +

    The resulting estimation technique is very similar to PQL (again, see Breslow and Clayton 1993 for a +discussion). The only difference is the construction of the +“working dependent” variable \(\boldsymbol{y}^*\). With PQL it is constructed as \[\boldsymbol{y}^* = \boldsymbol{X}\boldsymbol{\alpha} + \boldsymbol{Z}\boldsymbol{b} + -\boldsymbol{W}^{-}(\boldsymbol{y}-\boldsymbol{pi})\] while the +\boldsymbol{W}^{-}(\boldsymbol{y}-\boldsymbol{\pi})\] while the MQL working dependent variable is just

    \[ \boldsymbol{y}^* = \boldsymbol{X}\boldsymbol{\alpha} + @@ -424,6 +423,33 @@

    Marginal quasi-likelhood (MQL)\(\hat{\boldsymbol{\alpha}}\).

+ +
+

References +

+
+
+Breslow, Norman E., and David G. Clayton. 1993. “Approximate +Inference in Generalized Linear Mixed Models.” Journal of the +American Statistical Association 88 (421): 9–25. +
+
+Harville, David A. 1997. Matrix Algebra from a Statistician’s +Perspective. New York: Springer. +
+
+Pinheiro, José C., and Douglas M. Bates. 2000. Mixed-Effects Models +in s and s-PLUS. New York: Springer. https://doi.org/10.1007/b98882. +
+
+Solomon, P. J., and D. R. Cox. 1992. “Nonlinear Component of +Variance Models.” Biometrika 79 (1): 1–11. https://doi.org/10.1093/biomet/79.1.1. +
+
+Venables, W. N., and B. D. Ripley. 2002. Modern Applied Statistics +with s. Fourth. New York: Springer. https://www.stats.ox.ac.uk/pub/MASS4/. +
+
diff --git a/articles/baseline-logit.html b/articles/baseline-logit.html index ce1ee9c..4138130 100644 --- a/articles/baseline-logit.html +++ b/articles/baseline-logit.html @@ -130,14 +130,13 @@

Baseline-category logit models

logistic regression, that allow to model not only binary or dichotomous responses, but also polychotomous responses. In addition, they allow to model responses in the form of counts that have a pre-determined sum. -These models are described in agresti:categorical.data.analysis.2002. Estimating -these models is also supported by the function multinom() -in the R package "nnet" MASS. In the package "mclogit", the function to -estimate these models is called mblogit() (see the relevant -manual page), which uses the -infrastructure for estimating conditional logit models, exploiting the -fact that baseline-category logit models can be re-expressed as -condigional logit models.

+These models are described in Agresti +(2002). Estimating these models is also supported by the function +multinom() in the R package “nnet” (Venables and Ripley 2002). In the package +“mclogit”, the function to estimate these models is called +mblogit(), which uses the infrastructure for estimating +conditional logit models, exploiting the fact that baseline-category +logit models can be re-expressed as condigional logit models.

Baseline-category logit models are constructed as follows. Suppose a categorical dependent variable or response with categories \(j=1,\ldots,q\) is observed for individuals \(i=1,\ldots,n\). Let \(\pi_{ij}\) denote the probability that the @@ -171,11 +170,27 @@

Baseline-category logit models

versus taking the value \(1\). Note that there is one coefficient for each independent variable and each response other than the baseline category.

+
+

References +

+
+
+Agresti, Alan. 2002. Categorical Data Analysis. Second. New +York: Wiley. +
+
+Venables, W. N., and B. D. Ripley. 2002. Modern Applied Statistics +with s. Fourth. New York: Springer. https://www.stats.ox.ac.uk/pub/MASS4/. +
+
+
+ + diff --git a/articles/conditional-logit.html b/articles/conditional-logit.html index 26da999..83fd498 100644 --- a/articles/conditional-logit.html +++ b/articles/conditional-logit.html @@ -129,13 +129,12 @@

Conditional logit models

Conditional logit models are motivated by a variety of considerations, notably as a way to model binary panel data or responses in case-control-studies. The variant supported by the package “mclogit” -is motivated by the analysis of discrete choices and goes back to mcfadden:conditional.logit. -Here, a series of individuals \(i=1,ldots,n\) is observed to have made a -choice (represented by a number \(j\)) -from a choice set \(\mathcal{S}_i\), -the set of alternatives at the individual’s disposal. Each alternatives -\(j\) in the choice set can be -described by the values \(x_{1ij},\ldots,x_{1ij}\) of \(r\) attribute variables (where the +is motivated by the analysis of discrete choices and goes back to McFadden (1974). Here, a series of individuals +\(i=1,\ldots,n\) is observed to have +made a choice (represented by a number \(j\)) from a choice set \(\mathcal{S}_i\), the set of alternatives at +the individual’s disposal. Each alternatives \(j\) in the choice set can be described by +the values \(x_{1ij},\ldots,x_{1ij}\) +of \(r\) attribute variables (where the variables are enumerated as \(i=1,\ldots,r\)). (Note that in contrast to the baseline-category logit model, these values vary between choice alternatives.) Conditional logit models then posit that individual \(i\) chooses alternative \(j\) from his or her choice set \(\mathcal{S}_i\) with probability

@@ -158,19 +157,38 @@

Conditional logit models

Conditional logit models appear more parsimonious than baseline-category logit models in so far as they have only one coefficient for each independent variables.[^1] In the “mclogi" package, -these models can be estimated using the function mclogit() -(see the relevant manual page).

+these models can be estimated using the function +mclogit().

My interest in conditional logit models derives from my research into the influence of parties' political positions on the patterns of voting. Here, the political positions are the attributes of the alternatives and the choice sets are the sets of parties that run candidates in a countries at various points in time. For the application of the -conditional logit models, see my doctoral thesis elff:politische.ideologien.

+conditional logit models, see Elff +(2009).

+
+

References +

+
+
+Elff, Martin. 2009. “Social Divisions, Party Positions, and +Electoral Behaviour.” Electoral Studies 28 (2): 297–308. +https://doi.org/10.1016/j.electstud.2009.02.002. +
+
+McFadden, Daniel. 1974. “Conditional Logit Analysis of Qualitative +Choice Behaviour.” In Frontiers in Econometrics, edited +by Paul Zarembka, 105–42. New York: Academic Press. +
+
+
+ + diff --git a/articles/fitting-mclogit.html b/articles/fitting-mclogit.html index 69160ae..0f2547b 100644 --- a/articles/fitting-mclogit.html +++ b/articles/fitting-mclogit.html @@ -131,8 +131,9 @@

The IWLS algorithm used to fit conditional logit likelihood estimator. It does this by maximizing the log-likelihood function using an iterative weighted least-squares (IWLS) algorithm, which follows the algorithm used by the -glm.fit() function from the “stats” package of -R.

+glm.fit() function from the “stats” package of R +(Nelder and Wedderburn 1972; McCullagh and Nelder +1989; R Core Team 2023).

If \(\pi_{ij}\) is the probability that individual \(i\) chooses alternative \(j\) from his/her choice @@ -202,7 +203,7 @@

The IWLS algorithm used to fit conditional logit \boldsymbol{X}'\boldsymbol{W}\boldsymbol{X} \]

Here \(y_{ij}=n_{ij}/n_{i+}\), while -\(boldsymbol{N}\) is a diagonal matrix +\(\boldsymbol{N}\) is a diagonal matrix with diagonal elements \(n_{i+}\).

Newton-Raphson iterations then take the form

\[ @@ -298,11 +299,34 @@

The IWLS algorithm used to fit conditional logit \]

+
+

References +

+
+
+McCullagh, P., and J. A. Nelder. 1989. Generalized Linear +Models. Monographs on Statistics & Applied Probability. Boca +Raton et al.: Chapman & Hall/CRC.
+
+Nelder, J. A., and R. W. M. Wedderburn. 1972. “Generalized Linear +Models.” Journal of the Royal Statistical Society. Series A +(General) 135 (3): 370–84. https://doi.org/10.2307/2344614. +
+
+R Core Team. 2023. R: A Language and Environment for Statistical +Computing. Vienna, Austria: R Foundation for Statistical Computing. +https://www.R-project.org/. +
+
+
+ + + diff --git a/articles/random-effects.html b/articles/random-effects.html index b2351d0..0425ffe 100644 --- a/articles/random-effects.html +++ b/articles/random-effects.html @@ -142,7 +142,7 @@

Random effects in baseline logit models and was to make it possible to assess the impact of parties’ political positions on the patterns of voting behaviour in various European countries. The results of this research are published in an article in -Electoral Studies elff:divisions.positions.voting.

+Elff (2009).

In its earliest incarnation, the package supported only a very simple random-intercept extension of conditional logit models (or “mixed conditional logit models”, hence the name of the package). These models @@ -183,12 +183,30 @@

Random effects in baseline logit models and PQL-technique based on a (first-order) Laplace approximation was supported, release 0.8, “mclogit” also supports the MQL technique, which is based on a (first-order) Solomon-Cox approximation. The ideas behind -the PQL and MQL techniques are described e.g. in breslow.clayton:approximate.inference.glmm.

+the PQL and MQL techniques are described e.g. in Breslow and Clayton (1993).

+
+

References +

+
+
+Breslow, Norman E., and David G. Clayton. 1993. “Approximate +Inference in Generalized Linear Mixed Models.” Journal of the +American Statistical Association 88 (421): 9–25. +
+
+Elff, Martin. 2009. “Social Divisions, Party Positions, and +Electoral Behaviour.” Electoral Studies 28 (2): 297–308. +https://doi.org/10.1016/j.electstud.2009.02.002. +
+
+
+ + diff --git a/pkgdown.yml b/pkgdown.yml index 1c5bef1..a3d7fff 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -8,7 +8,7 @@ articles: conditional-logit: conditional-logit.html fitting-mclogit: fitting-mclogit.html random-effects: random-effects.html -last_built: 2023-12-27T11:12Z +last_built: 2023-12-27T13:32Z urls: reference: https://melff.github.io/mclogit/reference article: https://melff.github.io/mclogit/articles