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( lambda_1i, lambda_2i, lambda_3i , D(theta) ) which is equivalent to (Xi,Yi) ~ (1-p)BP( xi, yi| lambda_1i, lambda_2i, lambda_3i ) if xi not equal to yi (Xi,Yi) ~ (1-p)BP( xi, yi| lambda_1i, lambda_2i, lambda_3i )+pD( xi | theta_ ) if xi=yi with log(lambda_1) = w1 beta_, log(lambda_2) = w2 beta_, log(lambda_3) = w3 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/p data matrices containing explanatory variables for lambda_1 and lambda_2 . *** w3 are n/p2 data matrix containing explanatory variables for lambda_3. *** beta_ vector of length p; beta_ is common for lambda_1 and lambda_2 in order to allow for common effects *** beta_3 vector of length p2. *** D(theta) 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-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). |
distribution |
Specifies the type of inflated distribution; ='discrete' : Discrete(J=jmax), ='poisson' : Poisson(theta) ='geometric': Geometric(theta). |
jmax |
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 |
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_3 are additionally printed. |
See bpformulas 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 |
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 theta_i=theta[i] and theta_0 =1-sum(theta_i); for distribution=2, theta is the mean of the Poisson; for distribution=3, theta is is the success probability of the Geometric distribution. |
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.
# # 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