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 π_0 over the simplex S=\{(π^{(1)}, π^{(2)}, π^{(3)})\in[0,1]^3\colon π^{(1)}+π^{(2)}+π^{(3)}=1\}, and a change Δ\in\mathbf{R}^k of covariate values, the confidence region of the probability distribution resulting from the covariate change Δ is computed by means of the Wald statistics \insertCiteseverini2000plot3logit, which should satisfy the following condition \insertCitewooldridge2010plot3logit:
(δ-\hatδ)^\top [(I_2\otimesΔ)^\top\,\hatΞ\,(I_2\otimesΔ)]^{-1} (δ-\hatδ) ≤qχ^2_2(1-α)
where \hatδ=\hat{B}^\topΔ\in\mathbf{R}^2 is the point estimate of change of natural parameters associated to Δ, \hat{B}=[β^{(2)}, β^{(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Ξ\in\mathbf{R}^{2k\times2k} is the covariance matrix of vec(\hat{B}), and finally, χ^2_2(1-α) is the (1-α) quantile of χ^2_2.
The set of points which satisfy the previous inequality with equal sign delimits the border of the confidence region for δ.
If we denote with \mathcal{R}_δ the set of points δ which satisfy the previous inequality, it is possible to obtain the confidence region of the effect of the covariate change Δ over the simplex S as follows:
\mathcal{R}=\{g^≤ftarrow(g(π_0)+δ)\colon δ\in\mathcal{R}_δ\} \subseteq S
where g\colon S\to\mathbf{R}^2 and g^≤ftarrow\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(π)= g([π^{(1)},π^{(2)},π^{(3)}]^\top) =≤ft[\ln\frac{π^{(2)}}{π^{(1)}}\,,\quad\ln\frac{π^{(3)}}{π^{(1)}}\right]^\top
g^≤ftarrow(η)=g^≤ftarrow([η_2,η_3]^\top) =≤ft[ \frac{1}{1+e^{η_2}+e^{η_3}}\,,\quad \frac{e^{η_2}}{1+e^{η_2}+e^{η_3}}\,,\quad \frac{e^{η_3}}{1+e^{η_2}+e^{η_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.