lm.bp {bivpois} | R Documentation |
Produces a "list" object which gives details regarding the fit of a bivariate Poisson regression model of the form
(Xi,Yi) ~ BP( lambda_{1i}, lambda_{2i}, lambda_{3i} )
with log(lambda_1) = w_1 beta_1 log(lambda_2) = w_2 beta_2 log(lambda_3) = w_3 beta_3
where *** i =1, 2, … , n; n is the sample size *** lambda_1 = ( lambda_{11}, lambda_{12}, … , lambda_{1n} )^T, lambda_2 = ( lambda_{21}, lambda_{22}, … , lambda_{2n} )^T and lambda_3 = ( lambda_{31}, lambda_{32}, … , lambda_{3n} )^T are vectors of length n with the estimated lambda for each observation *** w1, w2 are n times p data matrices containing explanatory variables for lambda_1 and lambda_2. *** w3 is a n times p2 data matrix containing explanatory variables for lambda_3. *** beta_1, beta_2, beta_3 are parameter vectors used in the linear predictors of lambda_1, lambda_2 and lambda_3
lm.bp(x, y, formula1 = y1y2 ~ ., formula2 = y3 ~ 1, data, zeroL3 = FALSE, maxit = 300, pres = 1e-08, print.details = FALSE)
x,y |
names (character objects) of response vectors |
data |
Data frame containing the variables in the model |
formula1 |
Formula type argument specifying the terms used for the linear predictors of lambda_1 and lambda_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 lambda_1 and lambda_2. For details on using formulas see bpformulas . |
formula2 |
Formula type argument specifying the terms used for the linear predictor of lambda_3. The default value fits a model with constant covariance term. |
zeroL3 |
Logical argument controlling whether lambda_3 should be set equal to zero (therefore fits a double Poisson model). |
maxit |
Maximum number of EM steps. Default value is 300 iterations. |
pres |
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 |
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 beta_1, beta_2 and beta_are additionally printed |
See bpformulas.html for help concerning the formulas objects above.
A list object returned with the following variables.
beta |
Estimates of the model parameters for beta_1, beta_2 and beta_3 . When a factor is used then its default set of constraints is used. |
beta1,beta2, beta3 |
Vectors beta_1, beta_2 and beta_3 containing the coefficients involved in the linear predictors of lambda_1 , lambda_2 and lambda_3 respectively. When zeroL3=TRUE then this beta3 is not calculated. |
lambda1, lambda2 |
Vectors of length n containing the estimated lambda_1 and lambda_2 for each observation |
lambda3 |
vector containing the values of lambda_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 lambda_1+lambda_3 and lambda_2+lambda_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 |
1. Dimitris Karlis, Department of Statistics, Athens University of Economics and Business, Athens, Greece, karlis@aueb.gr .
2. Ioannis Ntzoufras, Department of Statistics, Athens University of Economics and Business, Athens, Greece, ntzoufras@aueb.gr .
1. Karlis, D. and Ntzoufras, I. (2004). Bivariate Poisson and Diagonal Inflated Bivariate Poisson Regression Models in S. (submitted). Technical Report, Department of Statistics, 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.
# Fit Double and Bivariate Poisson models () # # Model 2: DblPoisson(l1, l2) ex1.m2<-lm.bp('x','y', y1y2~noncommon, data=ex1.sim, zeroL3=TRUE ) # Model 3: BivPoisson(l1, l2, l3); same as simple.bp(ex1.sim$x, ex1.sim$y) ex1.m3<-lm.bp('x','y', y1y2~noncommon, data=ex1.sim ) # Model 4: DblPoisson (l1=Full, l2=Full) ex1.m4<-lm.bp('x','y', y1y2~., data=ex1.sim, zeroL3=TRUE ) # Model 5: BivPoisson(l1=full, l2=full, l3=constant) ex1.m5<-lm.bp('x','y', y1y2~., data=ex1.sim) # Model 6: DblPois(l1,l2) ex1.m6<-lm.bp('x','y', y1y2~noncommon+z1:noncommon+z3+I(z5*l2), data=ex1.sim, zeroL3=TRUE) # Model 7: BivPois(l1,l2,l3=constant) ex1.m7<-lm.bp('x','y', y1y2~noncommon+z1:noncommon+z3+I(z5*l2), data=ex1.sim) # Model 8: BivPoisson(l1=full, l2=full, l3=full) ex1.m8<-lm.bp('x','y', y1y2~., y3~., data=ex1.sim) # Model 9: BivPoisson(l1=full, l2=full, l3=z1+z2+z3+z4) ex1.m9<-lm.bp('x','y', y1y2~., y3~z1+z2+z3+z4, data=ex1.sim) # Model 10: BivPoisson(l1, l2, l3=full) ex1.m10<-lm.bp('x','y',y1y2~noncommon+z1:noncommon+z3+I(z5*l2), y3~., data=ex1.sim) # Model 11: BivPoisson(l1, l2, l3= z1+z2+z3+z4) ex1.m11<-lm.bp('x','y',y1y2~noncommon+z1:noncommon+z3+I(z5*l2), y3~z1+z2+z3+z4, data=ex1.sim)