knitr::opts_chunk$set(echo = TRUE) setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) library(dplyr) source("../R/HelperFunctions.R") source("../R/buildfreqtable.R") source("../R/snell.R")
data <- data.frame( "X-3" = c(0,6,0,0,0,2,3,0,1,2,0,5), "X-2" = c(0,3,0,4,0,4,4,0,2,2,0,1), "X-1" = c(0,1,3,1,0,3,3,1,0,2,0,1), "X0" = c(3,0,2,2,0,1,0,1,0,0,0,0), "X1" = c(3,1,2,4,2,0,1,1,1,2,4,1), "X2" = c(2,1,4,0,5,2,1,5,4,4,1,3), "X3" = c(4,0,1,1,5,0,0,4,4,0,7,1), row.names = as.character(1:12) ) str(data)
snell(data)
The originally published scores are: -1.1, 0.6, 1.6, 2.2, 2.8, 4.0, 5.8
The scores in the spreadsheet are: -1.1, 0.611887716, 1.602323384 ,2.186738697, 2.837534795, 4.012972486, 5.84348144
My results are slightly different from the published results for the outer two categories. I think mine are actually more accurate though since the deflection in the paper is based on a rule of thumb and mine is actually calculated.
Create Test data from milton
tong <- data.frame( "Easy" = c(0,0,1,0,1), "Medium" = c(4,7,0,3,1), "Difficult" = c(25,44,20,28,15) ) tong
snell(tong)
The published values in tong et al are: -1, 1.025, and 4.5
So rsnell produces very similar results, but not exactly the same. Unclear where the discrepancy comes from.
mydata <- data.frame("Groups" = rep(c("A", "B", "C", "D"), 10), "Scores" = round(runif(40, 0, 5))) mydata
freqtable <- buildfreqtable(data = mydata, trait = "Scores", subgroup = "Groups") freqtable
snell(freqtable)
raw data
rawdata <- data.frame(Groups = rep(c("A", "B", "C", "D"), 10), Scores = round(runif(40, 0, 1)) )
call buildfreqtable
#Runs with a warning binaryfreqtable <- buildfreqtable(data = rawdata, trait = "Scores", subgroup = "Groups") binaryfreqtable snell(binaryfreqtable) #Snell will fail
Test that the order argument is working
mydata <- data.frame("Groups" = rep(c("A", "B", "C", "D"), 10), "Scores" = sample(c("Easy", "Medium", "Hard"), 40, replace = T)) mydata
#should work buildfreqtable(data = mydata, trait = "Scores", subgroup = "Groups", order = c("Easy", "Medium", "Hard")) #should fail buildfreqtable(data = mydata, trait = "Scores", subgroup = "Groups", order = c("x", "y", "z")) # wrong letters # Will have wrong order due to alphabetical sorting. Warning will be raised buildfreqtable(data = mydata, trait = "Scores", subgroup = "Groups")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.