jgellar / pcox

Penalized Cox regression models
1 stars 0 forks source link

failing tests #42

Open fabian-s opened 7 years ago

fabian-s commented 7 years ago

(refers to fixup - branch)

> pcox(Surv(time, event) ~ p(x, linear=T, k=8), data=dat)
Error in mean.default(x, na.rm = TRUE) : 
  (converted from warning) argument is not numeric or logical: returning NA
11: doWithOneRestart(return(expr), restart)
10: withOneRestart(expr, restarts[[1L]])
9: withRestarts({
       .Internal(.signalCondition(simpleWarning(msg, call), msg, 
           call))
       .Internal(.dfltWarn(msg, call))
   }, muffleWarning = function() NULL)
8: .signalSimpleWarning("argument is not numeric or logical: returning NA", 
       quote(mean.default(x, na.rm = TRUE)))
7: warning("argument is not numeric or logical: returning NA")
6: mean.default(x, na.rm = TRUE)
5: mean(x, na.rm = TRUE) at pcox.R#306
4: FUN(X[[i]], ...)
3: lapply(X = X, FUN = FUN, ...)
2: sapply(as.list(newfrmlenv), meanmode) at pcox.R#309
1: pcox(Surv(time, event) ~ p(x, linear = TRUE, k = 8), data = dat)
> pcox(Surv(time, event) ~ p(x), data=dat)
Error in mean.default(x, na.rm = TRUE) : 
  (converted from warning) argument is not numeric or logical: returning NA
> pcox(Surv(time, event) ~ p(x, basisype  = "te", linear=FALSE), data=dat)
Error in ExtractData(object, data, knots) : 
  'names' attribute [2] must be the same length as the vector [1]
> pcox(Surv(time, event) ~ p(x, basisype  = "te"), data=dat)
Warning in assign(x = nm, trm.i, envir = newfrmlenv) :
  only the first element is used as variable name
Warning in newtrmstrings[i] <- nm :
  number of items to replace is not a multiple of replacement length
Warning in mean.default(x, na.rm = TRUE) :
  argument is not numeric or logical: returning NA
Error in model.frame.default(formula = Surv(time, event) ~ x, data = pcoxdata,  : 
  invalid type (list) for variable 'x'
> dat$xna <- x; dat$xna[1:5] <- NA
> fit_na <- pcox(Surv(time, event) ~ p(xna, linear=FALSE), data=dat)
> predict(fit_na)
  [1] -0.132103443 -0.132103443 -0.132103443 -0.132103443 -0.132103443  0.645199573  0.017758377
  [8]  1.002948143  0.188304620  0.920976875 -0.769459494  0.204497990 -0.302268332 -0.879620209

returns the intercept where it should be NA.....

> predict(fit_na, type="terms", newdata=dat)
Error in predict.pcox(fit_na, type = "terms", newdata = dat) : 
  Doesn't yet support type "terms"
> str(predict(fit, se.fit = TRUE, newdata=dat))
 num [1:500] 0.526 0.325 -0.578 0.542 -0.666 ...