Skip to content

Commit 32dc5ca

Browse files
committed
chapter 10 linted!
1 parent 97b794a commit 32dc5ca

File tree

1 file changed

+17
-53
lines changed

1 file changed

+17
-53
lines changed

ch10.R

+17-53
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,60 @@
1-
## ----eval = F------------------------------------------------------------
2-
## vignette("equatevignette")
3-
4-
## ----eval=FALSE----------------------------------------------------------
5-
## install.packages("equate")
6-
## library("equate")
7-
## library("hemp")
8-
9-
## ------------------------------------------------------------------------
1+
## -------------------------------------------------------------------
2+
## Chapter 10 R code
3+
## Handbook of Educational Measurement and Psychometrics Using R
4+
## C. D. Desjardins & O. Bulut
5+
## -------------------------------------------------------------------
6+
install.packages("equate")
7+
library("equate")
8+
library("hemp")
9+
10+
vignette("equatevignette")
11+
12+
# equating designs
1013
hcre_data <- as.data.frame(table(hcre$score, hcre$form))
1114
names(hcre_data) <- c("total", "form", "count")
1215
hcre_x <- as.freqtab(hcre_data[hcre_data$form == "x",
1316
c("total", "count")],
1417
scales = 20:50)
1518
hcre_y <- as.freqtab(hcre_data[hcre_data$form == "y",
16-
c("total", "count")],
19+
c("total", "count")],
1720
scales = 20:50)
18-
19-
## ----message = FALSE, verbose = FALSE, eval = FALSE----------------------
20-
## rbind(form_x = summary(hcre_x), form_y = summary(hcre_y))
21-
22-
## ----message = FALSE, verbose = FALSE, echo = FALSE, background = "gray95"----
2321
rbind(form_x = summary(hcre_x), form_y = summary(hcre_y))
24-
25-
## ----"hcrebar", fig.cap="Bar plot of the test scores on form X in the hcre data set.", fig.pos = "!t", small.mar=TRUE----
2622
plot(hcre_x)
27-
28-
## ----message = FALSE, verbose = FALSE, eval = FALSE----------------------
29-
## mean_yx <- equate(hcre_x, hcre_y, type = "mean")
30-
## mean_yx
31-
32-
## ----message = FALSE, verbose = FALSE, echo = FALSE, background = "gray95"----
3323
mean_yx <- equate(hcre_x, hcre_y, type = "mean")
3424
mean_yx
35-
36-
## ----message = FALSE, verbose = FALSE, eval = FALSE----------------------
37-
## head(mean_yx$concordance)
38-
39-
## ----message = FALSE, verbose = FALSE, echo = FALSE, background = "gray95"----
4025
head(mean_yx$concordance)
41-
42-
## ----message = FALSE, verbose = FALSE, eval = FALSE----------------------
43-
## form_yx <- mean_yx$concordance
44-
## colnames(form_yx)[1] <- "total"
45-
## hcre_xy <- merge(hcre_x, form_yx)
46-
## head(hcre_xy)
47-
48-
## ----message = FALSE, verbose = FALSE, echo = FALSE, background = "gray95"----
4926
form_yx <- mean_yx$concordance
5027
colnames(form_yx)[1] <- "total"
5128
hcre_xy <- merge(hcre_x, form_yx)
5229
head(hcre_xy)
53-
54-
## ----message = FALSE, verbose = FALSE, eval = FALSE----------------------
55-
## linear_yx <- equate(hcre_x, hcre_y, type = "linear")
56-
## linear_yx
57-
58-
## ----message = FALSE, verbose = FALSE, echo = FALSE, background = "gray95"----
5930
linear_yx <- equate(hcre_x, hcre_y, type = "linear")
6031
linear_yx
6132

62-
## ------------------------------------------------------------------------
33+
# nonlinear function ----
6334
equi_yx <- equate(hcre_x, hcre_y, type = "equipercentile")
64-
65-
## ----"hcrecomp", fig.cap="Scatterplot of the adjusted X scores on form Y against the original form X scores. (The hollow circles correspond to the equipercentile equating and the Xs correspond to linear equating.)", fig.pos = "!t"----
6635
plot(equi_yx$concordance$yx ~ equi_yx$concordance$scale,
6736
type = "p", xlab = "Form X scores",
6837
ylab = "Adjusted X Scores on Form Y", ylim = c(20, 55))
6938
points(linear_yx$concordance$yx ~ linear_yx$concordance$scale,
7039
pch = 4)
7140

72-
## ------------------------------------------------------------------------
41+
# nonequivalent group design ----
7342
negd$total <- rowSums(negd[, 1:25])
7443
negd$anchor <- rowSums(negd[, 26:35])
7544
negd_x <- freqtab(negd[1:1000, c("total", "anchor")],
7645
scales = list(0:25, 0:10))
7746
negd_y <- freqtab(negd[1001:2000, c("total", "anchor")],
7847
scales = list(0:25, 0:10))
79-
80-
## ----"ngedx_plot", fig.cap="Plot of the common anchor scores against total scores on form X.", fig.pos = "!t"----
8148
plot(negd_x, xlab = "Total Scores Form X",
8249
ylab = "Common Anchor Scores Form X")
8350

84-
## ------------------------------------------------------------------------
51+
# presmoothing
8552
smooth_x <- presmoothing(negd_x, smoothmethod = "loglinear")
8653
smooth_y <- presmoothing(negd_y, smoothmethod = "loglinear")
87-
88-
## ----"ngedx_smooth", fig.cap="Smoothed (loglinear) plot of the common anchor scores against total scores on form X.", fig.pos = "!t"----
8954
plot(smooth_x, xlab = "Total Scores Form X",
9055
ylab = "Common Anchor Scores Form X")
9156

92-
## ------------------------------------------------------------------------
57+
# linear tucker equating ----
9358
negd_tucker <- equate(negd_x, negd_y,
9459
type = "linear", method = "tucker")
9560
negd_tucker$concordance
96-

0 commit comments

Comments
 (0)