CRAN Package Check Results for Package MultiGHQuad

Last updated on 2022-04-27 11:54:02 CEST.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.2.0 8.06 109.31 117.37 OK
r-devel-linux-x86_64-debian-gcc 1.2.0 5.87 78.75 84.62 OK
r-devel-linux-x86_64-fedora-clang 1.2.0 134.84 ERROR
r-devel-linux-x86_64-fedora-gcc 1.2.0 130.76 ERROR
r-devel-windows-x86_64 1.2.0 17.00 127.00 144.00 OK
r-patched-linux-x86_64 1.2.0 5.43 101.94 107.37 OK
r-release-linux-x86_64 1.2.0 6.94 103.53 110.47 OK
r-release-macos-arm64 1.2.0 36.00 OK
r-release-macos-x86_64 1.2.0 64.00 OK
r-release-windows-x86_64 1.2.0 19.00 125.00 144.00 OK
r-oldrel-macos-arm64 1.2.0 46.00 OK
r-oldrel-macos-x86_64 1.2.0 67.00 OK
r-oldrel-windows-ix86+x86_64 1.2.0 15.00 112.00 127.00 OK

Check Details

Version: 1.2.0
Check: examples
Result: ERROR
    Running examples in ‘MultiGHQuad-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: eval.quad
    > ### Title: Evaluation of multivariate normal distributed expectations
    > ### Aliases: eval.quad
    >
    > ### ** Examples
    >
    > ### Basic example; E(X), X ~ N(0,1)
    > grid <- init.quad(Q = 1, prior = list(mu = 0, Sigma = diag(1)))
    > eval.quad(X = grid)
    [1] -2.178954e-16
    attr(,"variance")
     [,1]
    [1,] 1
    >
    > ### Example; Rasch model person parameter
    > # E(theta), theta ~ N(0,1) * P(X = 1 | theta, beta), P is simplified rasch model
    > # set up rasch model with fixed beta, returns LL
    > rasch <- function(theta, beta, responses){
    + p <- exp(theta - beta)/(1 + exp(theta - beta))
    + q <- 1 - p
    + return(log(p) * sum(responses == 1) + log(q) * sum(responses == 0))
    + }
    >
    > # when theta == beta, P(X = 1) = .5, generate some bernoulli trials with p = .5
    > responses <- rbinom(5, 1, .5)
    >
    > # get EAP estimate for theta, prior N(0,1)
    > eval.quad(rasch, grid, beta = 0, responses = responses)
    [1] -0.2471169
    attr(,"variance")
     [,1]
    [1,] 0.4852284
    >
    > # with more data, the estimate becomes more accurate, and variance decreases
    > eval.quad(rasch, grid, beta = 0, responses = rbinom(20, 1, .5))
    [1] 0.3393648
    attr(,"variance")
     [,1]
    [1,] 0.2671098
    > eval.quad(rasch, grid, beta = 0, responses = rbinom(50, 1, .5))
    [1] -0.5869554
    attr(,"variance")
     [,1]
    [1,] 0.0358114
    > eval.quad(rasch, grid, beta = 0, responses = rbinom(100, 1, .5))
    [1] -1.80146e-16
    attr(,"variance")
     [,1]
    [1,] 0.380327
    >
    > ### problem; the result starts to 'snap' to the closest quadrature point when
    > # the posterior distribution is too dissimilar to the prior.
    > evals <- eval.quad(rasch, grid, beta = 0, responses = rbinom(100, 1, .5), debug = TRUE)
    > evals.values <- attr(evals, "values")
    >
    > # posterior density after 40 items
    > p <- plot(function(x) exp(dnorm(x, log = TRUE) +
    + rasch(x, beta = 1, responses = rbinom(100, 1, .5))),
    + from = -3, to = 3)
    >
    > # quadrature points used
    > points(grid$X, exp(grid$W)*max(p$y), pch = 20)
    >
    > # the evaluation relies almost completely on one quadrature point,
    > # which causes results to 'snap' to that point.
    > # we could add more quadrature points...
    > grid2 <- init.quad(Q = 1, ip = 20)
    > points(grid2$X, exp(grid2$W)*max(p$y), pch = 20, col = "grey")
    >
    > # but if the posterior is not centered on the prior, this quickly fails:
    > p <- plot(function(x) exp(dnorm(x, log = TRUE) +
    + rasch(x, beta = 2, responses = rbinom(100, 1, .5))),
    + from = -3, to = 3)
    > points(grid2$X, exp(grid2$W)*max(p$y), pch = 20, col = "grey")
    >
    > # additionally, adding extra quadrature points in a multidimensional
    > # problem quickly grows out of control.
    >
    > ### a better solution; adaptive quadrature grid.
    > # say we have an idea of where our parameter is located, through another estimator,
    > # or a previous estimate.
    > # we can then use this to adapt where our quadrature grid should be.
    > # get an estimate;
    > responses <- rbinom(10, 1, .5)
    > est <- eval.quad(rasch, grid, beta = 2, responses = responses)
    > print( est )
    [1] 1.751766
    attr(,"variance")
     [,1]
    [1,] 0.2102369
    >
    > # adapt the grid;
    > grid3 <- init.quad(Q = 1, adapt = est)
    Error in !is.list(adapt) || length(adapt$mu) != Q || dim(adapt$Sigma) != :
     'length = 2' in coercion to 'logical(1)'
    Calls: init.quad
    Execution halted
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc

