|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: random-effects SROC model in gllamm
>>I would appreciate assistance with a gllamm or xtmelogit code for the model described below for combining multiple 2 by 2 results of a binary diagnostic test with binary reference test outcome:<<<
Coincidentally I set up something like this for my students in categorical data analysis recently. (They had to consider the output since the copy of Stata they have can't actually run this model.) Not sure if it's exactly what you want, but here it is. Uses the classic "betablocker" dataset (see below for plain text of it), modeling the probability of death. This study has 22 2X2 tables.
i indexes study (1... 22)
betablocker_i = 1 for treatment group and 0 for controls
logit(mu_i) = alpha_i0 + alpha_i1*(betablocker_i)
alpha_i0 = alpha_0 + u_i0
alpha_i1 = alpha_1 + u_i1
The u terms are unstructured MVN with mean 0. (It turns out for these data you can restrict things further and here really only need the random intercept.) Hopefully I didn't hatchet the notation here.
This code fits the above model:
xtmelogit death betablocker, || study: betablocker, covariance(unstructured)
I had the data in long form already from Stata 9.2, and didn't rearrange things to use binomial processing, which would definitely be more efficient, though this only takes thirty seconds or so on my Macbook running Stata SE. <shrug> SAS nlmixed lets you use weights, and is therefore quicker. I didn't try GLLAMM.
//need to run expand count on this first since xtmelogit doesn't like frequency weights.
study betablocker death count
1 0 0 36
1 0 1 3
1 1 0 35
1 1 1 3
2 0 0 102
2 0 1 14
2 1 0 107
2 1 1 7
3 0 0 82
3 0 1 11
3 1 0 64
3 1 1 5
4 0 0 1393
4 0 1 127
4 1 0 1431
4 1 1 102
5 0 0 338
5 0 1 27
5 1 0 327
5 1 1 28
6 0 0 46
6 0 1 6
6 1 0 55
6 1 1 4
7 0 0 787
7 0 1 152
7 1 0 847
7 1 1 98
8 0 0 423
8 0 1 48
8 1 0 572
8 1 1 60
9 0 0 245
9 0 1 37
9 1 0 253
9 1 1 25
10 0 0 1733
10 0 1 188
10 1 0 1778
10 1 1 138
11 0 0 531
11 0 1 52
11 1 0 809
11 1 1 64
12 0 0 219
12 0 1 47
12 1 0 218
12 1 1 45
13 0 0 277
13 0 1 16
13 1 0 282
13 1 1 9
14 0 0 838
14 0 1 45
14 1 0 801
14 1 1 57
15 0 0 116
15 0 1 31
15 1 0 129
15 1 1 25
16 0 0 175
16 0 1 38
16 1 0 174
16 1 1 33
17 0 0 110
17 0 1 12
17 1 0 223
17 1 1 28
18 0 0 148
18 0 1 6
18 1 0 143
18 1 1 8
19 0 0 131
19 0 1 3
19 1 0 168
19 1 1 6
20 0 0 178
20 0 1 40
20 1 0 177
20 1 1 32
21 0 0 321
21 0 1 43
21 1 0 364
21 1 1 27
22 0 0 635
22 0 1 39
22 1 0 658
22 1 1 22
<<winmail.dat>>