| add_confregions | R Documentation |
Given the confidence level, it computes the confidence regions of the effects
for each arrow of the field3logit or multifield3logit object given in
input. If the field3logit or multifield3logit object already contains the
confidence regions, they will be updated if the value of conf is different.
add_confregions(x, conf = 0.95, npoints = 100)
x |
an object of class |
conf |
confidence level of the regions. |
npoints |
number of points of the borders of the regions. |
Given a reference probability distribution \pi_0 over the simplex
S=\{(\pi^{(1)}, \pi^{(2)}, \pi^{(3)})\in[0,1]^3\colon \pi^{(1)}+\pi^{(2)}+\pi^{(3)}=1\},
and a change \Delta\in\mathbf{R}^k of covariate values, the confidence
region of the probability distribution resulting from the covariate change
\Delta is computed by means of the Wald statistics
\insertCiteseverini2000plot3logit, which should satisfy the following
condition \insertCitewooldridge2010plot3logit:
(\delta-\hat\delta)^\top
[(I_2\otimes\Delta)^\top\,\hat\Xi\,(I_2\otimes\Delta)]^{-1}
(\delta-\hat\delta)
\leq\chi^2_2(1-\alpha)
where \hat\delta=\hat{B}^\top\Delta\in\mathbf{R}^2 is the point
estimate of change of natural parameters associated to \Delta,
\hat{B}=[\beta^{(2)}, \beta^{(3)}]\in\mathbf{R}^{k\times 2} is the
matrix of point estimates of regression coefficients, I_2 is the
identity matrix of order two, \otimes is the Kronecker product,
\hat\Xi\in\mathbf{R}^{2k\times2k} is the covariance matrix of
vec(\hat{B}), and finally, \chi^2_2(1-\alpha) is the
(1-\alpha) quantile of \chi^2_2.
The set of points which satisfy the previous inequality with equal sign
delimits the border of the confidence region for \delta.
If we denote with \mathcal{R}_\delta the set of points \delta
which satisfy the previous inequality, it is possible to obtain the
confidence region of the effect of the covariate change \Delta over the
simplex S as follows:
\mathcal{R}=\{g^\leftarrow(g(\pi_0)+\delta)\colon \delta\in\mathcal{R}_\delta\}
\subseteq S
where g\colon S\to\mathbf{R}^2 and
g^\leftarrow\colon\mathbf{R}^2\to S are respectively the link function
of the trinomial logit model and its inverse. They are defined as follows:
g(\pi)= g([\pi^{(1)},\pi^{(2)},\pi^{(3)}]^\top)
=\left[\ln\frac{\pi^{(2)}}{\pi^{(1)}}\,,\quad\ln\frac{\pi^{(3)}}{\pi^{(1)}}\right]^\top
g^\leftarrow(\eta)=g^\leftarrow([\eta_2,\eta_3]^\top)
=\left[
\frac{1}{1+e^{\eta_2}+e^{\eta_3}}\,,\quad
\frac{e^{\eta_2}}{1+e^{\eta_2}+e^{\eta_3}}\,,\quad
\frac{e^{\eta_3}}{1+e^{\eta_2}+e^{\eta_3}}
\right]^\top\,.
For further details and notation see \insertCitesanti2022;textualplot3logit and \insertCitesanti2019;textualplot3logit.
Object of class field3logit or multifield3logit with updated
confidence regions.
data(cross_1year)
mod0 <- nnet::multinom(employment_sit ~ gender + finalgrade,
data = cross_1year)
field0 <- field3logit(mod0, 'genderFemale')
field0
add_confregions(field0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.