Dear All,
I am writing a small programme to automatize my analysis. Below I report an example that should highlight my problem (however the tests that I am willing to run are a bit more complex. That is why I need a programme to speed things up). Specifically, I have a situation like this:
Then I am going to interact those three regressors with other variables, specifically M1, M2 and M1*M2, one by one. Hence the estimated models are:
Ideally, I would like to write a command like:
I am not sure how to specify the three options above. Is it correct to write the first line of my code as follows?
Then in the development of the programme, I can specify a conditional statement to distinguish the three cases. Initially, I thought to write:
However I guess that in this way Stata will look for variables named 1, 2 or 3, without finding them. I hope I was able to express clearly my problem.
Thanks for your attention.
Dario
I am writing a small programme to automatize my analysis. Below I report an example that should highlight my problem (however the tests that I am willing to run are a bit more complex. That is why I need a programme to speed things up). Specifically, I have a situation like this:
Code:
Y = a + b1*X1 + b2*X2 + b3*X3 + error H0 = b1+b2+b3 = 0
Code:
1) Y = a + b1*X1 + b2*X2 + b3*X3 + b4*X1*M1 + b5*X2*M1 + b6*X3*M1 + error H0: b1 + b2 + b3 + b4 + b5 + b6 = 0 or 2) Y = a + b1*X1 + b2*X2 + b3*X3 + b4*X1*M1 + b5*X2*M1 + b6*X3*M1 + b7*X1*M2 + b8*X2*M2 + b9*X3*M2 + error H0: b1 + b2 + b3 + b4 + b5 + b6 +b7 + b8 + b9 = 0 or 3) Y = a + b1*X1 + b2*X2 + b3*X3 + b4*X1*M1 + b5*X2*M1 + b6*X3*M1 + b7*X1*M2 + b8*X2*M2 + b9*X3*M2 + b10*X1*M1*M2 + b11*X2*M1*M2 + b12*X3*M1*M2 + error H0: b1 + b2 + b3 + b4 + b5 + b6 +b7 + b8 + b9 + b10 + b11 + b12 = 0
Code:
Test on eq. 1 myprogramme X1 X2 X3. interaction(1) Test on eq. 2 myprogramme X1 X2 X3, interaction (2) Test on eq. 3 myprogramme X1 X2 X3, interaction (3)
Code:
syntax varlist(min=3 max=3 numeric), INTeraction(min=1 max=3 )
Code:
syntax varlist(min=3 max=3 numeric), INTeraction(varlist min=1 max=3 numeric)
Thanks for your attention.
Dario
Comment