Announcement

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

  • How to set up a multivariate (=multi-response) multilevel model?

    Hello Statasticians,

    I have repeated measures of an outcome (response to a drug) that I want to predict by a time-invariant predictor (some EEG parameter). The repeated measures are indexed by the variable “repetition” and have been taken at roughly monthly intervals.

    Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input byte(id repetition medresponse) float eegpredictor
      1 1 . 13.438
      1 2 2 13.438
      1 3 1 13.438
      1 4 1 13.438
      1 5 1 13.438
      2 1 3 16.175
      2 2 . 16.175
      2 3 . 16.175
      2 4 3 16.175
      2 5 0 16.175
      2 6 3 16.175
      3 1 .   .612
      3 2 .   .612
      3 3 1   .612
      3 4 1   .612
      3 5 2   .612
      3 6 1   .612
      end


    I want to include information about the variation in the outcome, that’s why I thought of using a multilevel model.

    Questions:

    A) What model would you recommend for my purposes?
    B) Assuming multilevel is a good choice, how do I set up the data and what would be the command syntax to use?

    Background: I’ve found some advice by Tabachnik & Fidell (section 15.5.5, p. 821) saying that I need to dummy-code the different repeats of the outcome and then use this as my level-1 predictor, but I’m not quite sure how to set up the data for it.

    Thanks,
    Alex

    Reference: Tabachnik BG, Fidell LS. Using multivariate statistics. Pearson Education, Inc. 5th ed. Boston; 2007.


  • #2
    I think I was confused when I posted this. I don't have different outcome types, so I can just go with a regular (univariate) multilevel model. Deleting the post seems not possible, though...

    Comment


    • #3
      You might want to look into meologit. Keep in mind that the estimation command is large-sample (it expects many IDs). You've also got a lot of missing data.

      If your scientific interest lies in assessing predictor strength (of the value of your electroencephalographic whatever for the monthly median drug response category), then, as a first pass, you might just want to take an average and standard deviation of your monthly drug-response medians by animal (or patient), and fit a variance-weighted least squares linear regression to see whether it's worthwhile to pursue anything more involved.

      Code:
      version 14.1
      
      clear *
      set more off
      
      input byte(aid month response) float eeg
        1 1 . 13.438
        1 2 2 13.438
        1 3 1 13.438
        1 4 1 13.438
        1 5 1 13.438
        2 1 3 16.175
        2 2 . 16.175
        2 3 . 16.175
        2 4 3 16.175
        2 5 0 16.175
        2 6 3 16.175
        3 1 .   .612
        3 2 .   .612
        3 3 1   .612
        3 4 1   .612
        3 5 2   .612
        3 6 1   .612
      end
      
      collapse (mean) mean = response (sd) sd = response, by(eeg) // Assumes no two animals share an EEG thingy value to three decimal places
      
      generate float iv = 1 / sd / sd
      graph twoway scatter mean eeg [aweight=iv], mcolor(black) msymbol(circle_hollow) ///
          ytitle(Mean Monthly Median Drug Response Category Mouthful) ylabel(0(1)3, angle(horizontal) nogrid) ///
          xtitle(Pretreatment EEG Thingy)
      // But see http://www.stata.com/statalist/archive/2008-07/msg01143.html
      
      vwls mean c.eeg, sd(sd)
      
      exit

      Comment

      Working...
      X