lm.dibp{bivpois} |
R Documentation |
Produces a
"list" object which gives details regarding the fit of a bivariate diagonal
inflated Poisson regression model of the form
(Xi,Yi) ~ DIBP( ë1i, ë2i, ë3i , D(è) )
which is equivalent to
(Xi,Yi) ~ |
(1-p)BP( xi,
yi| ë1i, ë2i,
ë3i ) |
if xi¹yi |
(Xi,Yi) ~ |
(1-p)BP( xi,
yi| ë1i, ë2i,
ë3i )+pD( xi |
è ) |
if xi=yi |
with |
log(ë1) = w1 â |
log(ë2) = w2 â |
log(ë3) = w3 â3 |
where
Ø
i =1, 2, … , n; n is the sample size
Ø
ë1 = ( ë11,
ë12, … , ë1n )T, ë2 = ( ë21, ë22, … , ë2n )T and ë3 = ( ë31, ë32, … , ë3n )T are vectors
of length n with the estimated lambda for each observation
Ø
w1, w2 are n´p data matrices containing
explanatory variables for ë1 and ë2 .
Ø
w3 are n´p2 data matrix containing explanatory variables for ë3.
Ø
â vector of length p; â is common for ë1 and ë2 in order to allow for
common effects
Ø
â3 vector of length p2.
Ø
D(è)
is a discrete distribution with parameter vector theta used to inflate
the diagonal
Ø
p is the mixing proportion.
lm.dibp( x, y, formula1=y1y2~., formula2=y3~1, data, zeroL3=FALSE, distribution='discrete', jmax=2, maxit=300, pres=1e-8, print.details=FALSE)
x, y |
names (character
objects) of response vectors. |
data |
Data frame containing the
variables in the model. |
formula1=y1y2~.
|
Formula type argument
specifying the terms used for the linear predictors of ë1
and ë2 . The default value fits a model with all
explanatory variables of the data frame specified in data argument, having different non-equal effects on ë1
and ë2. For details on using formulas see bpformulas.html. |
formula2=y3~1 |
Formula type argument
specifying the terms used for the linear predictor of ë3. The default value fits a model with constant
covariance term. |
zeroL3=FALSE |
Logical argument
controlling whether ë3 should be set equal
to zero (therefore fits a double Poisson model). |
Distribution=’discrete’ |
Specifies the type of inflated distribution;
|
jmax=2 |
Number of parameters
used in $Discrete$ distribution. This argument is not used for the Poisson or
the Geometric distributions are used as for the inflation of the diagonal. |
maxit=300 |
Maximum number of EM
steps. Default value is 300 iterations. |
Pres
=1e-8 |
Precision used in
stopping the EM algorithm. The algorithm stops when the relative
log-likelihood difference is lower than the value of pres. |
print.details=FALSE |
Argument for
controlling the printing details during the iterations of the EM algorithm.
The default is to print only the iteration number, the loglikelihood and its
relative difference from the previous iteration. If print.details=TRUE then the model
parameters â1, â2 and â3 are additionally
printed. |
A list object returned
with the following variables.
beta |
Estimates of the model
parameters for â1, â2 and â3 . When a factor is used then its
default set of constraints is used. |
Beta1,beta2,
beta3 |
Vectors â1, â2 and â3 containing the coefficients
involved in the linear predictors
of ë1
, ë2 and ë3 respectively. When zeroL3=TRUE then this beta3 is not calculated. |
lambda1,
lambda2 |
Vectors of length n
containing the estimated ë1 and ë2 for each observation |
lambda3 |
vector containing the
values of ë3. If zeroL3=TRUE then lambda3 is equal
to zero and is not calculated. |
fitted1,
fitted2 |
Vectors of length n containing the fitted values for
x and y. For the bivariate Poisson model
the fitted values are given by ë1+ë3
and ë2+ë3 respectively. |
loglikelihood |
Maximized
log-likelihood of the fitted model. This is given in a vector form (one value
per iteration).With this vector we can monitor the log-likelihood improvement
and how EM algorithm works. |
AIC,
BIC |
AIC and BIC of the
model. Values are also provided for the double Poisson model and the
saturated model. |
parameters |
Number of parameters |
iterations |
Number of iterations |
diagonal.distribution |
label for the diagonal
inflated distribution used |
P |
mixing proportion |
theta |
Parameter vector of
the diagonal distribution. For distribution=1 then theta has length equal to
jmax with èi=theta[i] and è0 =1-sum(èi); for distribution=2,
theta is the mean of the Poisson; for distribution=3, theta is is the success
probability of the Geometric distribution. |
See bpformulas.html for help concerning the formulas
objects above.
1.
Karlis, D. and Ntzoufras, I. (2004). Bivariate Poisson and Diagonal
Inflated Bivariate Poisson Regression Models in S. (submitted). Technical
Report, Athens University of Economics and Business, Athens, Greece.
2.
Karlis, D. and Ntzoufras, I. (2003). Analysis of Sports Data Using
Bivariate Poisson Models. Journal of the Royal Statistical Society, D,
(Statistician), 52, 381 – 393.
1.
Dimitris Karlis, Department of Statistics, Athens University of
Economics and Business, Athens, Greece, e-mail: karlis@aueb.gr
.
2.
Ioannis Ntzoufras, Department of Statistics, Athens University of
Economics and Business, Athens, Greece, e-mail: ntzoufras@aueb.gr .
#
# formula for lambda1 and lamba2
form1 <- y1y2~noncommon + z1:noncommon + z3 + I(l2*z5)
# formula for lambda3
form2 <- y3~z1+z2+z3+z4
#
# Model 1: BivPois
ex2.m1 <-lm.bp ( 'x', 'y', form1, form2, data=ex2.sim)
# Model 2: Zero Inflated BivPois
ex2.m2 <-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='discrete', jmax=0 )
# Model 3: Diagonal Inflated BivPois with DISCRETE(1) diagonal inflation distribution
ex2.m3 <-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='discrete', jmax=1 )
# Model 4: Diagonal Inflated BivPois with DISCRETE(2) diagonal inflation distribution
ex2.m4 <-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='discrete', jmax=2 )
# Model 5: Diagonal Inflated BivPois with DISCRETE(3) diagonal inflation distribution
ex2.m5 <-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='discrete', jmax=3 )
# Model 6: Diagonal Inflated BivPois with DISCRETE(4) diagonal inflation distribution
ex2.m6 <-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='discrete', jmax=4 )
# Model 7: Diagonal Inflated BivPois with DISCRETE(5) diagonal inflation distribution
ex2.m7 <-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='discrete', jmax=5 )
# Model 8: Diagonal Inflated BivPois with DISCRETE(6) diagonal inflation distribution
ex2.m8 <-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='discrete', jmax=6 )
# Model 9: Diagonal Inflated BivPois with POISSON diagonal inflation distribution
ex2.m9 <-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='poisson' )
# Model 10: Diagonal Inflated BivPois with GEOMETRIC diagonal inflation distribution
ex2.m10<-lm.dibp( 'x', 'y', form1, form2, data=ex2.sim, distribution='geometric' )
#
# printing parameters of model 7
ex2.m7$beta1
ex2.m7$beta2
ex2.m7$beta3
ex2.m7$p
ex2.m7$theta
#
# printing parameters of model 9
ex2.m9$beta1
ex2.m9$beta2
ex2.m9$beta3
ex2.m9$p
ex2.m9$theta