Supplemental Materials
The Cultural Fairness of the 12-Item General Health Questionnaire Among Diverse Adolescents
by A. Bowe, 2016, Psychological Assessment
MPLUS 7.0 Testing for Configural Invariance
TITLE:
test for configural invariance
DATA:
FILE IS C:\Name.dat;
FORMAT IS free;
VARIABLE:
NAMES ARE id clus w2 sex ethnic c1-c12;
MISSING ARE all (-99);
CATEGORICAL ARE c1 - c12;
idvariable are id;
cluster = clus;
weight = w2;
usevariables are c1 - c12;
useobservations ARE (ethnic < 8);!if i want to pick ethnic groups
Grouping IS ethnic (1 = W 2 = M 3 = I 4 = P 5 = B 6 = C 7 = A );
ANALYSIS:
Estimator = ML; type = complex mgroup ; !By default it did WLSMV
MODEL is configural; !for confirmatory analysis in CFA framework
!Baseline model
MODEL:
PoorHealth BY c1- c12;
c2 c5 c6 c9 c10 c11 WITH c2 c5 c6 c9 c10 c11;
OUTPUT: standardized MODINDICES (ALL 3.84);
Savedata:
File="Name.xls";
R Syntax: DIF ANALYSIS
#Read data in#
#evoke lordif package
library(lordif)
data.mental<-read.table("FILE.dat", header = TRUE, na.strings = c("-99"))
#changes ethnicity to factor format from vector of integers
data.mental$Race.c<-factor(data.mental$Race, labels=c("White","Mixed","Indian","Pakistani",
"Bangladeshi", "Caribbean", "African", "Other"))
##### drop the OTHER category
data.mental<-subset(data.mental, Race <8)
dim(data.mental)
data.mental$Race.c<-factor(data.mental$Race.c)
str(data.mental$Race.c)
#Create matrix for response variable
Resp<-data.mental[c(6:17)]
Resp<-as.matrix(Resp)
is.matrix(Resp)
#Create FACTOR vector for categorical variable
Ethnicity<-data.mental[18] ##this grabs the column of groups. The grabbing puts it back into list form
Ethnicity<-unlist(Ethnicity) ## unlist changes it to factor format
is.factor(Ethnicity) ## this checks to make sure is really is a factor
dim(Ethnicity);dim(Resp)
summary(Resp);summary(Ethnicity)
ethnicDIF<-lordif(Resp, Ethnicity, criterion = "Chisqr", alpha = 0.05/77, minCell = 5)
# bonferonni correction of .05/11*7
print(ethnicDIF)
summary(ethnicDIF)
par(mfrow=c(3,2),pty="s")
plot(ethnicDIF, labels = c("White", "Mixed","Indian","Pakis","Bang", "Caribbean", "African"))
## Error messages. Consulted with author of package and completed the syntax below###
______
### Do with 2 groups at a time, because 7 couldn't run###
#### Carib and African #################
Carib<-subset(data.mental, Race == 6)
African<-subset(data.mental, Race == 7)
Black<-rbind(Carib,African)
dim(Black)
summary(Black)
Black$Race.c<-factor(Black$Race.c) # this drops the factor levels that are no longer there.
#Needed to run lordif
#Create matrix for response variable
Resp<-Black[c(6:17)]
Resp<-as.matrix(Resp)
is.matrix(Resp)
#Create FACTOR vector for categorical variable
Ethnicity<-Black[18] ##this grabs the column of groups. The grabbing puts it back into list form
Ethnicity<-unlist(Ethnicity) ## unlist changes it to factor format
is.factor(Ethnicity) ## this checks to make sure is really is a factor
dim(Ethnicity);dim(Resp)
summary(Resp);summary(Ethnicity)
ethnicDIF<-lordif(Resp, Ethnicity, criterion = "Chisqr", alpha = .0045, minCell = 5)
# bonferonni correction of .05/11
print(ethnicDIF)
summary(ethnicDIF)
par(mfrow=c(3,2),pty="s")
plot(ethnicDIF, labels = c("Caribbean", "African"))
##Two items flagged for DIF, (2,11)
############## ASIAN GROUPS ###############
Pak<-subset(data.mental, Race == 4)
Ind<-subset(data.mental, Race == 3)
Bang<-subset(data.mental, Race == 5)
Asian<-rbind(Pak, Ind, Bang)
dim(Asian)
summary(Asian)
Asian$Race.c<-factor(Asian$Race.c) # this drops the factor levels that are no longer there.
#Needed to run lordif
#Create matrix for response variable
Resp<-Asian[c(6:17)]
Resp<-as.matrix(Resp)
is.matrix(Resp)
#Create FACTOR vector for categorical variable
Ethnicity<-Asian[18] ##this grabs the column of groups. The grabbing puts it back into list form
Ethnicity<-unlist(Ethnicity) ## unlist changes it to factor format
is.factor(Ethnicity) ## this checks to make sure is really is a factor
dim(Ethnicity);dim(Resp)
summary(Resp);summary(Ethnicity)
ethnicDIF<-lordif(Resp, Ethnicity, criterion = "Chisqr", alpha = .0022, minCell = 5)
# bonferonni correction of .05/22
print(ethnicDIF)
summary(ethnicDIF)
## Results no item flagged for DIF between these Asian groups
###################### Mixed group ##############
Mix<-subset(data.mental, Race == 2)
White<-subset(data.mental, Race == 1)
Mix_White<-rbind(Mix,White)
dim(Mix_White)
Mix_White$Race.c<-factor(Mix_White$Race.c) # this drops the factor levels that are no longer there.
#Needed to run lordif
#Create matrix for response variable
Resp<-Mix_White[c(6:17)]
Resp<-as.matrix(Resp)
is.matrix(Resp)
#Create FACTOR vector for categorical variable
Ethnicity<-Mix_White[18] ##this grabs the column of groups. The grabbing puts it back into list form
Ethnicity<-unlist(Ethnicity) ## unlist changes it to factor format
is.factor(Ethnicity) ## this checks to make sure is really is a factor
dim(Ethnicity);dim(Resp)
summary(Resp);summary(Ethnicity)
ethnicDIF<-lordif(Resp, Ethnicity, criterion = "Chisqr", alpha = .0045, minCell = 5)
# bonferonni correction of .05/11
print(ethnicDIF)
summary(ethnicDIF)
par(mfrow=c(3,2),pty="s")
plot(ethnicDIF, labels = c("White", "Mixed"))
## no items flagged for DIF between white & mixed
################# WHITE TO 3 ASIAN GROUPS#################################
Asian$together<- 9
White$together <-1
Asian$together<-as.factor(Asian$together)
White$together<-as.factor(White$together)
Asian_White<-rbind(Asian,White)
dim(Asian_White)
Asian_White$Race.c<-factor(Asian_White$Race.c) # this drops the factor levels that are no longer there.
#Needed to run lordif
#Create matrix for response variable
Resp<-Asian_White[c(6:17)]
Resp<-as.matrix(Resp)
is.matrix(Resp)
#Create FACTOR vector for categorical variable
Ethnicity<-Asian_White[19] ##this grabs the column of groups. The grabbing puts it back into list form
Ethnicity<-unlist(Ethnicity) ## unlist changes it to factor format
Ethnicity<-as.factor(Ethnicity) ## to drop the other ethnicities with 0 count
Ethnicity<-factor(Ethnicity, labels=c("Asian","White"))
is.factor(Ethnicity) ## this checks to make sure is really is a factor
str(Ethnicity)
dim(Ethnicity);dim(Resp)
summary(Resp);summary(Ethnicity)
ethnicDIF<-lordif(Resp, Ethnicity, criterion = "Chisqr", alpha = .0045, minCell = 5)
# bonferonni correction of .05/11
print(ethnicDIF)
summary(ethnicDIF)
par(mfrow=c(3,2),pty="s")
plot(ethnicDIF, labels = c("Asian", "White"))
## Iteration 3 : 7 items flagged for DIF (1,2,4,5,7,8,9)
######################## white to carib group #################################
Carib$together<-6
Carib_White<-rbind(Carib,White)
dim(Carib_White)
Carib_White$Race.c<-factor(Carib_White$Race.c) # this drops the factor levels that are no longer there.
#Needed to run lordif
#Create matrix for response variable
Resp<-Carib_White[c(6:17)]
Resp<-as.matrix(Resp)
is.matrix(Resp)
#Create FACTOR vector for categorical variable
Ethnicity<-Carib_White[18] ##this grabs the column of groups. The grabbing puts it back into list form
Ethnicity<-unlist(Ethnicity) ## unlist changes it to factor format
Ethnicity<-as.factor(Ethnicity) ## to drop the other ethnicities with 0 count
Ethnicity<-factor(Ethnicity, labels=c("White","Carib"))
is.factor(Ethnicity) ## this checks to make sure is really is a factor
str(Ethnicity)
dim(Ethnicity);dim(Resp)
summary(Resp);summary(Ethnicity)
ethnicDIF<-lordif(Resp, Ethnicity, criterion = "Chisqr", alpha = .0045, minCell = 5)
# bonferonni correction of .05/11
print(ethnicDIF)
summary(ethnicDIF)
par(mfrow=c(3,2),pty="s")
plot(ethnicDIF, labels = c("White", "Carib"))
Item 1 flagged for DIF (Item 1)
######################## white to african group ##############################
African$together<-7
African_White<-rbind(African,White)
dim(African_White)
African_White$Race.c<-factor(African_White$Race.c) # this drops the factor levels that are no longer there.
#Needed to run lordif
#Create matrix for response variable
Resp<-African_White[c(6:17)]
Resp<-as.matrix(Resp)
is.matrix(Resp)
#Create FACTOR vector for categorical variable
Ethnicity<-African_White[18] ##this grabs the column of groups. The grabbing puts it back into list form
Ethnicity<-unlist(Ethnicity) ## unlist changes it to factor format
Ethnicity<-as.factor(Ethnicity) ## to drop the other ethnicities with 0 count
Ethnicity<-factor(Ethnicity, labels=c("White","African"))
is.factor(Ethnicity) ## this checks to make sure is really is a factor
str(Ethnicity)
dim(Ethnicity);dim(Resp)
summary(Resp);summary(Ethnicity)
ethnicDIF<-lordif(Resp, Ethnicity, criterion = "Chisqr", alpha = .0045, minCell = 5)
# bonferonni correction of .05/11
print(ethnicDIF)
summary(ethnicDIF)
par(mfrow=c(3,2),pty="s")
plot(ethnicDIF, labels = c("White", "African"))
Iteration 4 : 7 items flagged for DIF (1,3,4,7,8,11,12)
###### SCALE LEVEL BIAS ###############
setwd("Filepath")
library(xlsx)
# NEED TO OBTAIN ITEM PARAMETERS #
library(ltm)
# First, create a dataframe with just manifest variables
white_DTF<-subset(data.mental, Race == 1, select = W2concenYP:W2happyYP)
mixed_DTF<-subset(data.mental, Race == 2, select = W2concenYP: W2happyYP)
indian_DTF<-subset(data.mental, Race == 3, select = W2concenYP: W2happyYP)
pak_DTF<-subset(data.mental, Race == 4, select = W2concenYP: W2happyYP)
bang_DTF<-subset(data.mental, Race == 5, select = W2concenYP: W2happyYP)
carib_DTF<-subset(data.mental, Race == 6, select = W2concenYP: W2happyYP)
african_DTF<-subset(data.mental, Race == 7, select = W2concenYP: W2happyYP)
asian_DTF<-rbind(indian_DTF,pak_DTF,bang_DTF)
dim(asian_DTF)
# Second, obtain item parameters #
#grm(data, constrained = FALSE, IRT.param = TRUE, Hessian = FALSE,
#start.val = NULL, na.action = NULL, control = list())
itempar_white<-grm(white_DTF[c(1:12)], constrained = FALSE, IRT.param = TRUE, Hessian = FALSE, start.val = NULL, na.action = NULL, control = list())
itempar_mix<-grm(mixed_DTF[c(1:12)], constrained = FALSE, IRT.param = TRUE, Hessian = FALSE, start.val = NULL, na.action = NULL, control = list())
itempar_carib<-grm(carib_DTF[c(1:12)], constrained = FALSE, IRT.param = TRUE, Hessian = FALSE, start.val = NULL, na.action = NULL, control = list())
itempar_afr<-grm(african_DTF[c(1:12)], constrained = FALSE, IRT.param = TRUE, Hessian = FALSE, start.val = NULL, na.action = NULL, control = list())
itempar_asian<-grm(asian_DTF[c(1:12)], constrained = FALSE, IRT.param = TRUE, Hessian = FALSE, start.val = NULL, na.action = NULL, control = list())
#EXTRACT ITEM PARAMETERS
ipar_white<-extract(itempar_white)
ipar_mixed<-extract(itempar_mix)
ipar_carib<-extract(itempar_carib)
ipar_afr<-extract(itempar_afr)
ipar_asian<-extract(itempar_asian)
## OBTAIN THETA ESTIMATES FOR ALL GROUPS ###
theta <- seq(-4,4,.1)
##calctheta(ipar, resp.data, theta, prior.mean = 0, prior.sd = 1) #Calculates the Expected A Posteriori (EAP) theta and the associated posterior standard deviation(PSD) as standard error estimates.
#WHITE
theta_white<-calctheta(ipar_white, white_DTF, theta,prior.mean = 0, prior.sd = 1)
write.xlsx(theta_white, "thetascores_white.xlsx")
write.xlsx(white_DTF, "rawscores_white.xlsx")
#MIXED
theta_mixed<-calctheta(ipar_mixed, mixed_DTF, theta,prior.mean = 0, prior.sd = 1)
str(theta_mixed)
write.xlsx(mixed_DTF, "rawscores_mixed.xlsx")
write.xlsx(theta_mixed, "thetascores_mixed.xlsx")
#CARIBBEAN
theta_carib<-calctheta(ipar_carib, carib_DTF, theta,prior.mean = 0, prior.sd = 1)
str(theta_carib)
write.xlsx(carib_DTF, "rawscores_carib.xlsx")
write.xlsx(theta_carib, "thetascores_carib.xlsx")
#AFRICAN
theta_afr<-calctheta(ipar_afr, african_DTF, theta,prior.mean = 0, prior.sd = 1)
str(theta_afr)
write.xlsx(african_DTF, "rawscores_afr.xlsx")
write.xlsx(theta_afr, "thetascores_afr.xlsx")
#ASIAN
theta_asian<-calctheta(ipar_asian, asian_DTF, theta,prior.mean = 0, prior.sd = 1)
str(theta_asian)
write.xlsx(asian_DTF, "rawscores_asian.xlsx")
write.xlsx(theta_asian, "thetascores_asian.xlsx")
##### NOW IMPORT OBJECTS AND DATAFRAMES INTO VISUAL AID #####