Simula dados de dois testes usando o sirt
library(sirt)
## Warning: package 'sirt' was built under R version 3.5.2
## - sirt 3.6-21 (2019-08-01 18:42:53)
set.seed(8484)
N <- 500 # number of persons
I <- 30 # number of items
b_easy <- seq( -3 , 0.5 , length=I )
b_hard <- seq( -.5 , 3 , length=I )
t <- rnorm( N )
df_easy <- sirt::sim.raschtype(theta = t,b = b_easy )
df_hard<- sirt::sim.raschtype( t, b_hard )
Calcula os escores e cria um dataframe
library(psych)
## Warning: package 'psych' was built under R version 3.5.2
psicom_easy <- alpha(df_easy, cumulative = TRUE)
psicom_hard <- alpha(df_hard, cumulative = TRUE)
df <- cbind(theta = t, scr_easy = psicom_easy$scores, scr_hard = psicom_hard$scores)
df <- as.data.frame(df)
library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.1 ✔ purrr 0.3.2
## ✔ tibble 2.1.1 ✔ dplyr 0.8.0.1
## ✔ tidyr 0.8.3 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.4.0
## Warning: package 'ggplot2' was built under R version 3.5.2
## Warning: package 'tibble' was built under R version 3.5.2
## Warning: package 'tidyr' was built under R version 3.5.2
## Warning: package 'purrr' was built under R version 3.5.2
## Warning: package 'stringr' was built under R version 3.5.2
## Warning: package 'forcats' was built under R version 3.5.2
## ── Conflicts ─────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ ggplot2::%+%() masks psych::%+%()
## ✖ ggplot2::alpha() masks psych::alpha()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
df <-df %>% mutate(
odds_easy = log( (scr_easy/30) / (1- (scr_easy/30) ) ),
odds_hard = log((scr_hard/30) / (1- (scr_hard/30)) )
)
Figuras
df %>% ggplot(aes(y = scr_hard, x = scr_easy)) + geom_point() + theme_light() + geom_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
df %>% ggplot(aes(y = odds_hard, x = odds_easy)) + geom_point() + theme_light() + geom_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 13 rows containing non-finite values (stat_smooth).
df %>% ggplot(aes(y = scr_hard, x = t)) + geom_point() + theme_light() + geom_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
df %>% ggplot(aes(y = scr_easy, x = t)) + geom_point() + theme_light() + geom_smooth()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'