Sharedpsychotools.ipynbOpen in CoCalc
R-project cran psychotools

Are there cursing students on CoCalc?

Sure, we have it all.

Item Response Theory dataset, fed into a Rasch model, and plotted.

Excerpt taken out of R's CRAN package "psychotools":

The 24 items are constructed by factorial combination of four different frustrating situations (see below), three possible verbally aggressive responses (curse, scold, shout), and two behavioural models (want, do). The four situations are

  • S1: A bus fails to stop for me.
  • S2: I miss a train because a clerk gave me faulty information.
  • S3: The grocery store closes just as I am about to enter.
  • S4: The operator disconnects me when I used up my last 10 cents for a call.

Note that the first two situations are other-to-blame situations, and the latter two are self-to-blame situations. The subjects were 316 first-year psychology students from a university in the Dutch speaking part of Belgium.

require("psychotools")
Loading required package: psychotools
data("VerbalAggression", package = "psychotools")
nrow(VerbalAggression)
316
head(VerbalAggression$resp2, n=10)
S1WantCurseS1DoCurseS1WantScoldS1DoScoldS1WantShoutS1DoShoutS2WantCurseS2DoCurseS2WantScoldS2DoScoldS3WantScoldS3DoScoldS3WantShoutS3DoShoutS4WantCurseS4DoCurseS4WantScoldS4DoScoldS4WantShoutS4DoShout
01000101000010110101
00000000000000000000
10111110000000010000
11111111110000000000
11011011000000110000
11100011001010010100
11111111110010000000
01000001000000010000
01000011100011100100
11111111110010111111
m <- raschmodel(VerbalAggression$resp2[, 1:12])
summary(m)
Rasch model Difficulty parameters: Estimate Std. Error z value Pr(>|z|) S1DoCurse -1.556e-08 2.042e-01 0.000 1.00000 S1WantScold 6.857e-01 1.995e-01 3.436 0.00059 *** S1DoScold 8.727e-01 1.994e-01 4.376 1.21e-05 *** S1WantShout 1.208e+00 2.003e-01 6.032 1.62e-09 *** S1DoShout 2.294e+00 2.131e-01 10.766 < 2e-16 *** S2WantCurse -5.393e-01 2.135e-01 -2.527 0.01152 * S2DoCurse 3.614e-01 2.009e-01 1.799 0.07200 . S2WantScold 5.345e-01 2.000e-01 2.673 0.00753 ** S2DoScold 1.359e+00 2.012e-01 6.755 1.42e-11 *** S2WantShout 1.283e+00 2.007e-01 6.395 1.61e-10 *** S2DoShout 3.067e+00 2.343e-01 13.088 < 2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Log-likelihood: -1255 (df = 11) Number of iterations in BFGS optimization: 19
## visualizations
plot(m, type = "profile")
plot(m, type = "regions")
plot(m, type = "curves")
plot(m, type = "information")
plot(m, type = "piplot")