-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interrater reliability and update 1.0.0
- Loading branch information
1 parent
9250d4a
commit 5b5297b
Showing
20 changed files
with
671 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
Package: seolmatrix | ||
Type: Package | ||
Title: Correlations suite for jamovi | ||
Version: 0.0.3 | ||
Version: 1.0.0 | ||
Date: 2020-06-17 | ||
Author: Hyunsoo Seol | ||
Maintainer: Hyunsoo Seol <[email protected]> | ||
Description:This module is a tool for calculating correlations, such as Pearson, Partial, Point-Biserial,Tetrachoric and allows users to produce | ||
Description: This module is a tool for calculating correlations, such as Pearson, Partial, Point-Biserial,Tetrachoric, rater, and allows users to produce | ||
Gaussian Graphical Model. | ||
License: GPL (>= 2) | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 7.1.0 | ||
RoxygenNote: 7.1.1 | ||
Imports: | ||
janitor, | ||
jmvcore (>= 1.0.8), | ||
knitr, | ||
R6, | ||
magrittr, | ||
tidyverse, | ||
stats, | ||
qgraph, | ||
psych | ||
|
||
|
||
psych, | ||
lpSolve, | ||
irr |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,9 @@ self$results$instructions$setContent( | |
<p>- The input dataset require dichotomous data with the type of <b>numeric-continuous</b> in jamovi.</p> | ||
<p>- Just highlight the variables and click the arrow to move it across into the 'Variables' box.</p> | ||
<p>If you encounter any errors, or have questions, please e-mail me: [email protected]</a></p> | ||
<p>- Feature requests and bug reports can be made on my <a href='https://github.com/hyunsooseol/seolmatrix/' target = '_blank'>GitHub</a></p> | ||
<p>If you have any questions, please e-mail me: [email protected]</a></p> | ||
</div> | ||
</body> | ||
</html>" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,8 +49,9 @@ partialClass <- if (requireNamespace('jmvcore')) | |
<p> Note: When One variable is dichotomous, the other is continuous, the result table is equivalent to a <b>Point-biserial correlation</b>.</P> | ||
<p>If you encounter any errors, or have questions, please e-mail me: [email protected]</a></p> | ||
<p>- Feature requests and bug reports can be made on my <a href='https://github.com/hyunsooseol/seolmatrix/' target = '_blank'>GitHub</a></p> | ||
<p>If you have any questions, please e-mail me: [email protected]</a></p> | ||
</div> | ||
</body> | ||
</html>") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
|
||
# This file is a generated template, your changes will not be overwritten | ||
|
||
#' Interrater Analysis | ||
#' @importFrom R6 R6Class | ||
#' @import jmvcore | ||
#' @importFrom irr kappam.light | ||
#' @import irr | ||
#' @import lpSolve | ||
#' @import qgraph | ||
#' @import psych | ||
#' @importFrom psych polychoric | ||
#' @importFrom psych partial.r | ||
#' @export | ||
|
||
|
||
raterClass <- if (requireNamespace('jmvcore')) R6::R6Class( | ||
"raterClass", | ||
inherit = raterBase, | ||
private = list( | ||
|
||
#========================================================== | ||
.init = function() { | ||
|
||
|
||
if(is.null(self$data) | is.null(self$options$vars)){ | ||
self$results$instructions$setVisible(visible = TRUE) | ||
|
||
} | ||
|
||
self$results$instructions$setContent( | ||
"<html> | ||
<head> | ||
</head> | ||
<body> | ||
<div class='instructions'> | ||
<p>Welcome to Interrater reliability.</p> | ||
<p><b>To get started:</b></p> | ||
<p>- Just highlight the variables(raters) and click the arrow to move it across into the 'Variables' box.</p> | ||
<p>- To produce Gaussian Graphical Model, partial correlations are calculated from a input matrix of polychoric correlations.</p> | ||
<p>- Feature requests and bug reports can be made on my <a href='https://github.com/hyunsooseol/seolmatrix/' target = '_blank'>GitHub</a></p> | ||
<p>If you have any questions, please e-mail me: [email protected]</a></p> | ||
</div> | ||
</body> | ||
</html>" | ||
) | ||
|
||
}, | ||
|
||
#======================================++++++++++++++++++++++ | ||
.run = function() { | ||
|
||
# get variables------- | ||
|
||
data <- self$data | ||
|
||
vars <- self$options$get('vars') | ||
|
||
|
||
# Ready-------- | ||
|
||
ready <- TRUE | ||
|
||
if (is.null(self$options$vars) || | ||
length(self$options$vars) < 2) | ||
|
||
ready <- FALSE | ||
|
||
if (ready) { | ||
|
||
data <- private$.cleanData() | ||
|
||
results <- private$.compute(data) | ||
|
||
# populate rater table----- | ||
|
||
private$.populateRaterTable(results) | ||
|
||
|
||
# prepare plot----- | ||
|
||
private$.prepareGgmPlot(data) | ||
|
||
} | ||
}, | ||
|
||
# compute results===================================================== | ||
|
||
.compute = function(data) { | ||
|
||
# get variables------ | ||
|
||
data <- self$data | ||
|
||
vars <- self$options$get('vars') | ||
|
||
|
||
# for(v in vars) | ||
# data[[v]] <- jmvcore::toNumeric(data[[v]]) | ||
|
||
# compute Light's Kappa----- | ||
|
||
res<- irr::kappam.light(ratings=data) | ||
|
||
# get subjects------- | ||
|
||
n <- res$subjects | ||
|
||
# get raters-------- | ||
|
||
rater <- res$raters | ||
|
||
# get statistic------------ | ||
|
||
statistic <- res$value | ||
|
||
# z value---------------- | ||
|
||
z <- res$statistic | ||
|
||
# p value------------------- | ||
|
||
p <- res$p.value | ||
|
||
results <- | ||
list( | ||
'n' = n, | ||
'rater' = rater, | ||
'statistic' = statistic, | ||
'z' = z, | ||
'p' = p | ||
|
||
) | ||
|
||
}, | ||
|
||
|
||
# populate rater table----- | ||
|
||
.populateRaterTable = function(results) { | ||
|
||
table <- self$results$interrater | ||
|
||
n <- results$n | ||
rater <- results$rater | ||
statistic <- results$statistic | ||
z <- results$z | ||
p <- results$p | ||
|
||
|
||
row <- list() | ||
|
||
row[['n']] <- n | ||
row[['rater']] <- rater | ||
row[['statistic']] <- statistic | ||
row[['z']] <- z | ||
row[['p']] <- p | ||
|
||
table$setRow(rowNo = 1, values = row) | ||
|
||
}, | ||
|
||
|
||
#### Plot functions ---- | ||
|
||
.prepareGgmPlot = function(data) { | ||
|
||
# Gaussian Graphical Models with polychoric correlation---------------- | ||
|
||
poly <- psych::polychoric(data)$rho | ||
partial <- psych::partial.r(poly) | ||
|
||
# Prepare Data For Plot ------- | ||
image <- self$results$plot | ||
image$setState(partial) | ||
|
||
|
||
|
||
}, | ||
|
||
|
||
#================================================================ | ||
|
||
.plot = function(image, ...) { | ||
ggm <- self$options$ggm | ||
|
||
if (!ggm) | ||
return() | ||
|
||
|
||
partial <- image$state | ||
|
||
plot <- qgraph(partial, layout = "spring", details = TRUE) | ||
|
||
print(plot) | ||
TRUE | ||
}, | ||
|
||
|
||
#### Helper functions ================================= | ||
|
||
.cleanData = function() { | ||
items <- self$options$vars | ||
|
||
data <- list() | ||
|
||
for (item in items) | ||
data[[item]] <- jmvcore::toNumeric(self$data[[item]]) | ||
|
||
attr(data, 'row.names') <- seq_len(length(data[[1]])) | ||
attr(data, 'class') <- 'data.frame' | ||
data <- jmvcore::naOmit(data) | ||
|
||
return(data) | ||
} | ||
) | ||
) | ||
|
||
|
||
|
Oops, something went wrong.