Hi!
I'm working with a dataset that includes 82 children, each with data collected at three time points: pre, po1, and po2. My goal is to determine whether the number of prompts given at the pre period can predict the change in emotion scores from pre to po1 and from pre to po2. Additionally, I am considering wsl and age as covariates, which are constant over time.
The regression models have been constructed:
Score_po1=a0+b0*score_pre+b1*prompts+b2*age+b3*wsl +e
Score_po2=a0+b0*score_pre+b1*prompts+b2*age+b3*wsl +e
However, I'm considering whether a random effects model would be more suitable for the data. Initially, I developed a model that looks like this
the output is:
Random-effects GLS regression Number of obs = 240
Group variable: indi_num Number of groups = 80
R-squared: Obs per group:
Within = 0.1044 min = 3
Between = 0.4183 avg = 3.0
Overall = 0.3437 max = 3
Wald chi2(5) = 83.13
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
(Std. err. adjusted for 80 clusters in indi_num)
------------------------------------------------------------------------------
| Robust
CEtotal | Coefficient std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
period |
1 | 1.1375 .3634737 3.13 0.002 .4251046 1.849895
2 | 1.4625 .421989 3.47 0.001 .6354168 2.289583
|
prompt_t1 | -.0938059 .1043262 -0.90 0.369 -.2982815 .1106697
wsl | .1166733 .0174754 6.68 0.000 .0824222 .1509245
age | 1.304953 .2735377 4.77 0.000 .7688289 1.841077
_cons | -10.36433 2.828021 -3.66 0.000 -15.90714 -4.821508
-------------+----------------------------------------------------------------
sigma_u | 2.3870557
sigma_e | 2.2636948
rho | .52650628 (fraction of variance due to u_i)
------------------------------------------------------------------------------
However, the prompts is a time-invariant variable and I don't think this model can estimate what I want.
Then I tried:
The outcome is:
Then I want to compare whether the "coefficient difference" of prompt is significant correlated to the score change from pre to po1. but -margins- can not be used for the interaction including a continuous variable. I also tried
. but I don't think this is a correct approach. The output is:
To sum up, there are two questions:
1. Is a random effect model necessary?
2. If it is, how can I obtain the coefficient for the prompt (a continuous, time-invariant variable) and its significance regarding the score changes from pre to po1 and from pre to po2?
Thank you!
I'm working with a dataset that includes 82 children, each with data collected at three time points: pre, po1, and po2. My goal is to determine whether the number of prompts given at the pre period can predict the change in emotion scores from pre to po1 and from pre to po2. Additionally, I am considering wsl and age as covariates, which are constant over time.
The regression models have been constructed:
Score_po1=a0+b0*score_pre+b1*prompts+b2*age+b3*wsl +e
Score_po2=a0+b0*score_pre+b1*prompts+b2*age+b3*wsl +e
However, I'm considering whether a random effects model would be more suitable for the data. Initially, I developed a model that looks like this
Code:
xtreg CEtotal i.period prompt_t1 wsl age, i(indi_num) re vce(robust)
Random-effects GLS regression Number of obs = 240
Group variable: indi_num Number of groups = 80
R-squared: Obs per group:
Within = 0.1044 min = 3
Between = 0.4183 avg = 3.0
Overall = 0.3437 max = 3
Wald chi2(5) = 83.13
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
(Std. err. adjusted for 80 clusters in indi_num)
------------------------------------------------------------------------------
| Robust
CEtotal | Coefficient std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
period |
1 | 1.1375 .3634737 3.13 0.002 .4251046 1.849895
2 | 1.4625 .421989 3.47 0.001 .6354168 2.289583
|
prompt_t1 | -.0938059 .1043262 -0.90 0.369 -.2982815 .1106697
wsl | .1166733 .0174754 6.68 0.000 .0824222 .1509245
age | 1.304953 .2735377 4.77 0.000 .7688289 1.841077
_cons | -10.36433 2.828021 -3.66 0.000 -15.90714 -4.821508
-------------+----------------------------------------------------------------
sigma_u | 2.3870557
sigma_e | 2.2636948
rho | .52650628 (fraction of variance due to u_i)
------------------------------------------------------------------------------
Then I tried:
Code:
xtreg CEtotal i.period##c.prompt_t1 wsl age, i(indi_num) re vce(robust)
Random-effects GLS regression Number of obs = 240
Group variable: indi_num Number of groups = 80
R-squared: Obs per group:
Within = 0.1377 min = 3
Between = 0.4183 avg = 3.0
Overall = 0.3516 max = 3
Wald chi2(7) = 86.91
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
(Std. err. adjusted for 80 clusters in indi_num)
------------------------------------------------------------------------------------
| Robust
CEtotal | Coefficient std. err. z P>|z| [95% conf. interval]
-------------------+----------------------------------------------------------------
period |
1 | 1.592238 .4144295 3.84 0.000 .779971 2.404505
2 | 1.85533 .4734211 3.92 0.000 .9274419 2.783219
|
prompt_t1 | .0539184 .1135493 0.47 0.635 -.1686342 .276471
|
period#c.prompt_t1 |
1 | -.2377714 .1043024 -2.28 0.023 -.4422003 -.0333425
2 | -.2054014 .0979767 -2.10 0.036 -.3974323 -.0133706
|
wsl | .1166733 .0175506 6.65 0.000 .0822748 .1510718
age | 1.304953 .2747142 4.75 0.000 .766523 1.843383
_cons | -10.64685 2.855855 -3.73 0.000 -16.24422 -5.049477
-------------------+----------------------------------------------------------------
sigma_u | 2.3959142
sigma_e | 2.2354428
rho | .53460734 (fraction of variance due to u_i)
------------------------------------------------------------------------------------
Group variable: indi_num Number of groups = 80
R-squared: Obs per group:
Within = 0.1377 min = 3
Between = 0.4183 avg = 3.0
Overall = 0.3516 max = 3
Wald chi2(7) = 86.91
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
(Std. err. adjusted for 80 clusters in indi_num)
------------------------------------------------------------------------------------
| Robust
CEtotal | Coefficient std. err. z P>|z| [95% conf. interval]
-------------------+----------------------------------------------------------------
period |
1 | 1.592238 .4144295 3.84 0.000 .779971 2.404505
2 | 1.85533 .4734211 3.92 0.000 .9274419 2.783219
|
prompt_t1 | .0539184 .1135493 0.47 0.635 -.1686342 .276471
|
period#c.prompt_t1 |
1 | -.2377714 .1043024 -2.28 0.023 -.4422003 -.0333425
2 | -.2054014 .0979767 -2.10 0.036 -.3974323 -.0133706
|
wsl | .1166733 .0175506 6.65 0.000 .0822748 .1510718
age | 1.304953 .2747142 4.75 0.000 .766523 1.843383
_cons | -10.64685 2.855855 -3.73 0.000 -16.24422 -5.049477
-------------------+----------------------------------------------------------------
sigma_u | 2.3959142
sigma_e | 2.2354428
rho | .53460734 (fraction of variance due to u_i)
------------------------------------------------------------------------------------
Code:
test prompt_t1+1.period#prompt_t1 = prompt_t1
( 1) 1.period#c.prompt_t1 = 0
chi2( 1) = 5.20
Prob > chi2 = 0.0226
chi2( 1) = 5.20
Prob > chi2 = 0.0226
To sum up, there are two questions:
1. Is a random effect model necessary?
2. If it is, how can I obtain the coefficient for the prompt (a continuous, time-invariant variable) and its significance regarding the score changes from pre to po1 and from pre to po2?
Thank you!
Comment