[R] joint estimation of two poisson equations

ryusuke ryusukekenji at hotmail.com
Fri Jun 19 19:03:09 CEST 2009




ryusuke wrote:
> 
> 
> 
> Owen Powell-2 wrote:
>> 
>> Thanks Tirthankar, that did the trick.
>> Here's the solution to my problem using the "bivpois" package:
>> 
>> rm(list = ls())
>> library(bivpois)
>> 
>> y1 = c(1,2,3,4,4,3)
>> y2 = c(0,2,0,2,3,5)
>> x1 = c(2,3,4,8,1,3)
>> x2 = c(3,5,6,7,8,9)
>> d = data.frame(cbind(y1, y2, x))
>> 
>> eq1 = y1 ~ x1 + x2
>> eq2 = y2 ~ x1 + x2
>> 
>> out = lm.pb(eq1, eq2, data = d, zeroL3 = TRUE)
>> print(out)
>> 
>> I couldn't find out how to get standard errors and p-values from the
>> package, so I bootstrapped them.
>> 
>> ~Owen
>> 
>> 2009/4/13 Tirthankar Chakravarty <tirthankar.chakravarty at gmail.com>
>> 
>>> You should probably try the -bivpois- package:
>>> http://cran.r-project.org/web/packages/bivpois/index.html
>>>
>>> A very good discussion of multivariate Poissons, negative binomials
>>> etc. can be found in Chapter 7 of Rainer Winkelmann's book
>>> "Econometric Analysis of Count Data" (Springer 2008). Most of the
>>> likelihoods involved are fairly straightforward.
>>>
>>> T
>>>
>>> On Mon, Apr 13, 2009 at 9:32 AM, Owen Powell <opowell at gmail.com> wrote:
>>> > Dear list members,
>>> >
>>> > Is there a package somewhere for jointly estimating two poisson
>>> processes?
>>> >
>>> > I think the closest I've come is using the "SUR" option in the Zelig
>>> > package (see below), but when I try the "poisson" option instead of
>>> > the "SUR" optioin I get an error (error given below, and indeed,
>>> > reading the documentation of the Zelig package, I get the impression
>>> > "poisson" was not meant to handle a system of equations).
>>> >
>>> > I think I could do it myself by constructing the likelihood function
>>> > and then applying ML, but I'd prefer to avoid doing that unless it's
>>> > entirely necessary.
>>> >
>>> > I'll post my solution to the list when I've worked it out.
>>> >
>>> > Regards,
>>> >
>>> > ~Owen
>>> >
>>> > # CODE FOR "sur" OPTION
>>> > rm(list = ls())
>>> > library(Zelig)
>>> >
>>> > y1 = c(1,2,3,4)
>>> > y2 = c(0,2,0,2)
>>> > x = c(2,3,4,8)
>>> > d = data.frame(cbind(y1, y2, x))
>>> >
>>> > eq1 = y1 ~ x
>>> > eq2 = y2 ~ x
>>> > eqSystem = list (eq1, eq2)
>>> >
>>> > system_out = zelig(formula = eqSystem, model = "sur", data = d)
>>> > summary(system_out)
>>> >
>>> > -----------------------------------------------------------------
>>> >
>>> > # ERROR FROM REPLACING "sur" WITH "poisson"
>>> > Error in switch(mode(x), `NULL` = structure(NULL, class = "formula"), 
>>> :
>>> >  invalid formula
>>> >
>>> > --
>>> > Owen Powell
>>> > http://center.uvt.nl/phd_stud/powell
>>> >
>>> > ______________________________________________
>>> > R-help at r-project.org mailing list
>>> > https://stat.ethz.ch/mailman/listinfo/r-help
>>> > PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> > and provide commented, minimal, self-contained, reproducible code.
>>> >
>>>
>>>
>>>
>>> --
>>> To every ù-consistent recursive class ê of formulae there correspond
>>> recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
>>> belongs to Flg(ê) (where v is the free variable of r).
>>>
>> 
>> 
>> 
>> -- 
>> Owen Powell
>> http://center.uvt.nl/phd_stud/powell
>> 
>> 	[[alternative HTML version deleted]]
>> 
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> 
> 
> I would like to know the bivpois coding and write a same function in VBA
> Excel, anyone gonna good suggestion?
> 
http://www.nabble.com/file/p24115406/%257Ebivpois%257E.txt %7Ebivpois%7E.txt 
-- 
View this message in context: http://www.nabble.com/joint-estimation-of-two-poisson-equations-tp23019442p24115406.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list