Running ‘bam.R’ [3s/4s]
  Running ‘coxpht.R’ [8s/13s]
  Running ‘gam.R’ [5s/8s]
  Running ‘mgcv-parallel.R’ [3s/8s]
  Running ‘missing.data.R’ [63s/91s]
  Running ‘single.index.R’ [12s/16s]
  Running ‘smooth.construct.so.smooth.spec.R’ [9s/13s]
Running the tests in ‘tests/coxpht.R’ failed.
Complete output:
  > ## coxpht donttest case
  > 
  > require(mgcv);require(survival)
  Loading required package: mgcv
  Loading required package: nlme
  This is mgcv 1.8-30. For overview type 'help("mgcv-package")'.
  Loading required package: survival
  > 
  > ## First define functions for producing Poisson model data frame
  > 
  > app <- function(x,t,to) {
  + ## wrapper to approx for calling from apply...
  +   y <- if (sum(!is.na(x))<1) rep(NA,length(to)) else
  +        approx(t,x,to,method="constant",rule=2)$y
  +   if (is.factor(x)) factor(levels(x)[y],levels=levels(x)) else y
  + } ## app
  > 
  > tdpois <- function(dat,event="z",et="futime",t="day",status="status1",
  +                                                              id="id") {
  + ## dat is data frame. id is patient id; et is event time; t is
  + ## observation time; status is 1 for death 0 otherwise;
  + ## event is name for Poisson response.
  +   if (event %in% names(dat)) warning("event name in use")
  +   require(utils) ## for progress bar
  +   te <- sort(unique(dat[[et]][dat[[status]]==1])) ## event times
  +   sid <- unique(dat[[id]])
  +   inter <- interactive()
  +   if (inter) prg <-
  +        txtProgressBar(min = 0, max = length(sid), initial = 0,
  +        char = "=",width = NA, title="Progress", style = 3)
  +   ## create dataframe for poisson model data
  +   dat[[event]] <- 0; start <- 1
  +   dap <- dat[rep(1:length(sid),length(te)),]
  +   for (i in 1:length(sid)) { ## work through patients
  +     di <- dat[dat[[id]]==sid[i],] ## ith patient's data
  +     tr <- te[te <= di[[et]][1]] ## times required for this patient
  +     ## Now do the interpolation of covariates to event times...
  +     um <- data.frame(lapply(X=di,FUN=app,t=di[[t]],to=tr))
  +     ## Mark the actual event...
  +     if (um[[et]][1]==max(tr)&&um[[status]][1]==1) um[[event]][nrow(um)] <- 1 
  +     um[[et]] <- tr ## reset time to relevant event times
  +     dap[start:(start-1+nrow(um)),] <- um ## copy to dap
  +     start <- start + nrow(um)
  +     if (inter) setTxtProgressBar(prg, i)
  +   }
  +   if (inter) close(prg)
  +   dap[1:(start-1),]
  + } ## tdpois
  > pbcseq$status1 <- as.numeric(pbcseq$status==2) ## death indicator
  > pb <- tdpois(pbcseq) ## conversion
  > pb$tf <- factor(pb$futime) ## add factor for event time
  > 
  > ## Fit Poisson model...
  > b <- bam(z ~ tf - 1 + sex + trt + s(sqrt(protime)) + s(platelet)+ s(age)+
  + s(bili)+s(albumin), family=poisson,data=pb,discrete=TRUE,nthreads=2)
  Error in .Call(C_mgcv_Rpbsi, R, nt) : WEIRD RETURN VALUE: (nil)
  Calls: bam -> bgam.fitd -> Sl.fitChol -> pbsi
  Execution halted
Running the tests in ‘tests/mgcv-parallel.R’ failed.
Complete output:
  > ## examples that are claimed to be too long in help files
  > ## illustration of multi-threading with gam...
  > 
  > require(mgcv);set.seed(9)
  Loading required package: mgcv
  Loading required package: nlme
  This is mgcv 1.8-30. For overview type 'help("mgcv-package")'.
  > dat <- gamSim(1,n=2000,dist="poisson",scale=.1)
  Gu & Wahba 4 term additive model
  > k <- 12;bs <- "cr";ctrl <- list(nthreads=2)
  > 
  > system.time(b1<-gam(y~s(x0,bs=bs)+s(x1,bs=bs)+s(x2,bs=bs,k=k)
  +             ,family=poisson,data=dat,method="REML"))[3]
  elapsed 
    0.374 
  > 
  > system.time(b2<-gam(y~s(x0,bs=bs)+s(x1,bs=bs)+s(x2,bs=bs,k=k),
  +             family=poisson,data=dat,method="REML",control=ctrl))[3]
  elapsed 
    0.253 
  > 
  > ## Poisson example on a cluster with 'bam'. 
  > ## Note that there is some overhead in initializing the 
  > ## computation on the cluster, associated with loading 
  > ## the Matrix package on each node. For this reason the 
  > ## sample sizes here are very small to keep CRAN happy, but at
  > ## this low sample size you see little advantage of parallel computation.
  > 
  > k <- 13;set.seed(9)
  > dat <- gamSim(1,n=6000,dist="poisson",scale=.1)
  Gu & Wahba 4 term additive model
  > require(parallel)  
  Loading required package: parallel
  > nc <- 2   ## cluster size, set for example portability
  > if (detectCores()>1) { ## no point otherwise
  +   cl <- makeCluster(nc) 
  +   ## could also use makeForkCluster, but read warnings first!
  + } else cl <- NULL
  >   
  > system.time(b3 <- bam(y ~ s(x0,bs=bs,k=7)+s(x1,bs=bs,k=7)+s(x2,bs=bs,k=k)
  +             ,data=dat,family=poisson(),chunk.size=5000,cluster=cl))
  Error in .Call(C_mgcv_Rpbsi, R, nt) : WEIRD RETURN VALUE: (nil)
  Calls: system.time -> bam -> bgam.fit -> fast.REML.fit -> Sl.fit -> pbsi
  Timing stopped at: 0.578 0 3.161
  Execution halted