/****************************************************************** Edps/Psych/Stat 587 C.J.Anderson Analyses for computer lab 1 and homework 1 Run "TIMSS_lab1_data.sas" before running this program ******************************************************************/ options nodate nocenter; proc sort data=lab1; by idschool; *ods rtf file='C:\Documents and Settings\cja\My Documents\teaching\hlm\lab-hmwk\ComputerLab1\ComputerLab_Hmwk_1.rtf'; proc means data=lab1 mean n min max std noprint; class idschool; var math ; output out=schmeans mean=grpMmath; run; data clab1; merge lab1 schmeans; by idschool; if _TYPE_=0 then delete; grpCmath = math - grpMmath; OCmath = math - 151.092; run; * (a); proc mixed data=clab1 noclprint covtest method=ML ic; class idschool ; model science = idschool / solution ddfm=satterth; title '(a) Fixed Effects ANOVA'; run; * (b); proc mixed data=clab1 noclprint covtest method=ML ic ; class idschool ; model science = idschool OCmath / solution ddfm=satterth; title '(b) ANCOVA with OCmath as covariate'; run; * (c); proc mixed data=clab1 noclprint covtest method=ML ic; class idschool ; model science = / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(c) Random Effects ANOVA'; run; * (d); proc mixed data=clab1 noclprint covtest method=ML ic ; class idschool ; model science = / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(d) Random intercept w/ no explanatory (null/baseline/empty model)'; run; * (e); proc mixed data=clab1 noclprint covtest method=ML ic; class idschool ; model science = math / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(e) Random intercept with math'; run; * (f); proc mixed data=clab1 noclprint covtest method=ML ic ; class idschool ; model science = OCmath / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(f) Random intercept with OCmath'; run; * (g); proc mixed data=clab1 noclprint covtest method=ML ic; class idschool gender ; model science = grpCmath / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(g) Random intercept with grpCmath '; run; * (h); proc mixed data=clab1 noclprint covtest method=ML ic; class idschool ; model science = grpMmath / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(h) Random intercept with school mean math'; run; * (i); proc mixed data=clab1 noclprint covtest method=ML ic; class idschool ; model science = grpCmath grpMmath / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(i) Random intercept with school centered and school mean math'; run; * (j); proc mixed data=clab1 noclprint covtest method=ML ic; class idschool gender ; model science = grpCmath grpMmath gender grade / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(j) Random intercept with grpCmath grpMmath gender grade '; run; * (k) class grade; proc mixed data=clab1 noclprint covtest method=ML ic; class idschool gender grade gen_short; model science = grpCmath grpMmath gender grade gen_short/ solution ddfm=satterth; random intercept / subject=idschool type=un; title '(k) Random intercept with grpCmath grpMmath gender grade gen_short'; run; * (l); proc mixed data=clab1 noclprint covtest method=ML ic ; class idschool gender gen_short ; model science = grpCmath grpMmath gender grade shortages / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(l) Random intercept with grpCmath grpMmath gender grade gen_short'; run; * (m); proc mixed data=clab1 noclprint covtest method=ML ic; class idschool gender ; model science = grpCmath grpMmath gender grade / solution ddfm=satterth; random intercept / subject=idschool type=un; title '(m) Random intercept with grpCmath grpMmath gender grade (same as (j)'; run;