Skip to content

Commit

Permalink
Merge branch 'hotfix-outofbounds-b'
Browse files Browse the repository at this point in the history
  • Loading branch information
wleoncio committed Sep 10, 2020
2 parents edb04ee + 522f151 commit 14a6608
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 65 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
^cran-comments\.md$
^desktop\.ini$
gendat3*
.vscode
.vscode
doc
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ Thumbs.db
desktop.ini

# Test files
gendat3*
gendat3*
doc
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: lsasim
Title: Functions to Facilitate the Simulation of Large Scale Assessment Data
Version: 2.0.1
Version: 2.0.2
Authors@R: c(
person("Tyler", "Matta",
email = "[email protected]", role = "aut"),
Expand All @@ -13,9 +13,9 @@ Authors@R: c(
person("Kondwani Kajera", "Mughogho",
email = "[email protected]", role = "ctb"),
person("Waldir", "Leoncio",
email = "[email protected]", role = c("aut", "cre"))
email = "[email protected]", role = c("aut", "cre"))
)
Maintainer: Waldir Leoncio <[email protected]>
Maintainer: Waldir Leoncio <[email protected]>
BugReports: https://github.com/tmatta/lsasim/issues
Description: Provides functions to simulate data from large-scale educational
assessments, including background questionnaire data and cognitive item
Expand All @@ -26,5 +26,5 @@ Depends:
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.0.2
RoxygenNote: 7.1.1
Suggests: testthat, polycor
54 changes: 27 additions & 27 deletions R/item_gen.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,44 +130,44 @@ item_gen <- function(b_bounds, a_bounds = NULL, c_bounds = NULL,

}

b_mean <- mean(unlist(b_par))
b_center <- lapply(b_par, function(x) round(x - b_mean, 2))

#-- b_star is the average difficulty for each item
#-- For dicotomous items, b_star = b_center
b_star <- lapply(b_center, function(x) round(mean(x), 2))
b_par <- do.call("rbind", b_star)

d <- list()
for (p in 1:i) {
d_i <- list()

if (k[p] != 1) {
if (sum(thresholds) > 1) {

d_i[[p]] <- rep(0, max(k))
for(j in 1:k[p]) d_i[[p]][j] <- b_center[[p]][j] - b_star[[p]]

} else {
b_star <- lapply(b_par, mean)

d_i[[p]] <- rep(0, max(k))
d_i <- list()

}
for (pp in 1:i) {

d[[p]] <- unlist(d_i)
if (k[pp] != 1) {

}
d_i[[pp]] <- b_par[[pp]] - b_star[[pp]]

} else {

d_i[[pp]] <- rep(0, max(k))

}

}

d_par <- round(do.call("rbind", d_i), 2)

dlabs <- paste0("d", 1:ncol(d_par))

d_par <- do.call("rbind", d)

dlabs <- paste0("d", 1:ncol(d_par))
b_star <- round(do.call("rbind", b_star), 2)

if (sum(thresholds) > 1){
item_parameters <- data.frame(item = item_no, b = b_par, d = d_par, a = a_par, c = c_par, k = k, p = item_type)
item_parameters <- data.frame(item = item_no, b = b_star, d = d_par, a = a_par, c = c_par, k = k, p = item_type)
colnames(item_parameters) <- c("item", "b", dlabs, "a", "c", "k", "p")

}
if (sum(thresholds) == 1){

if (sum(thresholds) == 1) {

b_par <- round(do.call("rbind", b_par), 2)

item_parameters <- data.frame(item = item_no, b = b_par, a = a_par, c = c_par, k = k, p = item_type)
colnames(item_parameters) <- c("item", "b", "a", "c", "k", "p")

}


Expand Down
3 changes: 2 additions & 1 deletion R/lsasim.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#' lsasim: A package for simulating large scale assessment data
#' @title lsasim: A package for simulating large scale assessment data
#' @description lsasim simulates data that mimics large-scale assessments (LSAs), including background questionnaire data and cognitive item responses that adhere to a multiple-matrix sampled design
#'
#' @section Core functions:
#' \itemize{
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/tmatta/lsasim.svg?branch=master)](https://travis-ci.org/tmatta/lsasim)
![Current CRAN release](https://www.r-pkg.org/badges/version/lsasim) [![Build Status](https://travis-ci.org/tmatta/lsasim.svg?branch=master)](https://travis-ci.org/tmatta/lsasim)

# README

Expand Down
11 changes: 9 additions & 2 deletions man/beta_gen.Rd

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

3 changes: 1 addition & 2 deletions man/block_design.Rd

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

10 changes: 8 additions & 2 deletions man/booklet_sample.Rd

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

11 changes: 9 additions & 2 deletions man/item_gen.Rd

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

3 changes: 1 addition & 2 deletions man/lsasim.Rd

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

6 changes: 4 additions & 2 deletions man/pisa2012_math_block.Rd

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

6 changes: 4 additions & 2 deletions man/pisa2012_math_booklet.Rd

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

6 changes: 4 additions & 2 deletions man/pisa2012_math_item.Rd

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

4 changes: 3 additions & 1 deletion man/pisa2012_q_cormat.Rd

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

4 changes: 3 additions & 1 deletion man/pisa2012_q_marginal.Rd

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

19 changes: 15 additions & 4 deletions man/questionnaire_gen.Rd

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

11 changes: 9 additions & 2 deletions man/questionnaire_gen_family.Rd

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

3 changes: 1 addition & 2 deletions man/questionnaire_gen_polychoric.Rd

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

13 changes: 11 additions & 2 deletions man/response_gen.Rd

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

14 changes: 12 additions & 2 deletions man/run_condition_checks.Rd

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

0 comments on commit 14a6608

Please sign in to comment.