Thursday, May 27, 2010

Template for Presentations and Handouts using LaTeX, Beamer, and a PDF Viewer

Template for Presentations and Handouts using LaTeX, Beamer, and a PDF Viewer

Example PDF Output

Instructions

Store your file in something.tex and run pdflatex something to produce pdf after setting the handout variable to zero (slides) or one (handouts). You will also have to run bibtex if you have references in the talk. If using contributed LaTeX styles such as relsize (a highly recommended one) you may have to install such styles before running pdflatex. See GetLatex for a script for fetching and installing styles from the internet. Note that if you have references, you will get a warning about aNEWBLOCK when running pdflatex. Enter S followed by Enter to ignore these warnings.

If you are running Kubuntu/Ubuntu/debian, you may install Beamer with the following if your system does not already have it:

    sudo apt-get update    sudo apt-get install latex-beamer pgf (texlive-latex-recommended) 

See BeamerTips for a different method of creating separate slide and handout files.

There are many themes available for Beamer. Most if not all of them are displayed at http://mike.polycat.net/gallery/beamer-themes

You can also find a short course about Beamer at http://gobics.de/katharina/beamer-script.pdf

Download the Biostatistics logo into a central directory in your home area, such as ~/doc/images and set a symbolic link to it, e.g., run the command ln -s ~/doc/images/biostatLogo.jpg. Instead you can change the \figw command below to reference a file such as /home/me/doc/images/biostatLogo.jpg.

If you need to put R code or a verbatim text in your presentation, see this.

