Closed ghost closed 4 years ago
This is an easy one: you misspelt "grid" as "gird".
I will look into automatically setting grid if time is not in newdata.
Kindly, Mark.
On 6 Dec 2019 22:00, arturakb notifications@github.com wrote:
Dear Mark,
I was following the 'rstpm2: a simple guide' and ran into the following problem (which seems to have worked in your vignette):
rm(list = ls())
library(ggplot2) library(survival) library(rstpm2)
brcancer <- transform(brcancer, recyear= rectime/365.24)
fit <- stpm2(Surv(recyear, censrec == 1) ~ hormon, data = brcancer, df = 4)
pred <- predict(fit, newdata = data.frame(hormon = 0:1),
- type = 'hazard', gird = TRUE, full = TRUE, se.fit = TRUE) Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) : variable lengths differ (found for 'nsx(log(recyear), df = 4)') In addition: Warning message: 'newdata' had 2 rows but variables found have 686 rows
R session on Ubuntu 19.04: `
sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 19.04
Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base
other attached packages: [1] rstpm2_1.5.1 survival_2.43-3 ggplot2_3.1.1
loaded via a namespace (and not attached): [1] Rcpp_1.0.1 magrittr_1.5 tidyselect_0.2.5 [4] munsell_0.5.0 colorspace_1.4-1 lattice_0.20-38 [7] R6_2.4.0 rlang_0.4.0 plyr_1.8.4 [10] dplyr_0.8.1 tools_3.5.2 grid_3.5.2 [13] gtable_0.3.0 nlme_3.1-137 mgcv_1.8-27 [16] withr_2.1.2 lazyeval_0.2.2 assertthat_0.2.1 [19] tibble_2.1.2 numDeriv_2016.8-1.1 crayon_1.3.4 [22] Matrix_1.2-15 purrr_0.3.2 glue_1.3.1 [25] deSolve_1.25 bbmle_1.0.20 compiler_3.5.2 [28] pillar_1.4.1 scales_1.0.0 stats4_3.5.2 [31] pkgconfig_2.0.2
`
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmclements%2Frstpm2%2Fissues%2F14%3Femail_source%3Dnotifications%26email_token%3DAAEICCIPHF7JRIW5THFXLK3QXK4QNA5CNFSM4JXBHCP2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H6YC5XA&data=02%7C01%7Cmark.clements%40ki.se%7C3bf788b7821e4a3d4d8e08d77a8f62ab%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637112628563934949&sdata=6Gb91AhhQJ%2BdxLikRg5qjUo41Gw7mIqpROefvHWR%2FSk%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAEICCM7LLUTW6Y7S2OUQIDQXK4QNANCNFSM4JXBHCPQ&data=02%7C01%7Cmark.clements%40ki.se%7C3bf788b7821e4a3d4d8e08d77a8f62ab%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637112628563944942&sdata=tk72oitN0HyXA7Fhgtf2wqA%2Fq3KrG64SOy3%2FAkRqEHg%3D&reserved=0.
När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att behandla dina personuppgifter. Här finns information om hur KI behandlar personuppgifterhttps://ki.se/medarbetare/integritetsskyddspolicy.
Sending email to Karolinska Institutet (KI) will result in KI processing your personal data. You can read more about KI’s processing of personal data herehttps://ki.se/en/staff/data-protection-policy.
Thanks, sorry troubling for such a trivial matter! It was late in the night.
Dear Mark,
I was following the 'rstpm2: a simple guide' and ran into the following problem (which seems to have worked in your vignette):
R session on Ubuntu 19.04: