Skip to content

Commit 3cb3ecf

Browse files
committed
Add option to control x-axis in ICC
1 parent 64ce05a commit 3cb3ecf

File tree

3 files changed

+51
-21
lines changed

3 files changed

+51
-21
lines changed

DESCRIPTION

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ Imports:
2020
jaspBase,
2121
jaspGraphs,
2222
jaspIrtStanModels,
23-
ltm,
2423
mirt,
25-
moments,
2624
parallel,
27-
reshape2,
2825
rstan (>= 2.18.1),
2926
truncdist
3027
Remotes:

R/itemresponsetheorycommon.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@
408408
state <- .irtIRTState(dataset, options, jaspResults)
409409
}
410410
plotdata <- state[["plotDataTestInformation"]]
411-
xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(-6, 6), min.n = 4)
412-
yBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, subset(plotdata$y, plotdata$x >= -6 & plotdata$x <= 6)), min.n = 4)
411+
xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(-3, 3), min.n = 4)
412+
yBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, subset(plotdata$y, plotdata$x >= -3 & plotdata$x <= 3)), min.n = 4)
413413
p <- ggplot2::ggplot(data = plotdata, mapping = ggplot2::aes(x = x, y = y, color = type)) +
414414
ggplot2::geom_line() +
415415
ggplot2::scale_x_continuous(name = "\u03B8", breaks = xBreaks, limits = range(xBreaks)) +
@@ -444,8 +444,8 @@
444444
}
445445
plotdata <- state[["plotDataItemInformation"]]
446446
plotdata <- subset(plotdata, plotdata$item %in% match(options[["plotItemInformationItems"]], options[["items"]]))
447-
xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(-6, 6), min.n = 4)
448-
yBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, subset(plotdata$y, plotdata$x >= -6 & plotdata$x <= 6)), min.n = 4)
447+
xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(-3, 3), min.n = 4)
448+
yBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, subset(plotdata$y, plotdata$x >= -3 & plotdata$x <= 3)), min.n = 4)
449449
colors <- colorspace::qualitative_hcl(length(options[["plotItemInformationItems"]]))
450450
p <- ggplot2::ggplot(data = plotdata, mapping = ggplot2::aes(x = x, y = y, col = factor(item))) +
451451
ggplot2::geom_line() +
@@ -482,7 +482,7 @@
482482
object <- createJaspContainer(title = gettext("Item Characteristic Curves"))
483483
}
484484
object$position <- position + 1
485-
object$dependOn(options = c(.irtCommonDeps(type = "irt"), "plotItemCharacteristicItems", "plotItemCharacteristicLabels"))
485+
object$dependOn(options = c(.irtCommonDeps(type = "irt"), "plotItemCharacteristicItems", "plotItemCharacteristicLabels", "plotItemCharacteristicFromX", "plotItemCharacteristicToX"))
486486
jaspResults[["plotItemCharacteristic"]] <- object
487487
if (!ready) {
488488
return()
@@ -492,7 +492,7 @@
492492
} else {
493493
state <- .irtIRTState(dataset, options, jaspResults)
494494
}
495-
xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(-6, 6), min.n = 4)
495+
xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(options[["plotItemCharacteristicFromX"]], options[["plotItemCharacteristicToX"]]), min.n = 4)
496496
if (options[["plotItemCharacteristicGroup"]]) {
497497
plotdata <- state[["plotDataItemCharacteristic"]]
498498
plotdata <- subset(plotdata, plotdata$item %in% match(options[["plotItemCharacteristicItems"]], options[["items"]]))

inst/qml/common/ItemCharCurves.qml

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,52 @@ Section
3333
AssignedVariablesList { name: "plotItemCharacteristicItems" }
3434
}
3535

36-
CheckBox
36+
Group
3737
{
38-
name: "plotItemCharacteristicGroup"
39-
text: qsTr("Group into one figure")
40-
checked: dichotomous
41-
visible: false
42-
info: qsTr("Group item characteristic curves into one figure for easy comparison and interpretation.")
43-
}
38+
CheckBox
39+
{
40+
name: "plotItemCharacteristicGroup"
41+
text: qsTr("Group into one figure")
42+
checked: dichotomous
43+
visible: false
44+
info: qsTr("Group item characteristic curves into one figure for easy comparison and interpretation.")
45+
}
4446

45-
CheckBox
46-
{
47-
name: "plotItemCharacteristicLabels"
48-
text: qsTr("Display labels")
49-
info: qsTr("Display labels on the item characteristic curves to provide a clear representation which item belongs to which curve.")
47+
CheckBox
48+
{
49+
name: "plotItemCharacteristicLabels"
50+
text: qsTr("Display labels")
51+
info: qsTr("Display labels on the item characteristic curves to provide a clear representation which item belongs to which curve.")
52+
}
53+
54+
Group
55+
{
56+
visible: !dichotomous
57+
title: qsTr("X-axis range")
58+
columns: 2
59+
info: qsTr("Control the limits of the x-axis in the item characteristic curve plots.")
60+
61+
DoubleField
62+
{
63+
id: plotItemCharacteristicFromX
64+
name: "plotItemCharacteristicFromX"
65+
text: qsTr("From")
66+
negativeValues: true
67+
defaultValue: -3
68+
max: plotItemCharacteristicToX.value
69+
info: qsTr("Specify the lower limit for the x-axis in the item characteristic curve plots.")
70+
}
71+
72+
DoubleField
73+
{
74+
id: plotItemCharacteristicToX
75+
name: "plotItemCharacteristicToX"
76+
text: qsTr("to")
77+
negativeValues: true
78+
defaultValue: 3
79+
min: plotItemCharacteristicFromX.value
80+
info: qsTr("Specify the upper limit for the x-axis in the item characteristic curve plots.")
81+
}
82+
}
5083
}
5184
}

0 commit comments

Comments
 (0)