Template

 \def\handout{0}   % set to 1 to produce 4-up handouts instead of slides \def\notes{0}     % set to 1 to show \note{}s \ifnum\handout=1  % see above for an alternative which uses two preamble files \documentclass[handout,13pt,compress,c]{beamer} \usepackage{pgfpages} \pgfpagesuselayout{4 on 1}[letterpaper,landscape,border shrink=4mm] % or: \pgfpagesuselayout{2 on 1}[letterpaper,border shrink=4mm] \setbeamertemplate{footline}[page number]   % omit if don't want slide number at bottom right % use \setbeamertemplate{footline}[text line]{xxxx} if you want xxxx at bottom left of each slide % use \setbeamertemplate{footline}[text line]{xxxx\hfill\thepage} %  if you want xxxx at bottom left, page # at bottom right \else \documentclass[13pt,compress,c]{beamer} \fi  \usetheme{PaloAlto} % Also try Warsaw, Malmoe, Madrid, Berlin, Darmstadt; see %  /usr/share/texmf/tex/latex/beamer/themes/theme and the above gallery. % PaloAlto has section and subsection titles in left panel with highlighting % Darnstadt shows section names at top with progress bubbles % Optional: \usefonttheme{serif}  \usepackage{graphicx} \usepackage{natbib}           % for author year citations \citet \citep \usepackage{relsize}          % for \smaller etc. \DeclareGraphicsExtensions{.pdf, .jpg, .png}  \setbeamercolor{normal text}{bg=blue!5} %\setbeamertemplate{headline}[infolines theme] %\setbeamercolor{title}{fg=black!80!black,bg=blue!20!white} \ifnum\notes=1 \setbeameroption{show notes} \fi  \newcommand{\ft}[1]{\frametitle{#1}} \newcommand{\bi}{\begin{itemize}} \newcommand{\ei}{\end{itemize}}  %Macros to make graphics insertions easy %Command for sizing to width    \figw{file}{fraction of \textwidth} \newcommand{\figw}[2]{\centerline{\includegraphics[width=#2\textwidth]{#1}}} %Command for sizing to height   \figh{file}{fraction of \textheight} \newcommand{\figh}[2]{\centerline{\includegraphics[height=#2\textheight]{#1}}} %Use \figh{graphics file name}{1} to size to whole text height %For graphics needing no shrinkage:  \fig{file} \newcommand{\fig}[1]{\centerline{\includegraphics{#1}}}  \newcommand{\foot}[1]{\footnotetext{#1}}  % smaller text in bottom margin, e.g. citations \makeatletter \renewcommand\@makefntext[1]{\noindent#1} % see p. 114 of LaTeX Companion 2nd edition \makeatother \renewcommand\footnoterule{}  \logo{\figw{biostatLogo.jpg}{.123}  \title[Short Title]{Long Title} \author[]{Jane Smith} \institute{Department of Biostatistics, Vanderbilt University School   of Medicine} \date{\textsc{Meeting Title}\hfill presentation date}  \begin{document}  \frame{\titlepage}  \frame{    \ft{Outline} \tableofcontents }  \section{Current State} \frame{ \ft{Bad Practice} \framesubtitle{Be Good!} \begin{quote} Biases might pose a special challenge for laboratory researchers who are used to biological reasoning and the tightly controlled conditions of experimental research. Such researchers unwittingly become non-experimental observational epidemiologists when they apply molecular assays in studies of diagnosis and prognosis, for which the experimental method is not available and for which biological reasoning might have limited usefulness. \end{quote} \foot{\citet{ran05bia}; see also \citet{ran04rul}} }  \frame{ \ft{Bad Statistical Practice} \bi \item Data torture \item Subsetting subjects \item Choosing cutpoints to optimize accuracy \item Incorrect accuracy measures \item Incomplete or no validation \item Overstatement of results \ei }  \frame{ \ft{Bad Statistical Practice, \emph{cont.}} \bi \item No demonstration that information is new; not giving clinical   variables same opportunities as potential biomarkers \item Poor use of continuous markers \item See REMARK guidelines \citep{mcs05rep}, \citet{ioa07mol},   \citet{chkaut} \ei }  \frame{ \ft{A Slide Title} \begin{block}{Slide Subtitle1} \bi \item One \item Two \ei \end{block} \begin{block}{Slide Subtitle2} \bi \item Three \item Four \item Five \ei \end{block} }  \section[Goals]{Statistical Goals}  \frame{    \ft{Statistical Goals} \bi \item Experimental design, e.g. randomize processing order, blinding   to patient outcome \item Understanding the measurements \item Analyzing assay variability/reliability \item Normalization (\textbf{better}: build into comprehensive model) \ei }  \frame{   \ft{Demonstration of Added Information} \bi \item Biomarkers must add information to already available information  \bi  \item Partial test of association controlling for cheap info  \item Index of information gain  \ei \item Show that biomarker values cannot be predicted from existing   data \item Insufficient number of cases to adjust for many clinical   variables $\rightarrow$ propensity score analysis  \bi  \item Predict marker value from all clinical variables  \item Solely adjust for predicted marker value  \ei \ei }   \section[Classification]{Problems with Classification} \frame{ \ft{Problems with Classification} \bi \item Proportion classified correctly is an \textbf{improper scoring     rule}  \bi  \item Optimized by bogus model  \ei \item Minimum information  \bi  \item low statistical power  \item high standard errors of regression coefficients  \item arbitrary to choice of cutoff on predicted risk  \item forces binary decision, does not yield a ``gray zone''    $\rightarrow$ more data needed  \ei \item Assumes statistician to be provider of utility function \item Sensitivity and specificity are also improper scoring rules \ei }  \frame{ \ft{Example: Damage Caused by Improper Scoring Rule} \bi \item Predicting probability of an event, e.g., Prob(disease) \item $N=400$, 0.57 of subjects have disease \item Classify as diseased if prob.\ $>0.5$ \ei \begin{center}\begin{tabular}{lccc}\hline Model & $C$   & $\chi^{2}$ & Proportion \\       & Index &            & Correct \\ \hline     age     & .592 & 10.5 & .622\\ sex     & .589 & 12.4 & .588\\ age+sex & .639 & 22.8 & .600\\ constant &.500 & ~0.0 & .573\\ \hline \end{tabular}\end{center}  \smaller[2] Adjusted Odds Ratios:\\ \begin{tabular}{ll} age (IQR 58y:42y) & 1.6 (0.95CL 1.2-2.0)\\ sex (f:m)         & 0.5 (0.95CL 0.3-0.7) \\ \end{tabular} }  \section{Validation} \frame{ \ft{Need for Stringent Validation} \bi \item Splitting a sample does not provide external validation \item Split-sample validation is terribly inefficient and arbitrary unless $>$ 20,000 subjects \item Greater reliability obtained by using all subjects and using   bootstrap or 50 repeats of 10-fold cross validation \ei }  \section{Dichotomania}  \frame{ \ft{Problems Caused by Chopping Continuous Variables} \bi \item Chopping predicted probabilities causes major problems \item Many problems caused by chopping predictors \item True cutpoints do not exist unless risk relationship discontinuous \ei \begin{tabular}{cc|cc} \\ \hline Range of Delay & Mean Score & Range of   Delay & Mean Score \\ \hline ~0-11 & 210 & 0-3.8~~& 220 \\ 11-20 & 215 & 3.8-8~~& 219 \\ 21-30 & 217 & 8-113~~& 217 \\ 31-40 & 218 & 113-170& 215 \\ 41-~~ & 220 & 170-~~~& 210 \\ \hline \end{tabular} \foot{\citet{wai06fin};~~See ``Dichotomania'' \citep{sen05dic} and   \citet{roy06dic}} }  \frame{ \ft{Data from Wainer [2006]} \figh{wai06fin}{.9} }  \section[Continuous Markers]{Value of Continuous Biomarkers} \frame{ \ft{Value of Continuous Biomarkers} \bi \item Avoid arbitrary cutpoints \item Better risk spectrum \item Provides gray zone \item Increases power/precision \ei }  \frame{ \ft{Prognosis in Prostate Cancer} % Put comments to the right of a figure; reserve 20% of the width for this \begin{columns} \column{.8\textwidth} \figw{psa}{.9} \column{.2\textwidth} \smaller[2]Data courtesy of M Kattan from JNCI 98:715; 2006 \\[4ex] Horizontal ticks represent frequencies of prognoses by new staging system \end{columns} }  % Graphic taking up whole frame \frame{ \ft{Prognosis in Prostate Cancer, \emph{cont.}} \figw{/home/harrelfe/tmp/spectrum}{.725} }  % Graphic taking up whole slide, with no header, footer, etc. \begin{frame}[plain] \figw{myplot}{1} % or \centerline{\includegraphics[angle=-90,width=.65\textwidth]{myplot}} etc. \end{frame}   \frame{ \ft{Prognosis after Myocardial Infarction} \figw{troponin}{.75} \foot{\citet{ohm96car}} }   \section{Summary} \frame{ \ft{Summary} \bi \item Current state of biomarker analysis leaves much to be desired \item Many statistical and epidemiologic problems, especially:  \bi  \item bias  \item overfitting and overstatement  \item incomplete validation  \ei \item Cutpoints are inherently misleading \item Picking winners $\equiv$ splitting hairs \item Analyze clinical data as aggressively as potential biomarkers \ei }   \begin{center}      % omit this and next 5 lines if no bibliography \textbf{References} \end{center} \smaller[5] \bibliographystyle{abbrvnat} \bibliography{/home/harrelfe/bib/feh}  %Note: If references will fit on one slide use: \frame{ \ft{References} \smaller[5] \bibliographystyle{...} \bibliography{...} }  \end{document}  

Inclusion of R Code or Verbatim Text

To include verbatim text, use the long form of the frame environment with the fragile option:
 \begin{frame}[fragile] ... {\smaller   % optional, using relsize style \begin{verbatim} . . . \end{verbatim} }           % optional \end{frame} 

To include S language code in your presentation use the following model.

 \usepackage{alltt} \newcommand{\Gets}{\(\leftarrow\)} \newcommand{\Twiddle}{\mbox{\(\tt\sim\)}} \newcommand{\bex}{\begin{alltt}} \newcommand{\eex}{\end{alltt}} ... \begin{document} ... \frame{ \ft{An Example} Here is the code used to produce the previous result. \bex f \Gets lm(y {\Twiddle} age + sex) summary(f) a \Gets b + d \eex }

No comments:

Post a Comment