https://github.com/cran/rstpm2
Raw File
Tip revision: c12a9847539968aa375d4df8349a3a524e7c1bb5 authored by Mark Clements on 17 January 2019, 14:50:04 UTC
version 1.4.5
Tip revision: c12a984
timevar.tex
% Created 2018-08-02 Thu 11:10
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Mark Clements}
\date{\today}
\title{Predictions}
\hypersetup{
 pdfauthor={Mark Clements},
 pdftitle={Predictions},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 24.5.1 (Org mode 8.3.4)}, 
 pdflang={English}}
\begin{document}

\maketitle
\tableofcontents


\section{R implementation for \url{https://pclambert.net/software/stpm2/stpm2_timevar/}}
\label{sec:orgheadline1}

\begin{verbatim}
..- attr(*, "names")= chr  "alive" "breastca" "cardiovas" "accident" ...
 ..$ adjchemo: Named int  0 1
 .. ..- attr(*, "names")= chr  "no" "yes"
 ..$ noyes   : Named int  0 1 9
 .. ..- attr(*, "names")= chr  "no" "yes" "?"
 ..$ adjhormo: Named int  0 1 2 3 8 9
 .. ..- attr(*, "names")= chr  "no" "yes" "neo-adj" "ovariect" ...
 ..$ osi     : Named int  0 1 9
 .. ..- attr(*, "names")= chr  "alive" "deceased" "unknown"
 ..$ post    : Named int  0 1
 .. ..- attr(*, "names")= chr  "pre" "post"
 ..$ recent  : Named int  0 1
 .. ..- attr(*, "names")= chr  "1978-1987" "1988-1993"
 ..$ size    : Named int  1 2 3
 .. ..- attr(*, "names")= chr  "<=20 mm" ">20-50mmm" ">50 mm"
 ..$ causelab: Named int  0 1 2
 .. ..- attr(*, "names")= chr  "Censored" "Cancer" "Other causes"
- attr(*, "expansion.fields")=List of 45
 ..$ : chr  "_dta" "note0" "10"
 ..$ : chr  "_dta" "note10" "- follow up information available"
 ..$ : chr  "_dta" "note9" "- axillary clearance was performed"
 ..$ : chr  "_dta" "note8" "- no earlier other cancer except basal cell ca or low grade cervical ca"
 ..$ : chr  "_dta" "note7" "- no earlier primary breastcancer"
 ..$ : chr  "_dta" "note6" "- no relapse before or at registration at the DDHCC"
 ..$ : chr  "_dta" "note5" "- no metastasis at surgery and no relapse within 1 month after surgery"
 ..$ : chr  "_dta" "note4" "- if surgery elsewhere referred to DDHCC within 3 months (90 days)"
 ..$ : chr  "_dta" "note3" "- date of surgery up till (incl) 1993"
 ..$ : chr  "_dta" "note2" "- tissue available at Rotterdam tunmorbank"
 ..$ : chr  "_dta" "note1" "Inclusion criteria for patients in this series:"
 ..$ : chr  "dcause" "width" "13"
 ..$ : chr  "osi" "width" "8"
 ..$ : chr  "os" "width" "5"
 ..$ : chr  "mfi" "width" "3"
 ..$ : chr  "mf" "width" "5"
 ..$ : chr  "rfi" "width" "3"
 ..$ : chr  "rf" "width" "5"
 ..$ : chr  "hormon" "width" "5"
 ..$ : chr  "chemo" "width" "8"
 ..$ : chr  "meno" "width" "4"
 ..$ : chr  "age" "width" "3"
 ..$ : chr  "year" "width" "4"
 ..$ : chr  "pid" "width" "4"
 ..$ : chr  "_dta" "ReS_Xij" "mnr aard"
 ..$ : chr  "_dta" "ReS_str" "0"
 ..$ : chr  "_dta" "ReS_j" "vnrtis"
 ..$ : chr  "_dta" "ReS_ver" "v.2"
 ..$ : chr  "_dta" "ReS_i" "pid"
 ..$ : chr  "pr_1" "fp" "ln(X): X = (pr+1)"
 ..$ : chr  "enodes_1" "fp" "enodes^2"
 ..$ : chr  "_dta" "st_t" "_t"
 ..$ : chr  "_dta" "st_t0" "_t0"
 ..$ : chr  "_dta" "st_d" "_d"
 ..$ : chr  "_dta" "st_exexp" "10 * 12"
 ..$ : chr  "_dta" "st_exit" "time 10 * 12"
 ..$ : chr  "_dta" "st_bs" "12"
 ..$ : chr  "_dta" "st_s" "12"
 ..$ : chr  "_dta" "st_o" "0"
 ..$ : chr  "_dta" "st_ev" "1"
 ..$ : chr  "_dta" "st_bd" "rfi"
 ..$ : chr  "_dta" "st_bt" "rf"
 ..$ : chr  "_dta" "st_id" "pid"
 ..$ : chr  "_dta" "st_ver" "2"
 ..$ : chr  "_dta" "_dta" "st"
- attr(*, "byteorder")= chr "LSF"
\end{verbatim}

\begin{verbatim}
rott2b <- transform(rott2b, time = pmin(rf,60)/12)
rott2b <- transform(rott2b, event = (rfi==1) & (time < 60/12))
\end{verbatim}

\begin{verbatim}
fit <- stpm2(Surv(time,event) ~ hormon + nsx(age,df=3,centre=60,stata=TRUE) + pr_1, 
	     data=rott2b, df=4, stata=TRUE)
eform(fit)
\end{verbatim}



\begin{verbatim}
nd <- data.frame(age=60, hormon="no", pr_1=0)
plot(fit, type="surv", newdata=nd, xlab="Years from surgery")
\end{verbatim}


\begin{verbatim}
nd <- data.frame(age=60, hormon="no", pr_1=0)
plot(fit, type="surv", newdata=nd, xlab="Years from surgery")
\end{verbatim}

\begin{verbatim}
nd <- data.frame(age=60, hormon="no", pr_1=0)
plot(fit, type="haz", newdata=transform(nd, hormon="yes"), xlab="Years from surgery",
     line.col="blue", rug=FALSE)
lines(fit, type="haz", newdata=nd, col="red")
\end{verbatim}

\begin{verbatim}
s_time1 <- predict(fit, newdata=transform(rott2b, time=1), type="surv")
hist(s_time1,xlab="Time from surgery",main="")
\end{verbatim}

\begin{verbatim}
s_time5 <- predict(fit, newdata=transform(rott2b, time=5), type="surv")
hist(s_time5,xlab="Time from surgery",main="")
\end{verbatim}
\end{document}
back to top