Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(pifpaf)
  > 
  > test_check("pifpaf")
  1. Error: Checking paf.confidence (@test_paf_confidence.R#7) -------------------
  'x' and 'w' must have the same length
  1: expect_equal({
         set.seed(76787)
         X <- as.data.frame(rnorm(100, 3, 1))
         thetahat <- 0.2
         thetavar <- 0
         rr <- function(X, theta) {
             exp(X * theta)
         }
         paf.confidence(X = X, thetahat = thetahat, rr = rr, thetavar = thetavar, method = "empirical", 
             confidence_method = "inverse")
     }, {
         paf.confidence.inverse(X = X, thetahat = thetahat, rr = rr, thetavar = thetavar, 
             method = "empirical")
     }) at testthat/test_paf_confidence.R:7
  2: compare(object, expected, ...)
  3: paf.confidence(X = X, thetahat = thetahat, rr = rr, thetavar = thetavar, method = "empirical", 
         confidence_method = "inverse") at testthat/test_paf_confidence.R:13
  4: paf.confidence.inverse(X = X, thetahat = thetahat, rr = rr, thetavar = thetavar, 
         weights = weights, method = method, nsim = nsim, confidence = confidence, deriv.method.args = deriv.method.args, 
         deriv.method = deriv.method, force.min = force.min, check_thetas = check_thetas, 
         Xvar = Xvar)
  5: risk.ratio.confidence(X = X, thetahat = thetahat, rr = rr, thetavar = .thetavar, 
         weights = weights, nsim = nsim, confidence = confidence, check_thetas = check_thetas, 
         force.min = force.min)
  6: .Variance(.thetasim[i, ])
  7: weighted.mean((rr(.X, .theta) - .Risk(.theta))^2, weights)
  8: weighted.mean.default((rr(.X, .theta) - .Risk(.theta))^2, weights)
  9: stop("'x' and 'w' must have the same length")
  
  2. Error: Checking paf.confidence.inverse (@test_paf_confidence_inverse.R#53) --
  'x' and 'w' must have the same length
  1: expect_equal({
         set.seed(347618)
         X <- as.data.frame(rep(0, 100))
         thetahat <- 0.2
         thetavar <- 0.02
         rr <- function(X, theta) {
             exp(X * theta)
         }
         paf.confidence.inverse(X = X, thetahat = thetahat, rr = rr, thetavar = thetavar, 
             method = "empirical")
     }, c(Lower_CI = 0, Point_Estimate = 0, Upper_CI = 0)) at testthat/test_paf_confidence_inverse.R:53
  2: compare(object, expected, ...)
  3: paf.confidence.inverse(X = X, thetahat = thetahat, rr = rr, thetavar = thetavar, 
         method = "empirical") at testthat/test_paf_confidence_inverse.R:59
  4: risk.ratio.confidence(X = X, thetahat = thetahat, rr = rr, thetavar = .thetavar, 
         weights = weights, nsim = nsim, confidence = confidence, check_thetas = check_thetas, 
         force.min = force.min)
  5: .Variance(.thetasim[i, ])
  6: weighted.mean((rr(.X, .theta) - .Risk(.theta))^2, weights)
  7: weighted.mean.default((rr(.X, .theta) - .Risk(.theta))^2, weights)
  8: stop("'x' and 'w' must have the same length")
  
  3. Error: Checking paf.confidence.one2one (@test_paf_confidence_one_to_one.R#99) 
  'x' and 'w' must have the same length
  1: expect_equal({
         Xmean <- as.data.frame(rep(0, 100))
         thetahat <- c(1.4, 1.3)
         thetalow <- c(1.1, 1.23)
         thetaup <- c(1.5, 1.4)
         rr <- function(X, theta) {
             exp(X * theta[1] * theta[2])
         }
         paf.confidence.one2one(X = Xmean, thetahat = thetahat, rr = rr, thetalow = thetalow, 
             thetaup = thetaup, method = "empirical")
     }, c(Lower_CI = 0, Point_Estimate = 0, Upper_CI = 0)) at testthat/test_paf_confidence_one_to_one.R:99
  2: compare(object, expected, ...)
  3: paf.confidence.one2one(X = Xmean, thetahat = thetahat, rr = rr, thetalow = thetalow, 
         thetaup = thetaup, method = "empirical") at testthat/test_paf_confidence_one_to_one.R:105
  4: paf.confidence.inverse(X, thetahat = thetaup, rr = rr, thetavar = .thetavar, weights = weights, 
         method = .method, nsim = 1, confidence = .confidence, deriv.method.args = deriv.method.args, 
         deriv.method = deriv.method, force.min = FALSE, check_thetas = check_thetas, 
         Xvar = Xvar)
  5: risk.ratio.confidence(X = X, thetahat = thetahat, rr = rr, thetavar = .thetavar, 
         weights = weights, nsim = nsim, confidence = confidence, check_thetas = check_thetas, 
         force.min = force.min)
  6: .Variance(.thetasim[i, ])
  7: weighted.mean((rr(.X, .theta) - .Risk(.theta))^2, weights)
  8: weighted.mean.default((rr(.X, .theta) - .Risk(.theta))^2, weights)
  9: stop("'x' and 'w' must have the same length")
  
  testthat results ================================================================
  OK: 93 SKIPPED: 0 FAILED: 3
  1. Error: Checking paf.confidence (@test_paf_confidence.R#7) 
  2. Error: Checking paf.confidence.inverse (@test_paf_confidence_inverse.R#53) 
  3. Error: Checking paf.confidence.one2one (@test_paf_confidence_one_to_one.R#99) 
  
  Error: testthat unit tests failed
  Execution halted