1 / 25

Biostat 201: Winter 10

Biostat 201: Winter 10. Lab Session 3 - Supplement. Assignment 3 - Supplement. Multilevel Example. This slide presentation is an adapted example from UCLA’s Academic Technology Services. http://www.ats.ucla.edu/stat/sas/seminars/sas_mlm/mlm_sas_seminar.htm. The Data.

zuriel
Download Presentation

Biostat 201: Winter 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Biostat 201: Winter 10 Lab Session 3 - Supplement

  2. Assignment 3 - Supplement

  3. Multilevel Example • This slide presentation is an adapted example from UCLA’s Academic Technology Services. • http://www.ats.ucla.edu/stat/sas/seminars/sas_mlm/mlm_sas_seminar.htm

  4. The Data • 7,185 students in 160 schools • Student-level data (level 1): • mathach: student’s math achievement score • ses: student’s socio-economic status (SES) • School-level data (level 2): • school: school ID number • meanses: mean SES of students in that school • sector: 0=public school, 1=catholic school • Note: ses and meanses have been “centered”

  5. Importing the Data • SAS • libname src "C:\Desktop"; • data lab3; set src.hsb12;run; • STATA • cd "C:\Desktop" • insheet using hsb12.csv

  6. Fixed Effects ANOVA • Q: Is there a difference in math achievement scores in schools 1224, 1288, and 1296? • Note: We are interested in only these three schools. • Study design: We randomly sample students within each of these three schools.

  7. Parameterization • Student i in school j • Yij=b0j+sij • School j • b0j =a0j • Combined • School 1: Y=a01+eij • School 2: Y=a02+eij • School 3: Y=a03+eij • Y=b0+b1(school1)+b2(school2)+eij

  8. Code • SAS • proc mixed data=lab3; class school; model mathach = school / s; where school in ("1224","1288","1296");run; • STATA • gen school1=0 if (school==1224 | school==1288 | school==1296) • gen school2=0 if (school==1224 | school==1288 | school==1296) • replace school1=1 if (school==1224 & school1==0) • replace school2=1 if (school==1288 & school2==0) • reg mathach school1 school2 if (school==1224 | school==1288 | school==1296)

  9. Conclusion • Because p=0.0023 for “school”, we conclude that, statistically, the math achievement scores of these three schools are different.

  10. Random Intercept • Q: What is the average math achievement score in schools in California? • Study design: We randomly sample schools in California, then randomly sample the students within each of these schools. • Note: Suppose that the schools in our dataset have been randomly sampled from the schools in California.

  11. Parameterization • Student i in school j • Yij=b0j+eij • A student’s score is the school’s score + the student’s deviation • School j • b0j =a00+t0j • The school’s score is the global score + the school’s deviation • Combined • Yij=(a00+t0j) +eij

  12. Code • SAS • proc mixed data=lab3; class school; model mathach = / s cl; random intercept / sub=school;run; • STATA • xtmixed matchach || school:

  13. Conclusion • We conclude that the average math achievement score of schools in California is 12.64. • The variance between schools is estimated to be 8.61. • The variance between students (or within schools) is estimated to be 39.15.

  14. Random Intercept With a Level 2 Effect • Q: What is the average math achievement score in schools in California adjusting for the school’s SES? • Study design: We randomly sample schools in California, then randomly sample the students within each of these schools. • Note: Suppose that the schools in our dataset have been randomly sampled from the schools in California.

  15. Parameterization • Student i in school j • Yij=b0j+eij • A student’s score is the school’s score + the student’s deviation • School j • b0j =a00+a01(meanses)+t0j • A school’s score is the global score + the school SES effect + the school’s deviation • Combined • Yij=(a00+t0j) +a01(meanses)+eij

  16. Code • SAS • proc mixed data=lab3; class school; model mathach = meanses / s cl ddfm=bw; random intercept / sub=school;run; • STATA • xtmixed mathach meanses || school:

  17. Conclusion • The adjusted average math achievement score of schools in California is 12.65. • A school’s centered SES is positively associated with its match achievement scores (p<0.0001). [can also interpret the slope] • The variance between schools is estimated to be 2.64. • The variance between students is estimated to be 39.16.

  18. Random Intercept With a Level 1 Effect • Q: What is the average math achievement score in schools in California adjusting for the student’s SES? • Study design: We randomly sample schools in California, then randomly sample the students within each of these schools. • Note: Suppose that the schools in our dataset have been randomly sampled from the schools in California.

  19. Parameterization • Student i in school j • Yij=b0j+b1j(cses)+eij • A student’s score is the school’s score + the “school specific” student SES effect + the student’s deviation • School j • b0j =a00+t0j • A school’s score is the global score + the school’s deviation • b1j =a10+t1j • The “school specific” student SES effect is the global student SES effect + the “school specific” student SES effect deviation • Combined • Yij=(a00+t0j) +(a10+t1j)(cses)+eij

  20. First, some data stuff… • The variable “cses” isn’t in our dataset. We have to calculate it • cses = ses – meanses • This gives us the student’s SES in regards to the school’s centered SES. • SAS • data lab3; set lab3; cses = ses - meanses;run; • STATA • gen cses = ses - meanses

  21. Code • SAS • proc mixed data=lab3 covtest; class school; model mathach = cses / s ddfm=bw; random intercept cses / sub=school type=un;run; • STATA • xtmixed mathach cses || school:cses, covariance(unstructured)

  22. Conclusion • The adjusted average math achievement score of schools in California is 12.65. • The student’s SES effect is estimated to be 2.19. • The variance between schools is estimated to be 8.68. • The variance between students is estimated to be 36.70. • The variance of the student SES effect is estimated to be 0.69.

  23. Random Intercept With a Level 1 and 2 Effects • Q: What is the average math achievement scores in schools in California adjusting for the student’s SES and the school’s sector? • Study design: We randomly sample schools in California, then randomly sample the students within each of these schools. • Note: Suppose that the schools in our dataset have been randomly sampled from the schools in California.

  24. Parameterization • Student i in school j • Yij=b0j+b1j(cses)+eij • A student’s score is the school’s score + the “school specific” student SES effect + the student’s deviation • School j • b0j =a00+a01(sector)+t0j • A school’s score is the global score + the sector effect + the school’s deviation • b1j =a10+a11(sector)+t1j • The “school specific” student SES effect is the global student SES effect + the sector effect + the school’s sector effect deviation • Combined • Yij=b0j+b1j(cses)+sijYij=[a00+a01(sector)+t0j]+[a10+a11(sector)+t1j](cses)+eij • Yij=a00+a01(sector)+t0j+a10(cses)+a11(cses*sector)+t1j(cses)+eij • Yij=(a00+t0j)+a01(sector) +(a10+t1j)(cses)+a11(cses*sector)+eij

  25. Code • SAS • proc mixed data=lab3 covtest; class school; model mathach = sector cses cses*sector / s cl ddfm=bw; random intercept cses / sub=school type=un;run; • STATA • gen cses_sector = cses*sector • xtmixed mathach sector cses cses*sector || school:cses, covariance(unstructured)

More Related