Let's say I am interested in measuring the effect of three different types of interventions on test scores. Let's say the intervention is book quality, of which there are three kinds of book quality (poor quality, good quality, highest quality). There's also a number of demographic characteristics that my population can further be subdivided into (whites vs blacks, poor vs non poor, male vs female).

I want to see if mean effect of book quality on test scores is different for different races, economic status, and sex.

Let's say I'm interested first in the race question: My idea was to first construct a t-test for the difference in means for Whites for two categories of textbook type (poor and good quality), then construct an additional t-test for the difference in means for Blacks. I then subtract those differences and divide by the square root of the sum of their standard errors squared.

This was my strategy in R (forgive the bad code):

whites <- subset(data, data$race == "white" & data$textbook != "highest quality" )
whiteTable<- describeBy(whites$testScore, whites$textbook, mat=TRUE)
numeratorWhites <- whiteTable[, "mean"][1] - whiteTable[, "mean"][2]
standardErrorWhite <- (whiteTable[, "se"][1]^2 + whiteTable[, "se"][2]^2)

So I'm manually constructing a t-test. numeratorWhites contains the difference in mean Test Score for Whites for two possible textbook categories (poor and good). I do the same for blacks:

black <- subset(data, data$race == "black" & data$textbook != "highest quality" )
blackTable<- describeBy(black$testScore, black$textbook, mat=TRUE)
numeratorblack <- blackTable[, "mean"][1] - blackTable[, "mean"][2]
standardErrorWhite <- (blackTable[, "se"][1]^2 + blackTable[, "se"][2]^2)

I then calculate another t-value for the difference between whites and blacks like this:

(numeratorWhites - numeratorBlacks) / sqrt(standardErrorWhite + standardErrorBlack)

The issue with this strategy is that it's extremely time consuming and I still do not know if there's a racial difference in the effect between different permutations of textbook quality such as (good and highest) and (highest and poor). Is there a more straightforward statistical way to do this in R?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.