Hei
Could anyone help me with my code as it is not working and I cannot figure out the problem.
I am doing a two level hierarchical model where the first level is individual and second level is school level. I want to see the effect on students achievement, where individual level variables are entered as fixed effects and school level variables as random effects. Unfortunately my model does not work as it gives me an error: cannot compute an improvement -- discontinuous region encountered.
Does anyone know how could I change my code to get it working or would it be very wrong to enter the school level variables into the model as fixed effects?
I am using PISA_2022 dataset and I will copy my code here:
My individual variables are coded as: ST004D01T - 0 if male and 1 if female; IMMIG - 0, 1, 2; ST022Q01TA - 0, 1; LANGTEST_QQQ.y - 0,1.
School level variables: SC001Q01TA (school location) - 0, 1, 2; CLSIZE - 0, 1, 2, 3
Before doing the model I saw that the first level scale W_FSTUWT needs to be recalculated so:
sort CNTSCHID
generate sqw = W_FSTUWT * W_FSTUWT
by CNTSCHID: egen sumw = sum(W_FSTUWT)
by CNTSCHID: egen sumsqw = sum(sqw)
generate pst1s1 = W_FSTUWT*sumw/sumsqw
And then finally my model:
meglm PV1MATH ICTOUT ICTAVSCH ICTAVHOM ICTWKDY ST004D01T i.IMMIG ESCS REPEAT ST022Q01TA LANGTEST_QQQ.y [pweight= pst1s1] || CNTSCHID: i.SC001Q01TA i.CLSIZE, pweight(W_SCHGRNRABWT)
My end goal is to find out if technology has an impact on students achievement so the first 4 variables are PISA own ICT variables. Also as dependent variable I am using the PV1MATH variable.
Could anyone help me with my code as it is not working and I cannot figure out the problem.
I am doing a two level hierarchical model where the first level is individual and second level is school level. I want to see the effect on students achievement, where individual level variables are entered as fixed effects and school level variables as random effects. Unfortunately my model does not work as it gives me an error: cannot compute an improvement -- discontinuous region encountered.
Does anyone know how could I change my code to get it working or would it be very wrong to enter the school level variables into the model as fixed effects?
I am using PISA_2022 dataset and I will copy my code here:
My individual variables are coded as: ST004D01T - 0 if male and 1 if female; IMMIG - 0, 1, 2; ST022Q01TA - 0, 1; LANGTEST_QQQ.y - 0,1.
School level variables: SC001Q01TA (school location) - 0, 1, 2; CLSIZE - 0, 1, 2, 3
Before doing the model I saw that the first level scale W_FSTUWT needs to be recalculated so:
sort CNTSCHID
generate sqw = W_FSTUWT * W_FSTUWT
by CNTSCHID: egen sumw = sum(W_FSTUWT)
by CNTSCHID: egen sumsqw = sum(sqw)
generate pst1s1 = W_FSTUWT*sumw/sumsqw
And then finally my model:
meglm PV1MATH ICTOUT ICTAVSCH ICTAVHOM ICTWKDY ST004D01T i.IMMIG ESCS REPEAT ST022Q01TA LANGTEST_QQQ.y [pweight= pst1s1] || CNTSCHID: i.SC001Q01TA i.CLSIZE, pweight(W_SCHGRNRABWT)
My end goal is to find out if technology has an impact on students achievement so the first 4 variables are PISA own ICT variables. Also as dependent variable I am using the PV1MATH variable.
Comment