|
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 |
10 | 13 | hcre_data <- as.data.frame(table(hcre$score, hcre$form))
|
11 | 14 | names(hcre_data) <- c("total", "form", "count")
|
12 | 15 | hcre_x <- as.freqtab(hcre_data[hcre_data$form == "x",
|
13 | 16 | c("total", "count")],
|
14 | 17 | scales = 20:50)
|
15 | 18 | hcre_y <- as.freqtab(hcre_data[hcre_data$form == "y",
|
16 |
| - c("total", "count")], |
| 19 | + c("total", "count")], |
17 | 20 | 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"---- |
23 | 21 | 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---- |
26 | 22 | 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"---- |
33 | 23 | mean_yx <- equate(hcre_x, hcre_y, type = "mean")
|
34 | 24 | 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"---- |
40 | 25 | 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"---- |
49 | 26 | form_yx <- mean_yx$concordance
|
50 | 27 | colnames(form_yx)[1] <- "total"
|
51 | 28 | hcre_xy <- merge(hcre_x, form_yx)
|
52 | 29 | 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"---- |
59 | 30 | linear_yx <- equate(hcre_x, hcre_y, type = "linear")
|
60 | 31 | linear_yx
|
61 | 32 |
|
62 |
| -## ------------------------------------------------------------------------ |
| 33 | +# nonlinear function ---- |
63 | 34 | 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"---- |
66 | 35 | plot(equi_yx$concordance$yx ~ equi_yx$concordance$scale,
|
67 | 36 | type = "p", xlab = "Form X scores",
|
68 | 37 | ylab = "Adjusted X Scores on Form Y", ylim = c(20, 55))
|
69 | 38 | points(linear_yx$concordance$yx ~ linear_yx$concordance$scale,
|
70 | 39 | pch = 4)
|
71 | 40 |
|
72 |
| -## ------------------------------------------------------------------------ |
| 41 | +# nonequivalent group design ---- |
73 | 42 | negd$total <- rowSums(negd[, 1:25])
|
74 | 43 | negd$anchor <- rowSums(negd[, 26:35])
|
75 | 44 | negd_x <- freqtab(negd[1:1000, c("total", "anchor")],
|
76 | 45 | scales = list(0:25, 0:10))
|
77 | 46 | negd_y <- freqtab(negd[1001:2000, c("total", "anchor")],
|
78 | 47 | 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"---- |
81 | 48 | plot(negd_x, xlab = "Total Scores Form X",
|
82 | 49 | ylab = "Common Anchor Scores Form X")
|
83 | 50 |
|
84 |
| -## ------------------------------------------------------------------------ |
| 51 | +# presmoothing |
85 | 52 | smooth_x <- presmoothing(negd_x, smoothmethod = "loglinear")
|
86 | 53 | 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"---- |
89 | 54 | plot(smooth_x, xlab = "Total Scores Form X",
|
90 | 55 | ylab = "Common Anchor Scores Form X")
|
91 | 56 |
|
92 |
| -## ------------------------------------------------------------------------ |
| 57 | +# linear tucker equating ---- |
93 | 58 | negd_tucker <- equate(negd_x, negd_y,
|
94 | 59 | type = "linear", method = "tucker")
|
95 | 60 | negd_tucker$concordance
|
96 |
| - |
0 commit comments