[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: xtlogit, clogit, fixed effects?

From   "Anderson, Bradley" <>
To   "" <>
Subject   st: xtlogit, clogit, fixed effects?
Date   Fri, 18 Dec 2009 11:07:45 -0500

I'm working with data in which, for each subject, a dichotomous outcome was assessed many times within each of 4 assessment periods. Example data for subject 1:

id      Outcome Period
1       1               1
1       0               1
1       1               1
1       1               2
1       1               2
1       1               2
1       0               2
1       0               3
1       1               3

The number of observations within each period varies from subject to subject, and within subjects it is not constant across the periods.  I don't care about the ordering of the outcomes within the periods.  I simply want to estimate the likelihood of the outcome being = 1 within any period.  In the model, period is treated as a set of dummy indicators.

I set the panel as:

xtset id

I estimated a fixed effects models using both xtlogit and clogit.  I also estimated a fixed effect model with clogit, vce(robust). Standard errors are only adjusted for within subject clustering on id in the last model.  I'm using Stata 10.1 and there doesn't appear to be any way of adjusting for clustering on id using either xtlogit or xtmelogit. I had intended to compare fixed and random effects models. Questions: I would have assumed that after setting the panel the fixed effects estimators using model based standard errors would have adjusted for clustering within id. I assumed they would be consistent but perhaps not efficient. Am I wrong? They are clearly not the correct standard errors and are not adjusting for within subject clustering. And second, is there anyway to get standard errors adjusted for within subject clustering using either xtlogit or xtmelogit?

-----Original Message-----
From: [] On Behalf Of Martin Weiss
Sent: Friday, December 18, 2009 10:38 AM
Subject: st: AW: Taking mata views of ereturn stats?


To really get used to -mata-, try Kit`s , and of course chapters 13 and 14 of his book In addition, the "Mata Matters"
columns in the SJ,


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Skipper Seabold
Gesendet: Freitag, 18. Dezember 2009 16:28
Betreff: st: Taking mata views of ereturn stats?

Hello all,

I am trying to get used to Stata's mata environment.  I am somewhat familiar with Stata but as far as the matrix operations am more familiar with environments like R, Matlab, or Python, and am having some trouble using Stata in the same way, though I understand that mata is C-like.

For instance, say I want to do something like have a vector of the standard errors that I can access element-wise.  Is there a quick way to go between stata and mata to do this.  Given the following example,

webuse sysdsn1
mlogit insure age male nonwhite

Is there a quick way to get e(V) into a matrix so that I can do element-wise operations like taking the square root of the diagonal?
I was thinking that I could just assign e(V) to a matrix, then take a view on this in mata, but this doesn't seem to be the way that Stata works.  Alternatively, I think I could save e(V) to a datset and load it so that V is the dataset and use st_data or st_view, or I could just program the whole estimator in mata, but this all seems like overkill for something that's seems so natural in other environments.

Any help or pointers to other resources would be appreciated.


*   For searches and help try:

*   For searches and help try:

This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual
or entity to whom they are addressed.  If you are not the intended recipient, you are hereby notified
that any disclosure, copying, distribution or taking of any action in reliance on the information contained in
this e-mail is prohibited.  If you have received this e-mail in error, please notify sender by reply e-mail and
delete this message and any attachment(s) immediately.  Thank you for your consideration in this matter.

*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index