pblm | R Documentation |
This function allows to fit bivariate additive marginal logistic regression models for nominal, ordinal or mixed nominal/ordinal responses.
pblm(fo1=NULL, fo2=NULL, fo12=NULL, RC.fo=NULL, data, weights=NULL,
type="gg", verbose=FALSE, contrasts=NULL, start=NULL, x=FALSE,
center=FALSE, scale=FALSE, plackett=NULL, ncat1=NULL, ncat2=NULL,
fit=TRUE, proportional=pblm.prop(...), penalty=pblm.penalty(...),
control=pblm.control(...), ...)
fo1 |
a two hand-side formula for the logit(s) of the first response.
Depending on the data structure, the left-hand side can be a
two-column or a multi-column response vector. In the latter case, argument |
fo2 |
a one hand-side formula for the logit(s) of the second response.
If omitted, it will be assumed to be equal to |
fo12 |
a one hand-side formula for the log-odds ratio(s) of the
association between the two responses. If omitted, it will
be assumed to be equal to |
RC.fo |
a Row/Column type formula specifying the association structure. See Details. |
data |
a data frame. |
weights |
An optional vector containing the observed frequencies. |
type |
a two-length string specifying the type of logits to use in the model fit. See Details. |
verbose |
logical. Should information about convergence be printed during model estimation? |
contrasts |
the Row/Column contrasts to be used in |
x |
logical. Should the model matrix used in the fitting process be returned as component of the fitted model? |
center |
logical. Should the covariates be centered with respect their mean before the fit? |
scale |
logical. Should the covariates be scaled with respect their standard deviation before the fit? |
start |
an optional vector of starting values for the coefficients of the non-additive part. |
plackett |
logical. Should a Plackett-based formula be used for the inversion |
ncat1 |
an integer indicating the number of levels of the first response. Mandatory the data is in multicolumn format. See example below. |
ncat2 |
an integer indicating the number of levels of the second response. |
fit |
logical. If TRUE (default), the model will be estimated, otherwise only some objects created prior to estimation will be returned. |
control |
this sets the control parameters for the Fisher-scoring and the inner Newton-Raphson and backfitting algorithms. The default setting is specified by the
|
proportional |
this sets a list of logical vectors specifying which explanatory variables depend on the categories of the responses. The default setting is specified by the |
penalty |
this sets the penalty terms and smoothing parameters for a non-parametric "vertical" smoothing across the categories of the responses. The default setting is specified by the |
... |
further arguments. |
It is possible to fit partial proportional odds models and specify several association
structures like the Goodman's (1979) model (interactions are allowed though these are of
linear type), the Dale's (1986) model and their additive version (Bustami et al., 2001), Enea et al.(2014).
Furthermore, the association structure can also be smoothed by using penalty terms of
polynomial type as those considered in Enea and Attanasio (2015). That allows to enlarge
the range of possible parametrizations of the association structure as an alternative
to the Dale's Row-Column parametrization. Further details on the penalty terms specified through pblm.penalty
can also found in Enea and Lovison (2014).
The algorithm is based on the bivariate version of the model by Glonek and McCullagh (1995), that is by using the multivariate logit transform
\bm{C}'\log(\bm{M}\bm{\pi})=
\bm{\eta}=\bm{X}\bm{\beta}.
Once fo1
has been specified, if fo2
and fo12
are left unspecified,
these are assumed to be equal to fo1
. By default, the function fits a proportional
odds model for ordered responses, in which only the marginal and the association intercepts
are assumed to be category-dependent (Glonek and McCullagh, 1995).
Model formulae using a Row-Column type parametrization, like in the Goodman or the
Dale models, need to be specified by using RC.fo
. The right-hand side of such
formula only recognizes Row
and Col
to specify row and/or column effects.
Covariates must be specified separately by using fo12
. See Examples.
The logits implemented are local; global; continuation;
reverse continuation; (Colombi and Forcina, 2001) and basic.
By using argument type
, several log-odds ratios can be specified, among the
permutations of the local-local type (type="ll"
), local-global ("lg"
),...,
basic-basic (type="bb"
). Furthermore, if the responses are binary, setting
type="ss"
will correspond to classical logit
\pi = \log P(Y=1)/P(Y=0)
for both responses, while other specifications will produce
\log P(Y=0)/P(Y=1)
.
The vector of the starting values must be set in the following order: itercepts of
the first logit; covariates of the first logit; intercepts of the second logit;
covariates of the second logit; association intercepts; association covariates.
For what concerning the additive part, p-slines can be fitted by using pb
and/or pbs
, which are adaptations (reduced versions) of pb
and
pbs
from the gamlss
package, respectively.
A list of components from the model fit. Some of these could be redundant and removed in a
future version of the package. When fit=TRUE
the returned components are:
coef |
a named column vectors of coefficients. |
n |
the total number of observations. |
m |
the number of observed configurations of the responses given covariates (if any). It corresponds to the number of rows of the dataset. |
p |
fitted probability matrix given the observations. |
Y |
the weighted matrix of the responses in multinomial format. |
x |
if requested, the model matrix. |
xx1 , xx2 , xx12 |
vectors, for internal use. |
ynames |
vector with the names of the responses. |
tol |
the accuracy reached at the convergence. |
llp |
the penalized log-likelihood value at the convergence. |
ll |
the log-likelihood value at the convergence. |
devp |
the penalized deviance value at the convergence. |
dev |
the deviance value at the convergence. |
IM |
the estimated Information Matrix at the convergence. |
IMp |
the estimated penalized Information Matrix at the convergence. Its inverse is used to calculate the standard error of estimates. |
convergence |
logical indicating whether convergence criteria were satisfied. |
iter |
the number of iterations performed in the model fitting. |
maxB |
the number of smoothers present in the equation with the maximum number of smoothers.This also represents the number of outer iterations of the backfitting algorithm. |
ncat1 , ncat2 |
the number of levels for the two responses. |
ncat |
this is simply |
weights |
the prior weights, that is the weights initially supplied, a vector of 1s if none were. |
P |
a |
gaic.m |
the penalty per parameter of the generalized AIC initially provided. It is 2 by default. |
lam1 , lam2 , <br /> lam3 , lam4 |
vectors of smoothing parameters initially supplied
with the specification of a penalty term. If not, these are |
opt |
the object returned by |
etasmooth |
the matrix of predicted values for the additive part, |
eta |
the |
fsmooth |
a list of objects initially created by the smoothers (if any),
|
one.smooth |
for internal use. |
df.fix |
the degrees of freedom of the parametric part of the model.
Note that if a penalty term is used by specifying |
df.fix.vect |
for internal use. |
df.smooth |
the degrees of freedom of the additive part of the model (if any), otherwise zero. |
w.res |
a |
W2 |
a |
z |
a ( |
any.smoother |
logical indicating whether smoothers have been used in the model fit. |
Bmat |
list of bases of smoothers used in the model fit (if any), |
wh.eq |
list of logical vectors indicating which terms in the linear predictor are smoothers. |
wh.eq2 |
list of logical vectors indicating which terms in the linear predictor are smoothers. For internal use. |
PBWB |
list of numerical matrices if smoothers are used, |
BWB |
list of numerical matrices if smoothers are used, |
etalist |
list of numerical vectors if smoothers are used. For internal use. |
spec.name |
list of numerical vectors if smoothers are used. For internal use. |
beta.smooth |
list of estimated coefficients for the smoothers (if any), |
n.smoothers |
the number of smoothers used. |
PPmat |
list of penalty matrices for the smoothers multiplied by the smoothing parameters. |
pnl.type |
the type of penalty used. |
xnames |
list of vectors with the names of the covariates. |
prop.smooth |
for internal use. |
GAIC |
the value of the generalized AIC from the fitted model for the specified value of |
ta |
the underlying observed contingency table of the responses, marginally to the covariates. |
set0 |
the parameter setting from |
fo.list |
list of formulas used. |
center |
logical indicating whether argument if the covariates were centered |
scale |
logical indicating whether argument if the covariates were scaled |
type |
the type of logit used. |
plackett |
logical indicating whether the plackett inversion formula was used. |
RC.fo |
the Row-Column formula as specified by the user. |
contrasts |
the Row-Column formula contrasts as specified by the user. |
acc2 |
tolerance to be used for the estimation as specified by the user. |
maxit |
maximum number of Fisher-scoring iterations as specified by the user. |
label1 , label2 |
the names of the two response variables, respectively. |
call |
the matched call from |
Please be sure that the results you get are really what you are "expecting" when using
uncommon specifications of argument type
, mainly those involving an
s
logit type and its combinations with other logits. A part from the binary
case, many of those have been not checked yet in the current version of the package.
The estimation of category-dependent p-splines, as outlined in Enea et al. (2014), is not allowed (work in progress).
Please note that specifying a formula with interaction terms in RC.fo
corresponds to a model with association structure of the type
\alpha + \beta_{r} + \gamma_{c} + \delta_{rc}
.
In the current version of the package, non linear interaction terms of the type
\alpha + \beta_r + \gamma_c + \delta_{1r}\delta_{2c}
,
as considered for example in Lapp et al. (1998), are not implemented here.
Furthermore, unlikely from the Dale's paramaterization, pblm
does not put a minus
sign to covariates.
Marco Enea marco.enea@unipa.it with contribution by Mikis Stasinopoulos and Bob Rigby
Bustami, R., Lesaffre, E., Molenberghs, G., Loos, R., Danckaerts, M. and
Vlietinck, R. 2001. Modelling bivariate ordinal responses smoothly with
examples from ophtalmology and genetics. Statistics in Medicine,
20, 1825-1842.
Colombi, R. and Forcina, A. 2001. Marginal regression models for the
analysis of positive association of ordinal response variables.
Biometrika, 88(4), 1007-1019.
Dale, J. R. (1986) Global Cross-Ratio Models for Bivariate, Discrete,
Ordered Responses. Biometrics, 42(4), 909-917.
Enea, M. and Attanasio, M. 2015. A model for bivariate data with application
to the analysis of university students success. Journal of Applied
Statistics, http://dx.doi.org/10.1080/02664763.2014.998407
Enea, M. and Lovison, G. 2019. A penalized approach for the
bivariate logistic regression model with applications to social
and medical data. Statistical Modelling, 19(5), 467-500.
Enea, M., Stasinopoulos, M., Rigby, R., and Plaia, A. 2014. The pblm package:
semiparametric regression for bivariate categorical responses in R. In
Thomas Kneib, Fabian Sobotka, Jan Fahrenholz, Henriette Irmer (Eds.)
Proceeding of the 29th International Workshop of Statistical Modelling,
Volume 2, 47-50.
Glonek, G. F. V. and McCullagh, P. (1995) Multivariate logistic models.
Journal of the Royal Statistical Society, Series B,
57, 533-546.
Goodman, L. A. (1979). Simple models for the analysis of
cross-classications having ordered categories. Journal of the
American Statistical Association, 74(367), 537-552.
Lapp, K., Molenberghs, G., and Lesaffre, E. (1998) Models for the
association between ordinal variables. Computational Statistics
and Data Analysis, 27, 387-411.
summary.pblm
#NOT RUN
# an artificial example:
set.seed(123)
da <- expand.grid("Y1"=1:3,"Y2"=1:3,"fat1"=0:4,"fat2"=0:1)
da$Freq <- sample(0:20,3*3*5*2,replace=TRUE)
da$x1 <- rnorm(90)
#the bivariate additive proportional-odds model
m2 <- pblm(fo1=cbind(Y1,Y2) ~ fat1 + pb(x1), data=da, weights=Freq)
plot(m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.