Prepare Data

Import surveys, combine into single data frame, delete identifying information, assign IDs, and separate out by scale for item examination.

# https://hansjoerg.me/2018/04/23/rasch-in-r-tutorial/

knitr::knit_hooks$set(
   error = function(x, options) {
     paste('\n\n<div class="alert alert-danger">',
           gsub('##', '\n', gsub('^##\ Error', '**Error**', x)),
           '</div>', sep = '\n')
   },
   warning = function(x, options) {
     paste('\n\n<div class="alert alert-warning">',
           gsub('##', '\n', gsub('^##\ Warning:', '**Warning**', x)),
           '</div>', sep = '\n')
   },
   message = function(x, options) {
     paste('\n\n<div class="alert alert-info">',
           gsub('##', '\n', x),
           '</div>', sep = '\n')
   }
)

# load libraries ----------------------------------------------------------
library(stringi)
library(psych)
library(DT)
library(naniar)
library(UpSetR)
library(nFactors)
library(lavaan)
library(corrplot)
library(tidyr)

library(ggplot2)
library(dplyr)
library("eRm")
library("ltm")
library("difR")
library("psych")

# load data ---------------------------------------------------------------
# alt <- read.csv(file="UBelong Post-Survey Pitt OChem Spring 2022 Alternative Scales_April 28, 2022_12.34.csv", header=T)
# alt <- alt[-c(1,2),]
# alt$scale <- "alt"
# 
# orig <- read.csv(file="UBelong Post-Survey Pitt OChem Spring 2022 Original Scales_April 28, 2022_12.35.csv", header=T)
# orig <- orig[-c(1,2),]
# orig$scale <- "orig"
# 
# df <- rbind.data.frame(alt, orig)
# df <- subset(df, select = -c(1:19))
# names(df)
# myFun <- function(n) {
#   a <- do.call(paste0, replicate(5, sample(LETTERS, n, TRUE), FALSE))
#   paste0(a, sprintf("%04d", sample(9999, n, TRUE)), sample(LETTERS, n, TRUE))
# }
# df$id <- myFun(nrow(df))
# write.csv(df, file="imported_anonymized.csv", row.names = F)

df <- read.csv(file="imported_anonymized.csv", header=T)

# extract items -----------------------------------------------------------
# new items
EEochem <- subset(df, select=c(scale,grep("EEochem", colnames(df)))) # entry expectations
CCdisc <- subset(df, select=grep("CCdisc", colnames(df))) # classroom climate
IDochem <- cbind.data.frame(subset(df, select=c(scale,grep("IDochem", colnames(df)))), subset(df, select=grep("FASochem", colnames(df)))) # identity
CSochem <- subset(df, select=grep("CSochem", colnames(df))) # career satisfaction

# established scales
MSchem <- subset(df, select=c(scale,grep("MSchem", colnames(df)))) # discipline growth mindset (chemistry)
IPchem <- subset(df, select=grep("IPchem", colnames(df))) # instructor growth mindset (chemistry)
SEchem <- subset(df, select=grep("SEchem", colnames(df))) # disciplinary self-efficacy (chemistry)
MSochem <- subset(df, select=c(scale, grep("MSochem", colnames(df)))) # disciplinary growth mindset (organic chemistry)
IPochem <- subset(df, select=grep("IPochem", colnames(df))) # instructor growth mindset (organic chemistry)
SEochem <- subset(df, select=grep("SEochem", colnames(df))) # disciplinary self-efficacy (organic chemistry)
CNEBochem_class <- cbind.data.frame(subset(subset(df, select=grep("CNEBochem", colnames(df))), select=c(1:3))) # entity norms and beliefs
CNEBochem_self <- cbind.data.frame(subset(subset(df, select=grep("CNEBochem", colnames(df))), select=c(4:6))) # entity norms and beliefs
CNHSochem_others <- cbind.data.frame(subset(subset(df, select=grep("CNHSochem", colnames(df))), select=c(1:3))) # help seeking
CNHSochem_self <- cbind.data.frame(subset(subset(df, select=grep("CNHSochem", colnames(df))), select=c(4:6))) # help seeking
CNSWochem <- subset(df, select=grep("CNSWochem", colnames(df))) # help seeking
FCochem <- subset(df, select=grep("FCochem", colnames(df))) # faculty caring

Disciplinary Growth Mindset (C)

Items

  1. Even if I were to spend a lot of time working on difficult chemistry problems, I cannot develop my intelligence in chemistry further.
  2. I won’t get better at chemistry if I try harder.
  3. I could never excel in chemistry because I do not have what it takes to be a chemistry person.
  4. I could never become really good at chemistry even if I were to work hard because I don’t have natural ability.
  5. I can become even better at solving chemistry problems through hard work.
  6. I am capable of really understanding chemistry if I work hard.
  7. I can change my intelligence in chemistry quite a lot by working hard.

Stats - Original

Univariate Stats

d <- subset(MSchem, scale == "orig", select=-c(scale))
MSchem_desc <- data.frame(describe(d))
datatable(subset(MSchem_desc, select=-c(n, trimmed, mad))) %>%
  formatRound(1:10) %>%
  formatStyle(8:9, color = styleInterval(c(-2, 2), c('red', 'black', 'red')))

Missingness

vis_miss(d)

# gg_miss_upset(EEochem)

Histograms

ggplot(gather(d), aes(value)) + 
  geom_histogram(bins = 4) + 
  facet_wrap(~key)

Warning Removed 2 rows containing non-finite values (stat_bin).

Item Correlations

corr <- corr.test(d, adjust = "holm")

rval <- corr$r
rval[lower.tri(corr$r, diag = T)] <- NA

datatable(rval) %>%
  formatRound(1:ncol(rval)) %>%
  formatStyle(1:ncol(rval), color = styleInterval(c(-.7, .7), c('red', 'black', 'red')))
corrplot(corr$r)

EFA

d <- na.omit(d)
ev <- eigen(cor(d))
ap <- parallel(subject=nrow(d),var=ncol(d),rep=100,cent=.05)
nS <- nScree(x=ev$values, aparallel=ap$eigen$qevpea)
plotnScree(nS)

EFA <- factanal(d, factors = 2, rotation = "promax", cutoff = 0.3)
print(EFA, digits=3, cutoff=.4, sort=TRUE)
## 
## Call:
## factanal(x = d, factors = 2, rotation = "promax", cutoff = 0.3)
## 
## Uniquenesses:
## MSchem01 MSchem02 MSchem03 MSchem04 MSchem05 MSchem06 MSchem07 
##    0.446    0.250    0.130    0.111    0.181    0.148    0.370 
## 
## Loadings:
##          Factor1 Factor2
## MSchem01  0.708         
## MSchem02  0.918         
## MSchem03  0.936         
## MSchem04  0.894         
## MSchem05          0.974 
## MSchem06          0.849 
## MSchem07          0.737 
## 
##                Factor1 Factor2
## SS loadings      3.056   2.229
## Proportion Var   0.437   0.318
## Cumulative Var   0.437   0.755
## 
## Factor Correlations:
##         Factor1 Factor2
## Factor1    1.00   -0.61
## Factor2   -0.61    1.00
## 
## Test of the hypothesis that 2 factors are sufficient.
## The chi square statistic is 58.7 on 8 degrees of freedom.
## The p-value is 8.36e-10

Stats - Alternative

Univariate Stats

d <- subset(MSchem, scale == "alt", select=-c(scale))
MSchem_desc <- data.frame(describe(d))
datatable(subset(MSchem_desc, select=-c(n, trimmed, mad))) %>%
  formatRound(1:10) %>%
  formatStyle(8:9, color = styleInterval(c(-2, 2), c('red', 'black', 'red')))

Missingness

vis_miss(d)

# gg_miss_upset(EEochem)

Histograms

ggplot(gather(d), aes(value)) + 
  geom_histogram(bins = 4) + 
  facet_wrap(~key)

Warning Removed 7 rows containing non-finite values (stat_bin).

Item Correlations

corr <- corr.test(d, adjust = "holm")

rval <- corr$r
rval[lower.tri(corr$r, diag = T)] <- NA

datatable(rval) %>%
  formatRound(1:ncol(rval)) %>%
  formatStyle(1:ncol(rval), color = styleInterval(c(-.7, .7), c('red', 'black', 'red')))
corrplot(corr$r)

EFA (1fac)

d <- na.omit(d)
ev <- eigen(cor(d))
ap <- parallel(subject=nrow(d),var=ncol(d),rep=100,cent=.05)
nS <- nScree(x=ev$values, aparallel=ap$eigen$qevpea)
plotnScree(nS)

EFA <- factanal(d, factors = 1, rotation = "promax", cutoff = 0.3)
print(EFA, digits=3, cutoff=.4, sort=TRUE)
## 
## Call:
## factanal(x = d, factors = 1, rotation = "promax", cutoff = 0.3)
## 
## Uniquenesses:
## MSchem01 MSchem02 MSchem03 MSchem04 MSchem05 MSchem06 MSchem07 
##    0.582    0.420    0.410    0.295    0.658    0.351    0.411 
## 
## Loadings:
## [1]  0.646  0.762  0.768  0.840 -0.585 -0.805 -0.768
## 
##                Factor1
## SS loadings      3.872
## Proportion Var   0.553
## 
## Test of the hypothesis that 1 factor is sufficient.
## The chi square statistic is 87.64 on 14 degrees of freedom.
## The p-value is 1.06e-12

EFA (2fac)

d <- na.omit(d)
ev <- eigen(cor(d))
ap <- parallel(subject=nrow(d),var=ncol(d),rep=100,cent=.05)
nS <- nScree(x=ev$values, aparallel=ap$eigen$qevpea)
plotnScree(nS)

EFA <- factanal(d, factors = 2, rotation = "promax", cutoff = 0.3)
print(EFA, digits=3, cutoff=.4, sort=TRUE)
## 
## Call:
## factanal(x = d, factors = 2, rotation = "promax", cutoff = 0.3)
## 
## Uniquenesses:
## MSchem01 MSchem02 MSchem03 MSchem04 MSchem05 MSchem06 MSchem07 
##    0.630    0.465    0.316    0.005    0.580    0.234    0.249 
## 
## Loadings:
##          Factor1 Factor2
## MSchem05  0.756         
## MSchem06  0.867         
## MSchem07  0.899         
## MSchem03          0.802 
## MSchem04          1.058 
## MSchem01                
## MSchem02 -0.441         
## 
##                Factor1 Factor2
## SS loadings      2.440   2.016
## Proportion Var   0.349   0.288
## Cumulative Var   0.349   0.637
## 
## Factor Correlations:
##         Factor1 Factor2
## Factor1    1.00   -0.74
## Factor2   -0.74    1.00
## 
## Test of the hypothesis that 2 factors are sufficient.
## The chi square statistic is 28.43 on 8 degrees of freedom.
## The p-value is 0.000399

1PL Model - Orig (All)

Summary & Fit

d <- na.omit(subset(MSchem, scale == "orig", select=-c(scale)))
d <- d %>%
  mutate_at(vars(1:ncol(d)), recode, `1` = 0, `2` = 0, `3` = 1, `4` = 1)

mod <- rasch(d)
summary(mod)
## 
## Call:
## rasch(data = d)
## 
## Model Summary:
##    log.Lik      AIC      BIC
##  -233.9881 483.9762 502.9318
## 
## Coefficients:
##                   value std.err  z.vals
## Dffclt.MSchem01  2.0964  0.7711  2.7188
## Dffclt.MSchem02  3.2931  1.1343  2.9032
## Dffclt.MSchem03  2.3510  0.8437  2.7866
## Dffclt.MSchem04  2.2211  0.8063  2.7548
## Dffclt.MSchem05 -4.5404  1.5815 -2.8709
## Dffclt.MSchem06 -3.2882  1.1376 -2.8904
## Dffclt.MSchem07 -2.9364  1.0230 -2.8704
## Dscrmn           0.6300  0.2156  2.9221
## 
## Integration:
## method: Gauss-Hermite
## quadrature points: 21 
## 
## Optimization:
## Convergence: 0 
## max(|grad|): 0.00014 
## quasi-Newton: BFGS
item.fit(mod, simulate.p.value=T)

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

## 
## Item-Fit Statistics and P-values
## 
## Call:
## rasch(data = d)
## 
## Alternative: Items do not fit the model
## Ability Categories: 10
## Monte Carlo samples: 100 
## 
##              X^2 Pr(>X^2)
## MSchem01 31.5219   0.0099
## MSchem02 23.0463   0.0198
## MSchem03 35.6226   0.0099
## MSchem04 25.5022   0.0396
## MSchem05 17.6123   0.1188
## MSchem06 27.4520   0.0792
## MSchem07 29.7800   0.0594

ICC

plot(mod, type="ICC", cex = .7, legend = F, col = 1)

IIC

plot(mod, type="IIC", cex = .7, legend = F, col = 1)

Individual ICC Plots

items <- colnames(d)
n <- 1
for (i in 1:ncol(d)) {
  plot(mod, type = 'ICC', auto.key = FALSE, items = n, main = items[n], annot = F)
  n <- n + 1
}

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Test Information Function

plot(mod, type=c("IIC"), items=c(0))

1PL Model - Orig (1F)

Summary & Fit

d1 <- subset(d, select=c(MSchem01, MSchem02, MSchem03, MSchem04))
d2 <- subset(d, select=c(MSchem05, MSchem06, MSchem07))

d <- d1

mod <- rasch(d)

Warning in rasch(d): Hessian matrix at convergence is not positive definite; unstable solution.

summary(mod)

Warning in sqrt(diag(new.covar)): NaNs produced

Warning in sqrt(diag(new.covar)): NaNs produced

Warning in sqrt(diag(new.covar)): NaNs produced

Warning in sqrt(diag(new.covar)): NaNs produced

Warning in sqrt(Var[n.ind + 1, n.ind + 1]): NaNs produced

## 
## Call:
## rasch(data = d)
## 
## Model Summary:
##    log.Lik      AIC      BIC
##  -114.8338 239.6677 251.5149
## 
## Coefficients:
##                  value std.err z.vals
## Dffclt.MSchem01 0.4439     NaN    NaN
## Dffclt.MSchem02 0.8154     NaN    NaN
## Dffclt.MSchem03 0.5158     NaN    NaN
## Dffclt.MSchem04 0.5068     NaN    NaN
## Dscrmn          6.0452     NaN    NaN
## 
## Integration:
## method: Gauss-Hermite
## quadrature points: 21 
## 
## Optimization:
## Convergence: 0 
## max(|grad|): 3.8 
## quasi-Newton: BFGS
item.fit(mod, simulate.p.value=T)

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

## 
## Item-Fit Statistics and P-values
## 
## Call:
## rasch(data = d)
## 
## Alternative: Items do not fit the model
## Ability Categories: 10
## Monte Carlo samples: 100 
## 
##              X^2 Pr(>X^2)
## MSchem01 15.0814   0.0396
## MSchem02  1.8016   0.8515
## MSchem03  6.9369   0.0891
## MSchem04  2.0882   0.6733

ICC

plot(mod, type="ICC", cex = .7, legend = F, col = 1)

All Items IIC

plot(mod, type="IIC", cex = .7, legend = F, col = 1)

Individual ICC Plots

items <- colnames(d)
n <- 1
for (i in 1:ncol(d)) {
  plot(mod, type = 'ICC', auto.key = FALSE, items = n, main = items[n], annot = F)
  n <- n + 1
}

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Test Information Function

plot(mod, type=c("IIC"), items=c(0))

1PL Model - Orig (2F)

Summary & Fit

d <- d2

mod <- rasch(d)
summary(mod)
## 
## Call:
## rasch(data = d)
## 
## Model Summary:
##    log.Lik      AIC      BIC
##  -56.60816 121.2163 130.6941
## 
## Coefficients:
##                   value   std.err  z.vals
## Dffclt.MSchem05 -1.3565    0.1599 -8.4830
## Dffclt.MSchem06 -0.7572    3.6978 -0.2048
## Dffclt.MSchem07 -0.7262    2.2508 -0.3227
## Dscrmn          24.3123 1136.0908  0.0214
## 
## Integration:
## method: Gauss-Hermite
## quadrature points: 21 
## 
## Optimization:
## Convergence: 0 
## max(|grad|): 8.1e-06 
## quasi-Newton: BFGS
item.fit(mod, simulate.p.value=T)

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

## 
## Item-Fit Statistics and P-values
## 
## Call:
## rasch(data = d)
## 
## Alternative: Items do not fit the model
## Ability Categories: 10
## Monte Carlo samples: 100 
## 
##             X^2 Pr(>X^2)
## MSchem05 0.3217   0.6436
## MSchem06 0.1641   0.6337
## MSchem07 0.2312   0.3564

ICC

plot(mod, type="ICC", cex = .7, legend = F, col = 1)

All Items IIC

plot(mod, type="IIC", cex = .7, legend = F, col = 1)

Individual ICC Plots

items <- colnames(d)
n <- 1
for (i in 1:ncol(d)) {
  plot(mod, type = 'ICC', auto.key = FALSE, items = n, main = items[n], annot = F)
  n <- n + 1
}

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Test Information Function

plot(mod, type=c("IIC"), items=c(0))

1PL Model - Alt (All)

Summary & Fit

d <- na.omit(subset(MSchem, scale == "alt", select=-c(scale)))
d <- d %>%
  mutate_at(vars(1:ncol(d)), recode, `1` = 0, `2` = 0, `3` = 1, `4` = 1)

mod <- rasch(d)
summary(mod)
## 
## Call:
## rasch(data = d)
## 
## Model Summary:
##    log.Lik      AIC      BIC
##  -267.8323 551.6646 572.5855
## 
## Coefficients:
##                   value std.err  z.vals
## Dffclt.MSchem01  2.7068  0.9525  2.8419
## Dffclt.MSchem02  3.5294  1.2215  2.8893
## Dffclt.MSchem03  2.9530  1.0309  2.8645
## Dffclt.MSchem04  2.9530  1.0309  2.8645
## Dffclt.MSchem05 -4.5374  1.5849 -2.8629
## Dffclt.MSchem06 -3.8764  1.3454 -2.8812
## Dffclt.MSchem07 -3.3697  1.1704 -2.8790
## Dscrmn           0.6061  0.2144  2.8275
## 
## Integration:
## method: Gauss-Hermite
## quadrature points: 21 
## 
## Optimization:
## Convergence: 0 
## max(|grad|): 0.00034 
## quasi-Newton: BFGS
item.fit(mod, simulate.p.value=T)

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

## 
## Item-Fit Statistics and P-values
## 
## Call:
## rasch(data = d)
## 
## Alternative: Items do not fit the model
## Ability Categories: 10
## Monte Carlo samples: 100 
## 
##              X^2 Pr(>X^2)
## MSchem01 41.9780   0.0297
## MSchem02 21.7268    0.099
## MSchem03 33.9795   0.0198
## MSchem04 32.7329   0.0594
## MSchem05 26.2988   0.1089
## MSchem06 32.8482   0.0891
## MSchem07 38.7653   0.0297

ICC

plot(mod, type="ICC", cex = .7, legend = F, col = 1)

IIC

plot(mod, type="IIC", cex = .7, legend = F, col = 1)

Individual ICC Plots

items <- colnames(d)
n <- 1
for (i in 1:ncol(d)) {
  plot(mod, type = 'ICC', auto.key = FALSE, items = n, main = items[n], annot = F)
  n <- n + 1
}

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Test Information Function

plot(mod, type=c("IIC"), items=c(0))

1PL Model - Alt (1F)

Summary & Fit

d1 <- subset(d, select=c(MSchem01, MSchem02, MSchem03, MSchem04))
d2 <- subset(d, select=c(MSchem05, MSchem06, MSchem07))

