Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Math (10 marks)
data("MathAchieve", package = "MEMSS")
head(MathAchieve)
School Minority Sex SES MathAch MEANSES
1 1224 No Female -1.528 5.876 -0.428
2 1224 No Female -0.588 19.708 -0.428
3 1224 No Male -0.528 20.349 -0.428
4 1224 No Male -0.668 8.781 -0.428
5 1224 No Male -0.158 17.898 -0.428
6 1224 No Male 0.022 4.583 -0.428
From Maindonald and Braun, ch 10 q 5. In the data set MathAchieve (MEMSS package),
the factors Minority (levels yes and no), and the variable SES (socio-economic status) are
clearly fixed effects. Carry out an analysis that treats School as a random effect. Does
it appear that there are substantial differences between schools, or are differences within
schools nearly as big as differences between students from different schools? Write a short
report ( a single page of text plus a few graphs).
Q3: Drugs (20 marks)
The Treatment Episode Data Set – Discharges (TEDS-D) is a national census data system of
annual discharges from substance abuse treatment facilities. TEDS-D provides annual data
on the number and characteristics of persons discharged from public and private substance
abuse treatment programs that receive public funding.
1
table(xSub$SUB1)
(4) MARIJUANA/HASHISH (2) ALCOHOL
188406 97013
(5) HEROIN (7) OTHER OPIATES AND SYNTHETICS
58511 45609
(10) METHAMPHETAMINE (3) COCAINE/CRACK
21606 11333
table(xSub$STFIPS)[1:5]
(1) ALABAMA (2) ALASKA (4) ARIZONA (5) ARKANSAS (6) CALIFORNIA
616 1360 4479 1508 48065
table(xSub$TOWN)[1:2]
ABILENE, TX AKRON, OH
42 1078
Each row of the dataset corresponds to an individual admitted to a drug or alcohol addiction
treatment facility. The variables above are:
• completed is TRUE if the individual in question completed their treatment and FALSE
otherwise.