autocorrelation problem in within-between random effect model
-
- Posts: 7
- Joined: Fri Jun 07, 2019 3:06 pm
autocorrelation problem in within-between random effect model
Hi. I have a trouble about serial correlation problem in multilevel within-between RE model. I've been trying to analyze a relationship between the level of corruption (I use Corruption Perception Index, which is a continuous variable between 0 and 100) and the independence of a governmental institution specialized in corruption crime in each country (the value takes somewhere between 0 and 1, and I take it as a continuous variable) with several controls. The data I am dealing with is a panel data with maximum 23 years (but 14 years on average) and 46 countries.
First of all, Hausman test indicates that there is a systematic difference between within- and between-effect, which implies FE model would be a better choice than RE model. However, considering that the independent variable of my interest (independence of an governmental institution) is hardly time variant, employment of FE model would result in losing a lot of information and over interpretation. Hence I would like to use multilevel model (within-between RE).
However, a problem arises when taking into account that the level of corruption has a pretty high serial correlation. As inclusion of lagged dependent variables in RE model is problematic, I wonder how I can solve this serial correlation problem. Some people say clustering (robust) standard error would solve the serial correlation problem especially with a large N small t panel data (which is my case). Could this argument be applied to multilevel model (within-between RE) and "runmlwin" command? If not, is there any way I can solve the autocorreleation problem?
Many thanks,
Umito
First of all, Hausman test indicates that there is a systematic difference between within- and between-effect, which implies FE model would be a better choice than RE model. However, considering that the independent variable of my interest (independence of an governmental institution) is hardly time variant, employment of FE model would result in losing a lot of information and over interpretation. Hence I would like to use multilevel model (within-between RE).
However, a problem arises when taking into account that the level of corruption has a pretty high serial correlation. As inclusion of lagged dependent variables in RE model is problematic, I wonder how I can solve this serial correlation problem. Some people say clustering (robust) standard error would solve the serial correlation problem especially with a large N small t panel data (which is my case). Could this argument be applied to multilevel model (within-between RE) and "runmlwin" command? If not, is there any way I can solve the autocorreleation problem?
Many thanks,
Umito
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: autocorrelation problem in within-between random effect model
Dear umitotakao,
You can specify cluster robust standard errors in runmlwin
See the fpsandwich option
Note. If you wish to exclude the random effect from the model then you will need to constrain this parameter to zero, otherwise MLwiN won't know what the clusters are.
Best wishes
George
You can specify cluster robust standard errors in runmlwin
See the fpsandwich option
Note. If you wish to exclude the random effect from the model then you will need to constrain this parameter to zero, otherwise MLwiN won't know what the clusters are.
Best wishes
George
-
- Posts: 7
- Joined: Fri Jun 07, 2019 3:06 pm
Re: autocorrelation problem in within-between random effect model
Dear George,
Thank you so much for your reply. I would like to ask further about the usage of command.
Without consideration of autocorrelation, the command is something like
runmlwin cpi cons ACAind_lag1w gdpcapitaw fhousesumw ///
britcolonyw fedstatesw ACAind_lag1_mean cgdppc_mean cfhousesum_mean ///
cbritcolony_mean cfedstates_mean, level2(cntrynum: cons, residuals(u)) ///
level1(year: cons) nopause rigls
where cpi is the dependent variable, ACAind_lag1 is a independent variable of my interest, and others are controls. Also, variables with "w" in the end aggregate the within effect and those with "mean" aggregate the between effect.
If there is autocorrelation problem, does the addition to "fpsandwich" at the end of the command would solve it?
I'm sorry if it is a basic question, but I really appreciate your help.
Regards,
Umito
Thank you so much for your reply. I would like to ask further about the usage of command.
Without consideration of autocorrelation, the command is something like
runmlwin cpi cons ACAind_lag1w gdpcapitaw fhousesumw ///
britcolonyw fedstatesw ACAind_lag1_mean cgdppc_mean cfhousesum_mean ///
cbritcolony_mean cfedstates_mean, level2(cntrynum: cons, residuals(u)) ///
level1(year: cons) nopause rigls
where cpi is the dependent variable, ACAind_lag1 is a independent variable of my interest, and others are controls. Also, variables with "w" in the end aggregate the within effect and those with "mean" aggregate the between effect.
If there is autocorrelation problem, does the addition to "fpsandwich" at the end of the command would solve it?
I'm sorry if it is a basic question, but I really appreciate your help.
Regards,
Umito
-
- Posts: 7
- Joined: Fri Jun 07, 2019 3:06 pm
Re: autocorrelation problem in within-between random effect model
(Update)
I tried the fpsandwich option, but it seems like fpsandwich doesn't work while rpsandwich works.
I would really appreciate it if you could give me an insight about why it doesn't work (or why rpsandwich works)
Regards,
Umito
I tried the fpsandwich option, but it seems like fpsandwich doesn't work while rpsandwich works.
I would really appreciate it if you could give me an insight about why it doesn't work (or why rpsandwich works)
Regards,
Umito
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: autocorrelation problem in within-between random effect model
Could you provide more details on how the fpsandwich option isn't working for you (i.e. do you get an error/wrong results/etc)? You will need to specify both fpsandwich and rpsandwich if you want robust standard errors for both the fixed and random parts of your model.
-
- Posts: 7
- Joined: Fri Jun 07, 2019 3:06 pm
Re: autocorrelation problem in within-between random effect model
Dear Chris,
When I ran a model with fpsandwich, I got an error saying " r(198) The model did not run properly in MLwiN. Re-run the model without the nopause option to debug the model in MLwiN".
And then when I followed the instruction and ran without nopause option, I got the an error saying "r(198) The model did not run properly in MLwiN. You most likely clicked the 'Abort Macro' button in MLwiN, rather than the 'Resume Macro' button", even though I clicked "Resume Macro" button.
The base model is
runmlwin cpi cons ACAind_lag1w gdpcapitaw fhousesumw ///
britcolonyw fedstatesw ACAind_lag1_mean cgdppc_mean cfhousesum_mean ///
cbritcolony_mean cfedstates_mean, level2(cntrynum: cons, residuals(u)) ///
level1(year: cons) nopause rigls
where cpi is the dependent variable, ACAind_lag1 is a independent variable of my interest, and others are controls. Also, variables with "w" in the end aggregate the within effect and those with "mean" aggregate the between effect.
The error message appeared when I included "fpsandwich" or "fpsandwich rpsandwich" at the end. When I didn't include fpsandwich (e.g. when I included rpsandwich alone), the model worked.
Regards,
Umito
When I ran a model with fpsandwich, I got an error saying " r(198) The model did not run properly in MLwiN. Re-run the model without the nopause option to debug the model in MLwiN".
And then when I followed the instruction and ran without nopause option, I got the an error saying "r(198) The model did not run properly in MLwiN. You most likely clicked the 'Abort Macro' button in MLwiN, rather than the 'Resume Macro' button", even though I clicked "Resume Macro" button.
The base model is
runmlwin cpi cons ACAind_lag1w gdpcapitaw fhousesumw ///
britcolonyw fedstatesw ACAind_lag1_mean cgdppc_mean cfhousesum_mean ///
cbritcolony_mean cfedstates_mean, level2(cntrynum: cons, residuals(u)) ///
level1(year: cons) nopause rigls
where cpi is the dependent variable, ACAind_lag1 is a independent variable of my interest, and others are controls. Also, variables with "w" in the end aggregate the within effect and those with "mean" aggregate the between effect.
The error message appeared when I included "fpsandwich" or "fpsandwich rpsandwich" at the end. When I didn't include fpsandwich (e.g. when I included rpsandwich alone), the model worked.
Regards,
Umito
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: autocorrelation problem in within-between random effect model
Have you tried running with the nopause option removed to see whether there are any errors reported within MLwiN? Could you try running the command with the showfullmacro option and report the contents of the MLwiN script that it displays so that we can check whether there is anything obviously wrong with the generated code?
-
- Posts: 7
- Joined: Fri Jun 07, 2019 3:06 pm
Re: autocorrelation problem in within-between random effect model
Yes, I have tried to run the command without nopause option.
When I did it, MLwiN showed
y~N(XB, Ω)
y=B0x0
(0 of 0 cases in use)
And immediately showed full equation and cases in use. Then when I pushed Resume Macro, I got an error saying "The model did not run properly in MLwiN. You most likely clicked the 'Abort Macro' button in MLwiN, rather than the 'Resume Macro' button.", which was not true.
Again, there is no problem in command without fpsandwich option, but it happens only when I include fpsandwich option.
Also, when I included showfullmacro option to the command, I got an error saying option showfullmacro not allowed, and I could not find the showfullmacro option on help runmlwin. What can I do instead?
When I did it, MLwiN showed
y~N(XB, Ω)
y=B0x0
(0 of 0 cases in use)
And immediately showed full equation and cases in use. Then when I pushed Resume Macro, I got an error saying "The model did not run properly in MLwiN. You most likely clicked the 'Abort Macro' button in MLwiN, rather than the 'Resume Macro' button.", which was not true.
Again, there is no problem in command without fpsandwich option, but it happens only when I include fpsandwich option.
Also, when I included showfullmacro option to the command, I got an error saying option showfullmacro not allowed, and I could not find the showfullmacro option on help runmlwin. What can I do instead?
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: autocorrelation problem in within-between random effect model
Sorry, I mis-remembered the option. It should be viewfullmacro.
If the equation output is saying (0 of 0 cases in use) then there is likely to be a problem as this indicates that there is no data for the program to work on. Can you check the Data Manipulation->Names window within MLwiN to ensure that the expected variables are present and the correct length. Could you also check the column in this window labelled missing to see whether any values are being interpreted as missing?
If the equation output is saying (0 of 0 cases in use) then there is likely to be a problem as this indicates that there is no data for the program to work on. Can you check the Data Manipulation->Names window within MLwiN to ensure that the expected variables are present and the correct length. Could you also check the column in this window labelled missing to see whether any values are being interpreted as missing?
-
- Posts: 7
- Joined: Fri Jun 07, 2019 3:06 pm
Re: autocorrelation problem in within-between random effect model
The result of viewfullmacro is below:
Also, I checked the variables and missing data, but there was nothing wrong with variables and so was missing values.
Code: Select all
NOTE ***********************************************************************
NOTE MLwiN macro created by runmlwin Stata command: 15 Jun 2019, 17:28:20
NOTE See: www.bristol.ac.uk/cmm/runmlwin for help
NOTE ***********************************************************************
NOTE Initialise MLwiN storage
INIT 3 10000 1500 10 30
OPTS 0
NOTE Don't use worksheet for matrix storage
MEMS 1
MONI 0
MARK 0
NOTE Open the equations window
WSET 15 1
EXPA 2
ESTM 1
NOTE Import the Stata data set into MLwiN
RSTA 'C:\Users\uminc\AppData\Local\Temp\ST_01000002.tmp'
NOTE Specify the response variable(s)
RESP 'cpi'
PAUS 1
NOTE Specify the level identifier(s)
IDEN 2 'cntrynum'
IDEN 1 'year'
PAUS 1
NOTE Specify covariate(s) used anywhere in the model
ADDT 'cons'
ADDT 'ACAind_lag1w'
ADDT 'gdppcw'
ADDT 'fhousesumw'
ADDT 'ACAind_lag1_mean'
ADDT 'cgdppc_mean'
ADDT 'cfhousesum_mean'
ADDT 'cbritcolony_mean'
ADDT 'cfedstates_mean'
PAUS 1
NOTE Specify level 2 random part covariate(s)
SETV 2 'cons'
PAUS 1
NOTE Specify level 1 random part covariate(s)
SETV 1 'cons'
PAUS 1
NOTE Set estimation method to be RIGLS
METH 0
NOTE Turn on sandwich estimators for the fixed part parameter standard errors
FSDE 2
NOTE Turn on sandwich estimators for the random part parameter standard errors
RSDE 2
NOTE Pause the macro to allow the user to examine the model specification
PAUS
NOTE Fit the model
STAR
ESTM 2
PAUS 1
BATC 1
NEXT
MONI 1
ITNU 0 b21
CONV b22
PAUS 1
NOTE Store level 2 residuals
LINK 0 G21
LINK 0 G22
LINK 0 G23
LINK 0 G24
LINK 0 G25
LINK 0 G26
LINK 0 G27
LINK 0 G28
LINK 0 G29
LINK 0 G30
LINK 1 G21
FILL G21
LINK 1 G22
FILL G22
NAME G21[1] 'u0'
DESC G21[1] 'u0 residual estimate'
NAME G22[1] 'u0se'
DESC G22[1] 'u0se residual standard error'
RFUN
ROUT G21 G22
RLEV 2
RCOV 1
RTYP 1
RESI
CALC G22[1] = sqrt(G22[1])
LINK 1 G30
NOBS 2 b30 b31
GENE 1 b30 1 G30[1]
NAME G30[1] '_residualid'
LINK 4 G29
COMB 'cntrynum' G29[4]
TAKE G29[4] 'cntrynum' G29[3] G29[2]
ERAS G29[3] G29[4]
UNIQ 'cntrynum' G29[2]
NAME 'cntrynum' '_cntrynum'
NAME G29[2] 'cntrynum'
DESC G29[2] '\cntry'
PSTA 'C:\Users\uminc\AppData\Local\Temp\ST_01000004.tmp' '_residualid' 'cntrynum' G21 G22 G23
> G24 G25 G26 G27 G28
ERAS '_residualid' G21 G22 G23 G24 G25 G26 G27 G28 G29
LINK 0 G21
LINK 0 G22
LINK 0 G23
LINK 0 G24
LINK 0 G25
LINK 0 G26
LINK 0 G27
LINK 0 G28
LINK 0 G29
NAME '_cntrynum' 'cntrynum'
NOTE Pause the macro to allow the user to examine the model results
PAUS
NOTE ***********************************************************************
NOTE ***********************************************************************
NOTE Export the model results to Stata
NOTE ***********************************************************************
LINK 1 G30
NAME G30[1] '_Stats'
LIKE b100
EDIT 3 G30[1] b100
EDIT 7 G30[1] b21
EDIT 8 G30[1] b22
NAME c1098 '_FP_b'
NAME c1099 '_FP_v'
NAME c1096 '_RP_b'
NAME c1097 '_RP_v'
NAME c1094 '_esample'
SUM '_esample' b1
EDIT 9 G30[1] b1
PSTA 'C:\Users\uminc\AppData\Local\Temp\ST_01000006.tmp' '_FP_b' '_FP_v' '_RP_b' '_RP_v' '_S
> tats'
ERAS '_Stats'
LINK 0 G30
NOTE generate esample for Stata if there a missing values
SWIT b1
CASE 0:
LEAVE
CASE:
CALC '_esample' = abso('_esample' - 1)
PSTA 'C:\Users\uminc\AppData\Local\Temp\ST_01000007.tmp' '__000000' '_esample'
ENDS
EXIT