Version: 1.2.0
Check: tests
Result: ERROR
     Running ‘testthat.R’ [39s/48s]
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
     > library(testthat)
     > library(MultiGHQuad)
     Loading required package: mvtnorm
     Loading required package: Matrix
     >
     > test_check("MultiGHQuad")
     [ FAIL 2 | WARN 0 | SKIP 0 | PASS 84 ]
    
     ══ Failed tests ════════════════════════════════════════════════════════════════
     ── Error (test_generate_quadpoints.R:22:3): Adapt accepts previous estimate ────
     Error in `!is.list(adapt) || length(adapt$mu) != Q || dim(adapt$Sigma) !=
     c(Q, Q)`: 'length = 2' in coercion to 'logical(1)'
     Backtrace:
     ▆
     1. ├─testthat::expect_is(init.quad(2, adapt = estimate), "list") at test_generate_quadpoints.R:22:2
     2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
     3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
     4. └─MultiGHQuad::init.quad(2, adapt = estimate)
     ── Error (test_generate_quadpoints.R:32:3): Adapt accepts list ─────────────────
     Error in `!is.list(adapt) || length(adapt$mu) != Q || dim(adapt$Sigma) !=
     c(Q, Q)`: 'length = 2' in coercion to 'logical(1)'
     Backtrace:
     ▆
     1. ├─testthat::expect_is(init.quad(2, adapt = adapt), "list") at test_generate_quadpoints.R:32:2
     2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
     3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
     4. └─MultiGHQuad::init.quad(2, adapt = adapt)
    
     [ FAIL 2 | WARN 0 | SKIP 0 | PASS 84 ]
     Error: Test failures
     Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang

Version: 1.2.0
Check: tests
Result: ERROR
     Running ‘testthat.R’ [40s/44s]
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
     > library(testthat)
     > library(MultiGHQuad)
     Loading required package: mvtnorm
     Loading required package: Matrix
     >
     > test_check("MultiGHQuad")
     [ FAIL 2 | WARN 0 | SKIP 0 | PASS 84 ]
    
     ══ Failed tests ════════════════════════════════════════════════════════════════
     ── Error (test_generate_quadpoints.R:22:3): Adapt accepts previous estimate ────
     Error in `!is.list(adapt) || length(adapt$mu) != Q || dim(adapt$Sigma) !=
     c(Q, Q)`: 'length = 2' in coercion to 'logical(1)'
     Backtrace:
     ▆
     1. ├─testthat::expect_is(init.quad(2, adapt = estimate), "list") at test_generate_quadpoints.R:22:2
     2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
     3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
     4. └─MultiGHQuad::init.quad(2, adapt = estimate)
     ── Error (test_generate_quadpoints.R:32:3): Adapt accepts list ─────────────────
     Error in `!is.list(adapt) || length(adapt$mu) != Q || dim(adapt$Sigma) !=
     c(Q, Q)`: 'length = 2' in coercion to 'logical(1)'
     Backtrace:
     ▆
     1. ├─testthat::expect_is(init.quad(2, adapt = adapt), "list") at test_generate_quadpoints.R:32:2
     2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
     3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
     4. └─MultiGHQuad::init.quad(2, adapt = adapt)
    
     [ FAIL 2 | WARN 0 | SKIP 0 | PASS 84 ]
     Error: Test failures
     Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc