Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: - xtlogit- and predictnl

 From Ricardo Ovaldia <[email protected]> To [email protected] Subject Re: st: - xtlogit- and predictnl Date Wed, 17 Aug 2011 06:34:43 -0700 (PDT)

```Maarten Buis <[email protected]> suggested that I use -predictnl- to compute OR and CI at specific points in time after -xtlogit- and offer an example of the relevant line:

predictnl or = exp(_b[1.south] + _b[1.south#c.cyear]*cyear), ci(lb ub)

I used a similar syntax:

predictnl or = exp(_b[1.group] + _b[1.group#c.year]*c.year), ci(lb ub) p(pval)

but included the extra optiop -p()- to obtain p-values

Here is a summary of the results:

note: significance levels are with respect to the chi-squared(1) distribution
note: Confidence intervals calculated using Z critical values
OR        95%CI           p-value
5 months      1.50     ( 0.49,  2.52)    0.0036
10 months     1.46     ( 0.78,  2.14)    0.0000
15 months     1.41     ( 0.76,  2.06)    0.0000
20 months     1.37     ( 0.46,  2.27)    0.0031

My question is why do the pvalues and the CI do not agree?
It seems like the CI are incorrect. They are not symmetric in the log-scale.

Thank you,
Ricardo

Ricardo Ovaldia, MS
Statistician
Oklahoma City, OK

--- On Tue, 8/16/11, Maarten Buis <[email protected]> wrote:

> From: Maarten Buis <[email protected]>
> Subject: Re: st: main effect OR when interaction present - xtlogit-
> To: [email protected]
> Date: Tuesday, August 16, 2011, 6:56 AM
> On Tue, Aug 16, 2011 at 12:56 PM,
> Ricardo Ovaldia wrote:
> > So I gather that the best way to show these results is
> to estimate the OR and 95%CI for specific points in time.
>
> That is the whole point of adding an interaction effect
> with time. By
> adding that interaction effect you are saying that you want
> the effect
> of group to change over time. If something changes you
> cannot
> represent it with one number.
>
> >Is there a way to do this easily in Stata?
>
> I guess that in Stata 12 that would be easy with the new
> -contrast-
> and -marginsplot- commands in Stata 12, but as I do not
> that yet I cannot say more.
>
> In Stata 11 you can predict those and their confidence
> interval using
> -predictnl-. After that you create graphs or tables, like:
>
> *------------------ begin example ---------------------
> webuse union, clear
> gen cyear = (year - 70)/10
> xtlogit union age grade i.not_smsa south##c.cyear, or
>
> // compute the odds ratios for each year
> predictnl or = exp(_b[1.south] + _b[1.south#c.cyear]*cyear)
> ///
>           , ci(lb ub)
>
> // you can graph it
> bys year : gen byte mark = _n == 1
> twoway rarea lb ub year if mark || ///
>        line or year if mark,
>      ///
>        legend(off) ytitle(odds
> ratio)
>
> // or display it in a table
> // (or lb ub are constant within year)
> table year, c(mean or mean lb mean ub)
> *------------------------ end example -------------------
> (For more on examples I sent to the Statalist see:
>  http://www.maartenbuis.nl/example_faq )
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
>
> http://www.maartenbuis.nl
> --------------------------
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```