Hi everyone,

I am new to Stata. I would really appreciate any help you would provide me.

I ran 209 logistic regressions and stored their estimates (E1, E2, ..., E209).
Of 209 models, the 1st one (M1) is the basic model and rest of 208 models have 208 different additional variables (Mn=m1+Xn, X1=0).
Then, I tried to compare the fitness of every model (M2-M208) to M1 and ran multiple likelihood-ratio tests using loop function, but I could not complete.

Here are the commands I used (I am sorry, but I changed the names of variables and estimates):

// I ran 209 logistic regressions (M1, M2, ..., M209) and stored their estimates (E1, E2, ..., E209)
logit m1+X1
estimate store E1
logit m1+X2
estimate store E2
..........
logit m1+X209
estimate store E209
//stored estimates are _est_E1, _est_E2, ...., _est_E209

//Then, I tried to run multiple likelihood-ratio tests using loop functions
. local var "E1-E209"
. foreach x of local var {
2. lrtest E1 "`x'"
3. }

//Then, I got the following error message:
estimation result E1-E209 not found

I could run lrtest individually, and found that lrtest recognized E1, E2, ..., E209, but local only recognized _est_E1, _est_E2, ..., _est_E209.
How can I run the looped likelihood-ratio test in such a case?

I also would like to get a matrix for p-value of each likelihood test to generate a scattered graph of these p-values.
Thus, tried following commands and partially worked (I could generate the empty matrix)
. unab y:_est_E2-_est_E209
. local l:word count `y'
. matrix p = J(`l',1,.)
. matrix rownames p = `y'
. matrix colnames p = "p"
. matlist p
My question is how I can incorporate these commands into loop commands to run multiple likelihood-ratio tests and generate a matrix for p-value of each likelihood test.

Any help will be greatly appreciated.

Thanks in advance,

Yuki