joshuaschwab / ltmle

Longitudinal Targeted Maximum Likelihood Estimation package
http://joshuaschwab.github.io/ltmle/
23 stars 16 forks source link

Examples and tests fail when suggested packages are not installed #13

Open hadley opened 9 years ago

hadley commented 9 years ago
checking examples ... ERROR
Running examples in ‘ltmle-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: deterministic.g.function_template
> ### Title: Deterministic g/Q functions - examples and templates
> ### Aliases: MaintainTreatment MaintainControl
> ###   deterministic.g.function_template deterministic.Q.function_template
> 
> ### ** Examples
> 
>  #Show a template for a deterministic.g.function
>  deterministic.g.function_template
function (data, current.node, nodes) 
{
    is.deterministic <- stop("replace me!")
    prob1 <- stop("replace me!")
    return(list(is.deterministic = is.deterministic, prob1 = prob1))
}
<environment: namespace:ltmle>
>  
>  #Show a template for a deterministic.Q.function
>  deterministic.Q.function_template
function (data, current.node, nodes, called.from.estimate.g) 
{
    is.deterministic <- stop("replace me!")
    Q.value <- stop("replace me!")
    return(list(is.deterministic = is.deterministic, Q.value = Q.value))
}
<environment: namespace:ltmle>
>  
>  #Use MaintainControl
>  set.seed(1)
>  rexpit <- function(x) rbinom(n=length(x), size=1, prob=plogis(x))
>  n <- 100
>  W <- rnorm(n)
>  A1 <- rexpit(W)
>  A2 <- as.numeric(rexpit(W) | A1)  #treatment at time 1 implies treatment at time 2
>  Y <- rexpit(W + A1 + A2 + rnorm(n))
>  data <- data.frame(W, A1, A2, Y)
> 
>  result <- ltmle(data, Anodes=c("A1", "A2"), Ynodes="Y", abar=c(1, 1), 
+    SL.library=c("SL.glm", "SL.step", "SL.mean"), 
+    deterministic.g.function=MaintainTreatment)
Error in library("SuperLearner") : 
  there is no package called ‘SuperLearner’
Calls: ltmle -> ltmleMSM.private -> CheckInputs -> library
Execution halted
checking tests ... ERROR
Running the tests in ‘tests/test-all.R’ failed.
Last 13 lines of output:
  + }
  Loading required package: ltmle
  The influence curve based variance estimator implemented in this package provides 
  asymptotically conservative standard error estimates when the treatment mechanism is 
  estimated with MLE using a correctly specific parametric model. However, we have found 
  in simulations that in finite samples this variance estimator may be substantially
  anti-conservative in settings where the outcome is rare or there are positivity 
  violations. An improved variance estimator addressing these challenges is currently 
  under development and will be released in a subsequent version of the package.

  Error in library(tmle) : there is no package called 'tmle'
  Calls: test_check ... lapply -> FUN -> sys.source2 -> eval -> eval -> library
  Execution halted