Hi Everyone,
I would appreciate your help in solving my problem below:
I have two Linear Mixed Models in the loop
My aim is to write out the estimate of mean difference of either of the two models below where the AIC is smaller but all the mean difference written to text file are from the sub (sub model) even though there are cases where AIC of the full model is smaller.
forvalues i = 1/`r(max)' {
mixed Ct ib1.Time_point if group ==`i' ||_all:R.money || sample: , reml dfmethod(satte) stddeviations dftable(ci) emiter(25)
estimates store full //This stores the first model
mixed Ct ib1.Time_point if group ==`i' || sample: , reml dfmethod(satte) stddeviations dftable(ci) emiter(25)
estimates store sub //This stores the second model
estimates stats full sub
I have set up a loop similar to the one below but all the mean difference written to text file are from the sub (sub model) even though there are cases where AIC of the full model is smaller.
matrix icstat = r(S)
local stat_AIC1 = icstat[1,5]
local stat_AIC2 = icstat[2,5]
if `stat_AIC1' < `stat_AIC2' {
local `stat_AIC1' = icstat[1,5]
*estimate restore full
}
else {
local stat_AIC2 = icstat[2,5]
*estimate restore sub
}
contrast i.Time_point, mcompare(sch)effects
matrix difference = r(table) // difference between mean control(0 hr/time 1) being the base
matrix pvalue = r(table) // p-value
local Mean_Difference1 = difference[1,1]
local pvalue1 = pvalue[4,1]
forvalues j = 1/4 {
Many thanks in anticipation of your support.
I would appreciate your help in solving my problem below:
I have two Linear Mixed Models in the loop
My aim is to write out the estimate of mean difference of either of the two models below where the AIC is smaller but all the mean difference written to text file are from the sub (sub model) even though there are cases where AIC of the full model is smaller.
forvalues i = 1/`r(max)' {
mixed Ct ib1.Time_point if group ==`i' ||_all:R.money || sample: , reml dfmethod(satte) stddeviations dftable(ci) emiter(25)
estimates store full //This stores the first model
mixed Ct ib1.Time_point if group ==`i' || sample: , reml dfmethod(satte) stddeviations dftable(ci) emiter(25)
estimates store sub //This stores the second model
estimates stats full sub
I have set up a loop similar to the one below but all the mean difference written to text file are from the sub (sub model) even though there are cases where AIC of the full model is smaller.
matrix icstat = r(S)
local stat_AIC1 = icstat[1,5]
local stat_AIC2 = icstat[2,5]
if `stat_AIC1' < `stat_AIC2' {
local `stat_AIC1' = icstat[1,5]
*estimate restore full
}
else {
local stat_AIC2 = icstat[2,5]
*estimate restore sub
}
contrast i.Time_point, mcompare(sch)effects
matrix difference = r(table) // difference between mean control(0 hr/time 1) being the base
matrix pvalue = r(table) // p-value
local Mean_Difference1 = difference[1,1]
local pvalue1 = pvalue[4,1]
forvalues j = 1/4 {
Many thanks in anticipation of your support.
Comment