[R] Zelig and the "blogit" model

(Ted Harding) Ted.Harding at manchester.ac.uk
Thu Nov 1 23:21:53 CET 2007


It seems no-one was interested in my Zelig query (part
reproduced below)! Anyone out there using Zelig?

I'm most obliged to Thomas Yee for his response to my
query about vglm() in VGAM, confirming what I had begun
to suspect from my experiments that vgam() makes separate
independent fits to the separate response variables on
the LHS of the model formula, i.e. in effect vectorises
a set of separate fits. That was a most helpful clarification.

If there are any Zelig users out there, let me pose a very
specific problem. First, I construct some data: a dataframe
"mydata" with 3 columns -- Y1, Y2, A, where all three are
binary 0/1 variables, Y1 and Y2 are responses, and A is
an explanatory variable.

## Artificial example:
Y1 <- c(rep(0,30),rep(1,15),rep(0,15),rep(1,30))
Y2 <- c(rep(0,10),rep(1,20),rep(0,10),rep(1, 5),
        rep(0,10),rep(1, 5),rep(0,10),rep(1,20))
A  <- rep(c(0,1),each=45)

table(Y1[A==0],Y2[A==0])
#    0  1
# 0 10 20  ##  P(Y1=1|A=0) = 30/45 = 2/3
# 1 10  5  ##  P(Y2=1|A=0) = 25/45 = 5/9
# OR = 1/4 ##  log(OR) = -1.386

table(Y1[A==1],Y2[A==1])
#    0  1 
# 0 10  5  ##  P(Y1=1|A=1) = 15/45 = 1/3
# 1 10 20  ##  P(Y2=1|A=1) = 25/45 = 5/9
# OR =  4  ##  log(OR) = 1.386

mydata<-data.frame(Y1=Y1,Y2=Y2,A=A)


Given this, and given the claim (below) that blogit (with
a very similar claim for bprobit) can model the marginals
P(Y1=1) and P(Y2=1) and also the odds-ratio psi[**] in
terms of explanatory variables, can anyone formulate a
zelig command, for the above dataframe "mydata", which
will produce output from which I can deduce that (as is
summarised above):
[**] or the paramater rho for the "bprobit" model


P(Y1=1|A-0) = 2/3   P(Y2=1|A=0) = 5/9

P(Y2=1|A=1) = 1/3   P(Y2=1|A=1) = 5/9

The log(odds ratio) changes from -1.386 to +1.385
between (A=0) and (A=1)

???


Any takers?

(I see that Zelig makes use of functions in VGAM, so
Thomas Yee's statement about vglm() may imply that
zelig() has the same limitations, and if so can not do
what the documentation says it should be able to do).

On 01-Nov-07 12:11:06, Ted Harding wrote:
> Hi Folks,
> According to the PDF file blogit.pdf in the Zelig
> documentation:
> 
>   "Use the bivariate logistic regression model ["blogit"]
>    if you have two binary dependent variables (Y1,Y2), and
>    and wish to model them jointly as a function of some
>    explanatory variables. Each pair of dependent variables
>    (Yi1,Yi2) has four potential outcomes, (Yi1=1,Yi2=1),
>    (Yi1=1,Yi2=0), (Yi1=0,Yi2=1), and (Yi1=0,Yi2=0). The
>    joint probability for each of these four outcomes is
>    modeled with three systematic components: the marginal
>    Pr(Yi1=1) and Pr(Yi2=1), and the odds ratio psi, which
>    describes the dependence of one marginal on the other.
>    Each of these systematic components may be modeled as
>    functions of (possibly different) sets of explanatory
>    variables."
> 
> I want to do precisely that: Model two joint binary responses
> Y1 and Y2, AND their odds ratio, in terms of explanatory
> variables (categorical as it happens) A and B.
> 
> I cannot make out, from any of the documentation, how to
> formulate this in Zelig. The Zelig documentation does not
> state a comprehensive syntax, and there are no examples
> shown in which this (fitting OR as well as marginals) is
> illustrated.
> [rest snipped]

Best wishes to all,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 01-Nov-07                                       Time: 23:21:47
------------------------------ XFMail ------------------------------



More information about the R-help mailing list