Skip to content

Commit

Permalink
3.10-67
Browse files Browse the repository at this point in the history
  • Loading branch information
Robitzsch committed Sep 5, 2020
1 parent a9f866e commit bb7d13a
Show file tree
Hide file tree
Showing 22 changed files with 135 additions and 76 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: sirt
Type: Package
Title: Supplementary Item Response Theory Models
Version: 3.10-64
Date: 2020-08-29 14:27:25
Version: 3.10-67
Date: 2020-09-05 17:32:52
Author: Alexander Robitzsch [aut,cre] (<https://orcid.org/0000-0002-8226-3132>)
Maintainer: Alexander Robitzsch <[email protected]>
Description:
Expand Down
2 changes: 1 addition & 1 deletion R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## File Name: RcppExports.R
## File Version: 3.010064
## File Version: 3.010067
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

Expand Down
13 changes: 9 additions & 4 deletions R/ccov.np.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## File Name: ccov.np.R
## File Version: 1.208
## File Version: 1.216


#---- nonparametric estimation of conditional covariance
ccov.np <- function( data, score, bwscale=1.1, thetagrid=seq( -3,3,len=200),
progress=TRUE, scale_score=TRUE, adjust_thetagrid=TRUE, smooth=TRUE,
use_sum_score=FALSE)
use_sum_score=FALSE, bias_corr=TRUE)
{
# number of Items I
I <- ncol(data)
Expand Down Expand Up @@ -94,7 +94,11 @@ ccov.np <- function( data, score, bwscale=1.1, thetagrid=seq( -3,3,len=200),
if (use_sum_score){
res1 <- ccov_np_compute_ccov_sum_score(score=score.ff, data=data.ff)
score_ff2 <- score.ff - data.ff[,1] - data.ff[,2]
res2 <- ccov_np_compute_ccov_sum_score(score=score_ff2, data=data.ff)
if (bias_corr){
res2 <- ccov_np_compute_ccov_sum_score(score=score_ff2, data=data.ff)
} else {
res2 <- res1
}
ccov_sum_score[ff] <- ( res1$ccov_aggr + res2$ccov_aggr ) / 2
}

Expand All @@ -116,7 +120,8 @@ ccov.np <- function( data, score, bwscale=1.1, thetagrid=seq( -3,3,len=200),
#--- output
res <- list( ccov.table=ccov.table, ccov.matrix=ccov.matrix,
data=data, score=score, icc.items=icc_items,
wgt.thetagrid=wgt_thetagrid)
wgt.thetagrid=wgt_thetagrid, use_sum_score=use_sum_score,
bias_corr=bias_corr, scale_score=scale_score)
return(res)
}

3 changes: 2 additions & 1 deletion R/ccov_np_compute_ccov_sum_score.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## File Name: ccov_np_compute_ccov_sum_score.R
## File Version: 0.10
## File Version: 0.15

ccov_np_compute_ccov_sum_score <- function(score, data, use_rcpp=TRUE)
{
Expand All @@ -13,6 +13,7 @@ ccov_np_compute_ccov_sum_score <- function(score, data, use_rcpp=TRUE)
s1 <- stats::cov.wt(x=data[i1,], method="ML")
ccov_ff[ss] <- s1$cov[1,2]
}
ccov_ff[is.na(ccov_ff)] <- 0
} else {
index <- match(score, scores)-1
ccov_ff <- sirt_rcpp_ccov_np_compute_ccov_sum_score( index=index,
Expand Down
28 changes: 15 additions & 13 deletions R/conf.detect.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## File Name: conf.detect.R
## File Version: 1.198
## File Version: 1.206


# Confirmatory DETECT analysis
conf.detect <- function( data, score, itemcluster, bwscale=1.1, progress=TRUE,
thetagrid=seq( -3,3,len=200), smooth=TRUE, use_sum_score=FALSE)
thetagrid=seq( -3,3,len=200), smooth=TRUE, use_sum_score=FALSE,
bias_corr=TRUE)
{
CALL <- match.call()
cat("-----------------------------------------------------------\n" )
Expand All @@ -23,24 +24,25 @@ conf.detect <- function( data, score, itemcluster, bwscale=1.1, progress=TRUE,
}
cat(paste("Bandwidth Scale:", bwscale, "\n" ) )
utils::flush.console()
if ( ! h1 ){
scale_score <- TRUE
if (!smooth){
scale_score <- FALSE
}
ccovtable <- ccov.np( data=data, score=score, bwscale=bwscale,
scale_score <- TRUE
if (!smooth){
scale_score <- FALSE
}
args_ccov_np <- list( data=data, score=score, bwscale=bwscale,
progress=progress, thetagrid=thetagrid, smooth=smooth,
scale_score=scale_score, use_sum_score=use_sum_score)
scale_score=scale_score, use_sum_score=use_sum_score,
bias_corr=bias_corr)
if ( ! h1 ){
ccovtable <- do.call( what=ccov.np, args=args_ccov_np)
res <- detect.index( ccovtable=ccovtable, itemcluster=itemcluster )
} else {
ccovtable.list <- list()
args_ccov_np$progress <- FALSE
for (pp in 1:PP){
cat( paste( "DETECT Calculation Score ", pp, "\n", sep="") ) ;
utils::flush.console()
ccovtable.list[[pp]] <- ccov.np( data=data, score=score[,pp],
bwscale=bwscale, smooth=smooth, progress=FALSE,
scale_score=scale_score, thetagrid=thetagrid,
use_sum_score=use_sum_score)
args_ccov_np$score <- score[,pp]
ccovtable.list[[pp]] <- do.call( what=ccov.np, args=args_ccov_np)
}
detect.list <- lapply( ccovtable.list, FUN=function(ccovtable){
detect.index( ccovtable, itemcluster=itemcluster ) } )
Expand Down
4 changes: 2 additions & 2 deletions R/create.ccov.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## File Name: create.ccov.R
## File Version: 1.07
## File Version: 1.08


#**** auxiliary function for creating a covariance matrix
Expand All @@ -15,7 +15,7 @@ create.ccov <- function( cc, data )
ccov.matrix[ ccc$item2ID[ll], ccc$item1ID[ll] ] <-
ccov.matrix[ ccc$item1ID[ll], ccc$item2ID[ll] ]
}
return( ccov.matrix)
return(ccov.matrix)
}


Expand Down
36 changes: 21 additions & 15 deletions R/expl.detect.R
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
## File Name: expl.detect.R
## File Version: 1.24
## File Version: 1.308


#**** Exploratory DETECT analysis
expl.detect <- function( data, score, nclusters, N.est=NULL, seed=NULL,
bwscale=1.1, use_sum_score=FALSE )
bwscale=1.1, smooth=TRUE, use_sum_score=FALSE, hclust_method="ward.D",
estsample=NULL)
{
if ( ! is.null(seed) ){
set.seed(seed)
}
smooth <- TRUE
# number of items
I <- ncol(data)
if (use_sum_score){
smooth <- FALSE
score <- rowSums(data)
}
if (!smooth){
scale_score <- FALSE
}
# sample for estimation
N <- nrow(data)
if ( is.null( N.est ) ){
N.est <- floor(N/2)
}
estsample <- sort( sample( 1:N, floor( N.est ) ) )
if (is.null(estsample)){
estsample <- sort( sample( 1:N, floor( N.est ) ) )
}
# validation sample
valsample <- setdiff( 1:N, estsample )
#**********************************
# Maximizing DETECT index
#**********************************

#--- Maximizing DETECT index
# nonparametric estimation of conditional covariance
cc <- ccov.np( data=data[ estsample,], score=score[estsample], bwscale=bwscale,
smooth=smooth, use_sum_score=use_sum_score)
ccov_np_args <- list( data=data[ estsample,], score=score[estsample],
bwscale=bwscale, smooth=smooth, use_sum_score=use_sum_score,
scale_score=scale_score)
cc_est <- cc <- do.call( what=ccov.np, args=ccov_np_args)
ccov.matrix <- create.ccov( cc=cc, data=data[ estsample,] )
# create distance matrix
cc1 <- max(ccov.matrix) - ccov.matrix
# Ward Hierarchical Clustering
d <- stats::as.dist(cc1)
fit <- stats::hclust(d, method="ward.D") # hierarchical cluster analysis
fit <- stats::hclust(d, method=hclust_method) # hierarchical cluster analysis
clusterfit <- fit
itemcluster <- data.frame( matrix( 0, I, nclusters ) )
itemcluster[,1] <- colnames(data)
Expand All @@ -59,12 +65,12 @@ expl.detect <- function( data, score, nclusters, N.est=NULL, seed=NULL,
} )
detu <- data.frame( dfr1, detect.unweighted )
detw <- data.frame( dfr1, detect.weighted )
#************************************
# Validating DETECT index
#************************************

#--- Validating DETECT index
if ( length(valsample) > 0 ){
cc <- ccov.np( data=data[ valsample,], score=score[valsample],
bwscale=bwscale, smooth=smooth, use_sum_score=use_sum_score )
ccov_np_args$data=data[ valsample,]
ccov_np_args$score=score[valsample]
cc <- do.call( what=ccov.np, args=ccov_np_args)
detect.unweighted <- detect.weighted <- NULL
for (k in 2:nclusters){
h1 <- detect.index( ccovtable=cc, itemcluster=itemcluster[,k] )
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ The CRAN version can be installed from within R using:
utils::install.packages("sirt")
```

#### GitHub version `sirt` 3.10-64 (2020-08-29)
#### GitHub version `sirt` 3.10-67 (2020-09-05)

[![](https://img.shields.io/badge/github%20version-3.10--64-orange.svg)](https://github.com/alexanderrobitzsch/sirt)&#160;&#160;
[![](https://img.shields.io/badge/github%20version-3.10--67-orange.svg)](https://github.com/alexanderrobitzsch/sirt)&#160;&#160;

The version hosted [here](https://github.com/alexanderrobitzsch/sirt) is the development version of `sirt`.
The GitHub version can be installed using `devtools` as:
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pandoc: 1.13.1
pkgdown: 1.5.1
pkgdown_sha: ~
articles: []
last_built: 2020-08-29T12:54Z
last_built: 2020-09-05T15:54Z

7 changes: 6 additions & 1 deletion docs/reference/ccov.np.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion docs/reference/conf.detect.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 22 additions & 6 deletions docs/reference/expl.detect.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bb7d13a

Please sign in to comment.