Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ordered logistic regression using repeated measures

    Hello! I've been digging into this a bit and haven't found too much, so hopefully someone can help me out here.

    I'm running an experiment with two between-participant factors and one within-participants (repeated-measures) factor that has four ordinal outcomes. (All factors have two levels each.) Therefore, I'd want to run an ordered logistic regression to examine the results. However, nothing I can find discusses the use of repeated measures in ordinal logistic regression. Is this possible to do using Stata?

    I've found a somewhat similar situation on this forum here (linked), but it focuses on weighting rather than the design of the model itself.

    Thank you!
    Dear Statalist friends, I have been trying to use xtologit and complex weighting (or simpler weighting) in Stata 13 for a research project. Y is the

  • #2
    Are you looking for something like how to express between and within predictors in commands for multilevel (mixed-effects) ordered-logistic regression? Expressing a categorical between-participants predictor, a within-participants categorical predictor and their interaction seems to work using the standard Stata factor variables notation (see below--I happen to have used the command for ordered-probit, instead of ordered-logistic regression, but the general expression for predictors should work for the latter, too).

    .ÿversionÿ14.0

    .ÿ
    .ÿclearÿ*

    .ÿsetÿmoreÿoff

    .ÿsetÿseedÿ`=date("2015-06-15",ÿ"YMD")'

    .ÿ
    .ÿquietlyÿsetÿobsÿ200

    .ÿgenerateÿintÿpidÿ=ÿ_n

    .ÿgenerateÿdoubleÿpid_uÿ=ÿrnormal()

    .ÿ
    .ÿ//ÿBetween-participant
    .ÿgenerateÿdoubleÿb1ÿ=ÿruniform()

    .ÿgenerateÿbyteÿb2ÿ=ÿmod(_n,ÿ2)

    .ÿ
    .ÿ//ÿWithin-participant
    .ÿforvaluesÿwÿ=ÿ1/3ÿ{
    ÿÿ2.ÿÿÿÿÿÿÿÿÿgenerateÿdoubleÿlat`w'ÿ=ÿpid_uÿ+ÿrnormal()ÿ/ÿ3
    ÿÿ3.ÿ}

    .ÿ
    .ÿquietlyÿreshapeÿlongÿlat,ÿi(pid)ÿj(w)

    .ÿ
    .ÿsummarizeÿlat,ÿmeanonly

    .ÿlocalÿcutÿ=ÿ(r(max)ÿ-ÿr(min))ÿ/ÿ4

    .ÿgenerateÿbyteÿrspÿ=ÿ0

    .ÿforvaluesÿincÿ=ÿ1/3ÿ{
    ÿÿ2.ÿÿÿÿÿÿÿÿÿquietlyÿreplaceÿrspÿ=ÿrspÿ+ÿ1ÿifÿlatÿ>=ÿr(min)ÿ+ÿ`cut'ÿ*ÿ`inc'
    ÿÿ3.ÿ}

    .ÿtabulateÿrsp

    ÿÿÿÿÿÿÿÿrspÿ|ÿÿÿÿÿÿFreq.ÿÿÿÿÿPercentÿÿÿÿÿÿÿÿCum.
    ------------+-----------------------------------
    ÿÿÿÿÿÿÿÿÿÿ0ÿ|ÿÿÿÿÿÿÿÿÿ41ÿÿÿÿÿÿÿÿ6.83ÿÿÿÿÿÿÿÿ6.83
    ÿÿÿÿÿÿÿÿÿÿ1ÿ|ÿÿÿÿÿÿÿÿ227ÿÿÿÿÿÿÿ37.83ÿÿÿÿÿÿÿ44.67
    ÿÿÿÿÿÿÿÿÿÿ2ÿ|ÿÿÿÿÿÿÿÿ263ÿÿÿÿÿÿÿ43.83ÿÿÿÿÿÿÿ88.50
    ÿÿÿÿÿÿÿÿÿÿ3ÿ|ÿÿÿÿÿÿÿÿÿ69ÿÿÿÿÿÿÿ11.50ÿÿÿÿÿÿ100.00
    ------------+-----------------------------------
    ÿÿÿÿÿÿTotalÿ|ÿÿÿÿÿÿÿÿ600ÿÿÿÿÿÿ100.00

    .ÿ
    .ÿ*
    .ÿ*ÿBeginÿhere
    .ÿ*
    .ÿmeoprobitÿrspÿc.b1ÿi.(b2##w)ÿ||ÿpid:ÿ,ÿnolrtestÿnolog

    Mixed-effectsÿoprobitÿregressionÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿÿÿÿÿ=ÿÿÿÿÿÿÿÿ600
    Groupÿvariable:ÿÿÿÿÿÿÿÿÿÿÿÿÿpidÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿgroupsÿÿ=ÿÿÿÿÿÿÿÿ200

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿObsÿperÿgroup:
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿminÿ=ÿÿÿÿÿÿÿÿÿÿ3
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿavgÿ=ÿÿÿÿÿÿÿÿ3.0
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿmaxÿ=ÿÿÿÿÿÿÿÿÿÿ3

    Integrationÿmethod:ÿmvaghermiteÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿIntegrationÿpts.ÿÿ=ÿÿÿÿÿÿÿÿÿÿ7

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWaldÿchi2(6)ÿÿÿÿÿÿ=ÿÿÿÿÿÿ12.65
    Logÿlikelihoodÿ=ÿ-475.37413ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿProbÿ>ÿchi2ÿÿÿÿÿÿÿ=ÿÿÿÿÿ0.0490
    ------------------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿrspÿ|ÿÿÿÿÿÿCoef.ÿÿÿStd.ÿErr.ÿÿÿÿÿÿzÿÿÿÿP>|z|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
    -------------+----------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿb1ÿ|ÿÿÿÿÿ.34397ÿÿÿÿ.867523ÿÿÿÿÿ0.40ÿÿÿ0.692ÿÿÿÿ-1.356344ÿÿÿÿ2.044284
    ÿÿÿÿÿÿÿÿ1.b2ÿ|ÿÿÿ1.069413ÿÿÿ.5306051ÿÿÿÿÿ2.02ÿÿÿ0.044ÿÿÿÿÿ.0294465ÿÿÿÿÿ2.10938
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿÿÿwÿ|
    ÿÿÿÿÿÿÿÿÿÿ2ÿÿ|ÿÿÿ.6967284ÿÿÿ.2383461ÿÿÿÿÿ2.92ÿÿÿ0.003ÿÿÿÿÿ.2295786ÿÿÿÿ1.163878
    ÿÿÿÿÿÿÿÿÿÿ3ÿÿ|ÿÿÿ.1323065ÿÿÿ.2310215ÿÿÿÿÿ0.57ÿÿÿ0.567ÿÿÿÿ-.3204873ÿÿÿÿ.5851002
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿb2#wÿ|
    ÿÿÿÿÿÿÿÿ1ÿ2ÿÿ|ÿÿ-.7008315ÿÿÿ.3301585ÿÿÿÿ-2.12ÿÿÿ0.034ÿÿÿÿÿ-1.34793ÿÿÿ-.0537327
    ÿÿÿÿÿÿÿÿ1ÿ3ÿÿ|ÿÿÿ.0109124ÿÿÿ.3265043ÿÿÿÿÿ0.03ÿÿÿ0.973ÿÿÿÿ-.6290242ÿÿÿÿ.6508491
    -------------+----------------------------------------------------------------
    ÿÿÿÿÿÿÿ/cut1ÿ|ÿÿ-4.190183ÿÿÿ.7007825ÿÿÿÿ-5.98ÿÿÿ0.000ÿÿÿÿ-5.563691ÿÿÿ-2.816674
    ÿÿÿÿÿÿÿ/cut2ÿ|ÿÿÿ.3642193ÿÿÿ.5514603ÿÿÿÿÿ0.66ÿÿÿ0.509ÿÿÿÿÿ-.716623ÿÿÿÿ1.445062
    ÿÿÿÿÿÿÿ/cut3ÿ|ÿÿÿ4.932606ÿÿÿÿ.712132ÿÿÿÿÿ6.93ÿÿÿ0.000ÿÿÿÿÿ3.536852ÿÿÿÿ6.328359
    -------------+----------------------------------------------------------------
    pidÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿvar(_cons)|ÿÿÿ10.59248ÿÿÿ2.651886ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ6.484768ÿÿÿÿ17.30217
    ------------------------------------------------------------------------------

    .ÿ
    .ÿexit

    endÿofÿdo-file


    .


    If you have concerns about the test sizes, you can always simulate under the null.
    Last edited by Joseph Coveney; 14 Jun 2015, 18:43.

    Comment


    • #3
      Thanks! I think that's what I'm looking for; I'm used to the "repeated measures" description of within predictors, but it looks like I can just treat them as random variables (the distinction, or lack thereof, has always been a bit confusing to me). Sadly, I only have Stata 12 at the moment and meologit (as well as meoprobit) were introduced in Stata 14. (Plus, the random-specific version, xtologit, was introduced in Stata 13). Looks like it might be time for an upgrade!

      Comment

      Working...
      X