d <- d1

mod <- rasch(d)
summary(mod)
## 
## Call:
## rasch(data = d)
## 
## Model Summary:
##    log.Lik      AIC      BIC
##  -137.8372 285.6745 298.7501
## 
## Coefficients:
##                  value std.err z.vals
## Dffclt.MSchem01 1.0977  0.1932 5.6820
## Dffclt.MSchem02 1.4078  0.2175 6.4729
## Dffclt.MSchem03 1.1919  0.2002 5.9527
## Dffclt.MSchem04 1.1919  0.2002 5.9526
## Dscrmn          2.9149  0.5084 5.7337
## 
## Integration:
## method: Gauss-Hermite
## quadrature points: 21 
## 
## Optimization:
## Convergence: 0 
## max(|grad|): 0.00014 
## quasi-Newton: BFGS
item.fit(mod, simulate.p.value=T)

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

## 
## Item-Fit Statistics and P-values
## 
## Call:
## rasch(data = d)
## 
## Alternative: Items do not fit the model
## Ability Categories: 10
## Monte Carlo samples: 100 
## 
##              X^2 Pr(>X^2)
## MSchem01 16.6702   0.0594
## MSchem02  2.5010   0.9505
## MSchem03  4.1249   0.7624
## MSchem04  4.1246   0.6733

ICC

plot(mod, type="ICC", cex = .7, legend = F, col = 1)

All Items IIC

plot(mod, type="IIC", cex = .7, legend = F, col = 1)

Individual ICC Plots

items <- colnames(d)
n <- 1
for (i in 1:ncol(d)) {
  plot(mod, type = 'ICC', auto.key = FALSE, items = n, main = items[n], annot = F)
  n <- n + 1
}

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Test Information Function

plot(mod, type=c("IIC"), items=c(0))

1PL Model - Alt (2F)

Summary & Fit

d <- d2

mod <- rasch(d)
summary(mod)
## 
## Call:
## rasch(data = d)
## 
## Model Summary:
##   log.Lik      AIC      BIC
##  -75.8406 159.6812 170.1417
## 
## Coefficients:
##                   value std.err  z.vals
## Dffclt.MSchem05 -1.6042  0.2302 -6.9686
## Dffclt.MSchem06 -1.3997  0.1941 -7.2121
## Dffclt.MSchem07 -1.2331  0.1811 -6.8094
## Dscrmn           4.1331  1.2754  3.2407
## 
## Integration:
## method: Gauss-Hermite
## quadrature points: 21 
## 
## Optimization:
## Convergence: 0 
## max(|grad|): 8.1e-05 
## quasi-Newton: BFGS
item.fit(mod, simulate.p.value=T)

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

Warning in rasch(data = X.new): Hessian matrix at convergence is not positive definite; unstable solution.

## 
## Item-Fit Statistics and P-values
## 
## Call:
## rasch(data = d)
## 
## Alternative: Items do not fit the model
## Ability Categories: 10
## Monte Carlo samples: 100 
## 
##             X^2 Pr(>X^2)
## MSchem05 3.3944   0.2376
## MSchem06 1.9365   0.5446
## MSchem07 3.1600   0.4752

ICC

plot(mod, type="ICC", cex = .7, legend = F, col = 1)

All Items IIC

plot(mod, type="IIC", cex = .7, legend = F, col = 1)

Individual ICC Plots

items <- colnames(d)
n <- 1
for (i in 1:ncol(d)) {
  plot(mod, type = 'ICC', auto.key = FALSE, items = n, main = items[n], annot = F)
  n <- n + 1
}

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Warning in plot.window(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy, type, …): “auto.key” is not a graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in axis(side = side, at = at, labels = labels, …): “auto.key” is not a

graphical parameter

Warning in box(…): “auto.key” is not a graphical parameter

Warning in title(…): “auto.key” is not a graphical parameter

Warning in plot.xy(xy.coords(x, y), type = type, …): “auto.key” is not a

graphical parameter

Test Information Function

plot(mod, type=c("IIC"), items=c(0))