Last updated on 2018-02-25 00:48:53 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.1.3 | 8.49 | 345.76 | 354.25 | OK | |
r-devel-linux-x86_64-debian-gcc | 0.1.3 | 6.62 | 258.13 | 264.75 | OK | |
r-devel-linux-x86_64-fedora-clang | 0.1.3 | 413.06 | OK | |||
r-devel-linux-x86_64-fedora-gcc | 0.1.3 | 398.31 | OK | |||
r-devel-windows-ix86+x86_64 | 0.1.3 | 21.00 | 523.00 | 544.00 | OK | |
r-patched-linux-x86_64 | 0.1.3 | 6.30 | 392.10 | 398.40 | OK | |
r-patched-solaris-x86 | 0.1.3 | 586.50 | ERROR | |||
r-release-linux-x86_64 | 0.1.3 | 5.42 | 392.12 | 397.54 | OK | |
r-release-windows-ix86+x86_64 | 0.1.3 | 19.00 | 561.00 | 580.00 | OK | |
r-release-osx-x86_64 | 0.1.3 | OK | ||||
r-oldrel-windows-ix86+x86_64 | 0.1.3 | 15.00 | 421.00 | 436.00 | OK | |
r-oldrel-osx-x86_64 | 0.1.2 | OK |
Version: 0.1.3
Check: examples
Result: ERROR
Running examples in ‘personalized-Ex.R’ failed
The error most likely occurred in:
> ### Name: check.overlap
> ### Title: Check propensity score overlap
> ### Aliases: check.overlap
>
> ### ** Examples
>
> library(personalized)
>
> set.seed(123)
> n.obs <- 250
> n.vars <- 15
> x <- matrix(rnorm(n.obs * n.vars, sd = 3), n.obs, n.vars)
>
>
> # simulate non-randomized treatment
> xbetat <- 0.25 + 0.5 * x[,11] - 0.5 * x[,12]
> trt.prob <- exp(xbetat) / (1 + exp(xbetat))
> trt01 <- rbinom(n.obs, 1, prob = trt.prob)
>
> # create function for fitting propensity score model
> prop.func <- function(x, trt)
+ {
+ # fit propensity score model
+ propens.model <- cv.glmnet(y = trt,
+ x = x, family = "binomial")
+ pi.x <- predict(propens.model, s = "lambda.min",
+ newx = x, type = "response")[,1]
+ pi.x
+ }
>
> check.overlap(x = x,
+ trt = trt01,
+ propensity.func = prop.func)
>
> # now add density plot with histogram
> check.overlap(x = x,
+ trt = trt01,
+ type = "both",
+ propensity.func = prop.func)
>
>
> # simulated non-randomized treatment with multiple levels
> xbetat_1 <- 0.15 + 0.5 * x[,9] - 0.25 * x[,12]
> xbetat_2 <- 0.15 - 0.5 * x[,11] + 0.25 * x[,15]
> trt.1.prob <- exp(xbetat_1) / (1 + exp(xbetat_1) + exp(xbetat_2))
> trt.2.prob <- exp(xbetat_2) / (1 + exp(xbetat_1) + exp(xbetat_2))
> trt.3.prob <- 1 - (trt.1.prob + trt.2.prob)
> prob.mat <- cbind(trt.1.prob, trt.2.prob, trt.3.prob)
> trt <- apply(prob.mat, 1, function(rr) rmultinom(1, 1, prob = rr))
> trt <- apply(trt, 2, function(rr) which(rr == 1))
>
> # use multinomial logistic regression model with lasso penalty for propensity
> propensity.multinom.lasso <- function(x, trt)
+ {
+ if (!is.factor(trt)) trt <- as.factor(trt)
+ gfit <- cv.glmnet(y = trt, x = x, family = "multinomial")
+
+ # predict returns a matrix of probabilities:
+ # one column for each treatment level
+ propens <- drop(predict(gfit, newx = x, type = "response", s = "lambda.min",
+ nfolds = 5, alpha = 0))
+
+ # return the probability corresponding to the
+ # treatment that was observed
+ probs <- propens[,match(levels(trt), colnames(propens))]
+
+ probs
+ }
>
> check.overlap(x = x,
+ trt = trt,
+ type = "histogram",
+ propensity.func = propensity.multinom.lasso)
Error in apply(nz, 1, median) : dim(X) must have a positive length
Calls: check.overlap -> propensity.func -> cv.glmnet -> apply
Execution halted
Flavor: r-patched-solaris-x86
Version: 0.1.3
Check: tests
Result: ERROR
Running ‘testthat.R’ [243s/276s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> Sys.setenv("R_TESTS" = "")
> library(testthat)
> library(personalized)
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-13
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-23. For overview type 'help("mgcv-package")'.
Loading required package: gbm
Loading required package: survival
Loading required package: lattice
Loading required package: splines
Loading required package: parallel
Loaded gbm 2.1.3
Loading required package: ggplot2
Loading required package: plotly
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
>
> test_check("personalized")
── 1. Error: test plot is returned for hist/density/both (@test-checkoverlap.R#1
dim(X) must have a positive length
1: check.overlap(x = x, trt = trt, type = "histogram", propensity.func = propensity.multinom.lasso) at testthat/test-checkoverlap.R:117
2: propensity.func(x = x, trt = trt)
3: cv.glmnet(y = trt, x = x, family = "multinomial") at testthat/test-checkoverlap.R:103
4: apply(nz, 1, median)
5: stop("dim(X) must have a positive length")
── 2. Error: test fit.subgroup for continuous outcomes and multiple trts and var
dim(X) must have a positive length
1: fit.subgroup(x = x, y = y, trt = trt, propensity.func = propensity.multinom.lasso,
loss = "sq_loss_lasso", nfolds = 5) at testthat/test-fitsubgroup.R:1202
2: propensity.func(x = x, trt = trt)
3: cv.glmnet(y = trt, x = x, family = "multinomial") at testthat/test-fitsubgroup.R:1170
4: apply(nz, 1, median)
5: stop("dim(X) must have a positive length")
══ testthat results ═══════════════════════════════════════════════════════════
OK: 580 SKIPPED: 0 FAILED: 2
1. Error: test plot is returned for hist/density/both (@test-checkoverlap.R#117)
2. Error: test fit.subgroup for continuous outcomes and multiple trts and various losses (@test-fitsubgroup.R#1202)
Error: testthat unit tests failed
Execution halted
Flavor: r-patched-solaris-x86