LaTeX, ppt - Center for Clinical Epidemiology and Biostatistics

Download Report

Transcript LaTeX, ppt - Center for Clinical Epidemiology and Biostatistics

BSTA 670 – Statistical Computing
Lecture 14:
A Brief Introduction to LaTeX
What are TeX and LaTeX?



TeX (tau epsilon chi) is a computer language
designed for typesetting, especially math.
TeX was developed by Donald Knuth, a
Mathematician/Computer Scientist, and others in
late 1970s. He was dissatisfied with the
typesetting from the publisher of his book “The
Art of Computer Programming”. The
development took about 10 years.
TeX is an interpreter language, accepting
commands based on markup language, written
in ascii files.
What are TeX and LaTeX?


TeX is portable, producing the same output on
any computer.
TeX is a very low level language directing where
and what to place on a page. For example:
move a specific distance to the left, right, up, or
down ; change font; write a string of words,
possibly containing math expressions, to a
paragraph, etc.
What are TeX and LaTeX?


TeX processes the input commands and
produces a device independent file (dvi). This
file then gets translated for the particular output
device; screen, pdf, postscript (.ps).
TeX requires a set of fonts. Donald Knuth also
developed a font creation program called
Metafont. All TeX installations have a basic set of
fonts, other fonts can be generated or added,
included commercially available fonts.
What are TeX and LaTeX?


Macro commands can be defined to build the
low level commands into high level command
interfaces. For example, a macro to create a title
page and to set up sections and subsections,
etc.
LaTeX is a variation of TeX that is easier to use
than basic TeX. It is essentially a macro package
that runs using TeX. The macros provide many
useful features including the ability to create
documents with sections and chapters,
bibliography macros.
What are TeX and LaTeX?



Essentially, LaTeX provides easier document
style implementation, while also providing the
ease of math typesetting.
LaTeX also provides the ability to include
graphics in documents, although in some
implementations of LaTeX it is not easy to do so.
LaTeX style files have been created to format
common document features, such as
paragraphing, margins, footnotes, headers, etc.
What are TeX and LaTeX?


LaTeX style files include: letter, book, article, and
report.
A style file can be written for any use such as for
formatting a Ph.D. thesis. The thesis formats for
Penn are available at:
http://www.math.upenn.edu/grad/thesisstyle.html

TeX/LaTeX is available for Windows, Unix, Linux,
and Mac OS. It can be obtained for free or
commercially.
What are TeX and LaTeX?

The Comprehensive TeX Archive Network
(CTAN) is the most comprehensive site.
http://www.ctan.org/
Some info on LaTeX: http://www.latex-project.org/
 Free versions include: Windows (proTeXt,
MiKTeX), Unix/Linux (TeX Live), Mac
(gwTeX). There are many others.
 Commercial versions: Windows (PCTeX,
TurboTeX), Mac (Textures).

What are TeX and LaTeX?




TeX is not WYSIWYG (What you see is what you
get).
MS WORD and WordPerfect are WYSIWYG.
In WYSIWYG text processors: what you see on
the screen as you edit is the final product,
formatting commands are not visible.
LaTex and Tex are not word processors. Rather,
they are text formatters. The formatting
commands are visible (in a command file). The
command file defines the structure of the final
product and a compiler is needed to process the
commands.
LaTeX
LaTeX has two modes for the typed
characters: Math Mode and Text Mode.
The mode determines how LaTeX
responds to the entered text.
 Default is text mode.
 Math mode is indicated by surrounded the
math phrase with a $ on each end, e.g.
$\alpha$. The math symbol \alpha will only
work in math mode.

LaTeX document layout
\documentclass{class}
\begin{document}
.... your text goes here ....
\end{document}
Class can be article (publication article), report
(document with chapters), letter, book.
Example of LaTeX Input and Output
\documentclass{article}
\begin{document}
This is a simple example of the use of \LaTeX{}. Files must contain special commands that declare
the \emph{document class}, most often ``article’’, and that denote the beginning and end of the
document itself, \emph{begin} and \emph{end}.
The \emph{preamble} is the initial part of the file, between the document class command and the
beginning of the document. This may contain commands specifying font information, defintion of new
commands, author and title information, or other commands.
The text of the document goes between the begin and end commands. Paragraphs are indicated by
blank lines. Segments of the text that are to printed in \textbf{boldface} {\bf font}, {\it italics}, or
\underline{underlined} are simply surrounded by the appropriate \emph{environment}.
\end{document}
simple.tex
Font Sizes
\documentclass[12pt]{article}
\begin{document}
There are various font sizes that can be accessed. Others can be created in needed.
{\tiny tiny} \\
{\scriptsize scriptsize} \\
{\footnotesize footnotesize} \\
{\small small} \\
{\normalsize normalsize} \\
{\large large} \\
{\Large Large} \\
{\LARGE LARGE} \\
{\huge huge} \\
{\Huge Huge}
\end{document}
font_sizes.tex
Font Sizes
\documentclass[12pt]{article}
\begin{document}
\LARGE
You can easily change {\normalsize from} one font {\huge to another font size}.
This \small can be done {\footnotesize for a specific set of text} or from
\large a specific point onward.
\end{document}
font_sizes2.tex
Formatting in LaTeX
Sections
\section{…}
= 1. This is section
\subsection{…} = 1.1 This is subsection
\subsubsection{…} = 1.1.1 This is subsubsection
\appendix - changes to numbering for appendix
\chapter{…} - Used with book and report documents
Title page:
\title{…}
\author{…}
\maketitle - Display Title and Author
Formatting in LaTeX
\tableofcontents - Creates TOC
\listoftables - Creates LOT
\listoffigures - Creates LOF
\label{marker} – Marker for object in document.
\pageref{marker} - Displays page no. of marker.
\ref{marker} - Displays section location of marker.
Example 1 of Article in LaTeX
\documentclass[titlepage]{article}
\begin{document}
\title{Article Example}
\author{Joe First}
\date{November xx, 2008}
\maketitle
\section{INTRODUCTION}
\label{intro}
This is the introduction section.
\section{NOTATION AND METHODS}
\label{methods}
Let $N_0$, and $N_1$ be the numbers of unexposed and exposed
members of the population,
respectively, and let other quantities be defined as in Table 1.
We are interested in $p_0$ = P(true disease $|$ unexposed) and
$p_1$ = P(true disease $|$ exposed). Usual risk measures such as the risk
difference $p_1 - p_0$ or relative risk $p_1/p_0$ can be based on
estimates of $p_0$ and $p_1$.
\end{document}
article_ex1.tex
Example 1 of Article in LaTeX
article_ex1.tex
\documentclass[12pt]{article}
Example 1 of Math in LaTeX
\begin{document}
Suppose X represents the lifetime random variable and
T the truncation random variable for Group~1
and Y represents the lifetime random variable and
Z the truncation random variable for Group~2.
Also, suppose that X, Y, T, and Z are all independent.
The pair $(X,T)$ is observed if and only if $X \leq T$ and
the pair $(Y,Z)$ is observed if and only if $Y \leq Z$.
Under this sampling scheme, only the pairs in Group~1 satisfying
$x_i \leq t_i$,
denoted $(x_1, t_1), \ldots, (x_{n_1}, t_{n_1})$, are observed.
Also, only the pairs in Group~2 satisfying $y_j \leq z_j$,
denoted $(y_1, z_1), \ldots, (y_{n_2}, z_{n_2})$, are observed.
\end{document}
math_ex1.tex
Example 2 of Math in LaTeX
\documentclass[12pt]{article}
\begin{document}
Here is an equation with a label for referencing the equation number.
\begin{equation}
\label{areform}
ARE \doteq 1- \frac{ \pi_0 k + \pi_1 - \pi_0 \pi_1 \left( (1-f_0)
+k(1-f_1) \right) - \pi_1 f_0 - \pi_0 f_1 k }
{ \pi_0 k + \pi_1 - \pi_0 \pi_1 \left( (1-f_0)
+k(1-f_1) \right) \hspace{1.15in}
}.
\end{equation}
By definition, $k=f_0 T_0 / f_1 T_1$ which yields $T_0 = (f_1 T_1 k)/f_0$.
Substituting this result into $f$ yields $f= f_0 f_1 (k+1) / (f_1 k + f_0)$.
The ARE comparing full verification to the BG method is obtained
by substituting $f_0=f_1=f$ into Equation~\ref{areform}.
\end{document}
math_ex2.tex
\documentclass[12pt]{article}
Example 3 of Math in LaTeX
\begin{document}
The construction of the Mann-Whitney statistic is based on information of
the patterns found in the ordered combined sample. Define
\begin{displaymath}
U_{ij} = U(X_i,Y_j) =
\left\{ \begin{array}{lr}
{+1} & \hspace{2ex} X_i > Y_j \\
{ 0} & \hspace{2ex} X_i = Y_j \\
{-1} & \hspace{2ex} X_i < Y_j
\end{array}
\right.
\end{displaymath}
The Mann-Whitney statistic is defined as
\begin{displaymath}
U = \frac{1}{n_1 n_2} \sum_{i=1}^{n_1}\sum_{j=1}^{n_2} U_{ij}
\end{displaymath}
The Mann-Whitney statistic, $U$, and Wilcoxon statistic, $W$,
can be shown to be related according to
$ W = 2^{-1} \left[ n_1 n_2 U + n_1(n_1+n_2+1) \right] $.
It should be noted here that the Mann-Whitney
statistic is sometimes defined with $U_{ij}$ being an indicator
function taking on values 1 if $X_i>Y_j$ and 0 otherwise.
Exact moments for the Wilcoxon statistic can be derived through the use
of permutation theory.
\end{document
math_ex3.tex
Example 3 of Math in LaTeX
math_ex3.tex
\documentclass[12pt]{article}
Example 4 of Math in LaTeX
\begin{document}
\begin{displaymath}
\begin{array}{cccc}
\underline{Age Group At} & \underline{Sample Size} &
\underline{Truncation MW} & \underline{Weighted LR} \\
\underline{First Transfusion}& & \underline{Statistic} &
\underline{Statistic} \\
& &
&
\\
13-29 \hspace{1ex} years & 188 & Z=1.80 & Z=-1.39 \\
40-49 \hspace{1ex} years & 148 & P=0.072 & P=0.166 \\
& &
&
\\
13-29 \hspace{1ex} years & 188 & Z=2.62 & Z=-3.45 \\
70+ \hspace{1ex} years & 115 & P=0.009 & P<0.001 \\
& &
&
\\
40-49 \hspace{1ex} years & 148 & Z=2.73 & Z=-2.61 \\
70+ \hspace{1ex} years & 115 & P=0.006 & P=0.009
\end{array}
\end{displaymath}
\end{document}
math_ex4.tex
\documentclass[12pt]{article}
Example 5 of Math in LaTeX
%\def\jot{8mm} % set interrow space for equations in eqnarray, etc. Default is 3pt = 0.0415 in = 0.1054 mm.
\newdimen\jot \jot=4mm % This command has exactly the same effect as the \def command above. It is used in the
% latex setup file in /usr/local/lib/tex/inputs. Also, unlike \def, it can be used throughout the document to change
% the value of jot at any time.
\newcommand{\piah}{\mbox{$\hat{\pi}_0$}}
% staru is used for placing a superscript star slightly higher than TeX normally places it. It is used in places where a
% star is placed on a capital letter (R and K) since TeX doesn't place it high enough for my taste. The hspace is
% required since a space is added after the star. The -1ex hspace removes this space.
\newcommand{\staru}{\raisebox{.6ex}{$\scriptsize\star$}\hspace{-1ex}}
\newcommand{\pas}{\mbox{$p_0^{\staru\ }$}}
\newcommand{\pahs}{\mbox{$\hat{p}_0^{\staru\ }$}}
\begin{document}
It is now shown that $\pahs\ =T_0/N_0$ and $\piah\ =X_0/M_0$ are uncorrelated.
The conditional covariance $Cov(\pahs\ , \piah\ | D_0, W_0) = 0$, because
$T_0=D_0+W_0$. Therefore,
\noindent
\begin{eqnarray*}
Cov(\pahs\ , \piah\ )
& = & E \left[ 0 \right] +
Cov \left[ E \left( \pahs\ | D_0, W_0 \right),
E \left( \piah\ | D_0, W_0 \right) \right] \nonumber \\
& = & Cov \left[ \frac{T_0}{N_0}, \frac{D_0}{D_0+W_0} \right] \nonumber \\
& = & E \left( \frac{D_0}{N_0} \right) E \left( \frac{T_0}{N_0} \right) E \left( \frac{D_0}{D_0+W_0} \right)
\nonumber \\
& = & p_0 - \pas\ \pi_0 = 0.
\end{eqnarray*}
math_ex5.tex
\end{document}
Example 5 of Math in LaTeX
math_ex5.tex
Example 6 of Math in LaTeX
\documentclass[12pt]{article}
\begin{document}
Table~\ref{tabcomp} shows the ARE comparing the BBGS and BG methods.
\begin{table}[htbp]
\caption{Examples of ARE Comparing BBGS and BG Methods}
\label{tabcomp}
\begin{center}
\begin{tabular}[h]{|c|c||c|c||c|c|}
\hline \hline
\multicolumn{2}{|c||}{$T_0 = 500$, $T_1=25$} &
\multicolumn{2}{|c||}{$T_0 = 500$, $T_1=50$} &
\multicolumn{2}{|c| }{$T_0 = 500$, $T_1=100$} \\
\multicolumn{2}{|c||}{$\pi_0=0.7$, $f_0=0.3$} &
\multicolumn{2}{|c||}{$\pi_0=0.6$, $f_0=0.3$} &
\multicolumn{2}{|c| }{$\pi_0=0.5$, $f_0=0.3$} \\
\multicolumn{2}{|c||}{$k=6$} &
\multicolumn{2}{|c||}{$k=3$} &
\multicolumn{2}{|c| }{$k=1.5$} \\
\hline
$\pi_1$ & RE & $\pi_1$ & RE & $\pi_1$ & RE \\
\hline \hline
0.2 & 0.391 & 0.1 & 0.433 & 0.1 & 0.520 \\
0.5 & 0.516 & 0.3 & 0.576 & 0.3 & 0.703 \\
0.7 & 0.646 & 0.6 & 0.711 & 0.5 & 0.847 \\
0.8 & 0.736 & 0.7 & 0.798 & 0.7 & 0.928 \\
0.9 & 0.851 & 0.9 & 0.902 & 0.9 & 1.016 \\
\hline \hline
\end{tabular}
\end{center}
\end{table}
math_ex6.tex
\end{document}
Example 7 of Math in LaTeX
\documentclass[12pt]{article}
\newcommand{\staru}{\raisebox{.6ex}{$\scriptsize\star$}\hspace{-1ex}}
\newcommand{\pas}{\mbox{$p_0^{\staru\ }$}}
\newcommand{\pbs}{\mbox{$p_1^{\staru\ }$}}
\begin{document}
\begin{displaymath}
\displaystyle
\frac{ \displaystyle \frac{1}{p_0^2}
\left[ \displaystyle \frac{\pi_0^2 \pas\ (1- \pas\ )}{N_0} +
\displaystyle \frac{\pas\ \pi_0 (1- \pi_0 )}{N_0} \right]
+
\displaystyle \frac{1}{p_1^2}
\left[ \displaystyle \frac{\pi_1^2 \pbs\ (1- \pbs\ )}{N_1} +
\displaystyle \frac{\pbs\ \pi_1 (1- \pi_1 )}{N_1} \right]
}
{ \displaystyle \frac{1}{p_0^2}
\left[ \displaystyle \frac{\pi_0^2 \pas\ (1- \pas\ )}{N_0} +
\displaystyle \frac{\pas\ \pi_0 (1- \pi_0 )}{f_0 N_0} \right]
+
\displaystyle \frac{1}{p_1^2}
\left[ \displaystyle \frac{\pi_1^2 \pbs\ (1- \pbs\ )}{N_1} +
\displaystyle \frac{\pbs\ \pi_1 (1- \pi_1 )}{f_1 N_1} \right]
} \,\ .
\end{displaymath}
\end{document}
math_ex7.tex
\documentclass[12pt]{article}
Example 8 of Math in LaTeX
\def\baselinestretch{1.20}
%
%\def\jot{8mm} % set interrow space for equations in eqnarray, etc
%
default is 3pt = 0.0415 in = 0.1054 mm
\newdimen\jot \jot=4mm
\newcommand{\staru}{\raisebox{.6ex}{$\scriptsize\star$}\hspace{-1ex}}
\newtheorem{plemmat}{Proof of Lemma}
\newenvironment{plemma}{\begin{plemmat} \,\ \\ \rm}{\end{plemmat}}
\newcommand{\littleops}[2]{\mbox{$ {o_{p_n}^\star}({ n^{- \frac{#1}{#2}}}) $}}
\newcommand{\shn}{\mbox{${{\hat{S}}}(s)$}}
\newcommand{\shsn}{\mbox{${{\hat{S}}^{\staru\ }}(s)$}}
\newcommand{\khs}{\mbox{${{\hat{K}}^{\staru\ }}(u)$}}
\newcommand{\khbs}{\mbox{${\hat{{\overline{K}}}^\star}\hspace{-0.5ex}(u)$}}
\newcommand{\kh}{\mbox{${\hat{K}}(u)$}}
\newcommand{\khb}{\mbox{${\hat{{\overline{K}}}}(u)$}}
\newcommand{\rhs}{\mbox{${{\hat{R}}^{\staru\ }}(u)$}}
\newcommand{\rh}{\mbox{${\hat{R}}(u)$}}
\begin{document}
math_ex8.tex / continued next page
Example 8 of Math in LaTeX
\begin{plemma}
\vspace{-12pt}
\begin{eqnarray*}
\log \shsn\ & - & \log \shn\ = - \left[
{ \int_0^s \frac{d \khs\ }{\rhs\ } }
- { \int_0^s \frac{d \kh\ }{\rh\ } } \right]
+ \littleops{1}{2} \\
&=&
\int_0^s \left( \frac{1}{\rhs\ }-\frac{1}{\rh\ } \right)d\khb\
+ \int_0^s \frac{1}{\rh\ } d \left( \khbs\ - \khb\ \right) \\
& &
+ \int_0^s \left( \frac{1}{\rhs\ }-\frac{1}{\rh\ } \right)
d \left( \khbs\ - \khb\ \right) + \littleops{1}{2} \\
&=&
{\cal A} + {\cal B} + {\cal C} + \littleops{1}{2}
\end{eqnarray*}
\end{plemma}
\end{document}
math_ex8.tex / continued from last page
Example 8 of Math in LaTeX
math_ex8.tex
Example of Bibtex in LaTeX
\documentclass[12pt]{article}
\begin{document}
\bibliographystyle{unsrt}
\section{INTRODUCTION}
\label{intro}
One of the primary methodologic concerns with population-based database
studies is the potential for errors in the diagnoses reported in
the database. Thus, the performance of pharmacoepidemiologic
studies using these large databases usually requires verification
of diagnoses reported in the database \cite{Carson1994}, which
may be accomplished, for example, by obtaining medical records of
the presumptive cases identified in the database.
Brenner and Gefeller \cite{Brenner1993a} examined a similar design for estimating relative risks,
but they used the same sampling fraction for verifying the disease status of
exposed and unexposed presumptive cases.
\bibliography{bibtex_ex_refs} % Refers to file: bibtex_ex_refs.bib
\end{document}
bibtex_ex.tex
Example of Bibtex in LaTeX
@ARTICLE{Brenner1993a,
AUTHOR = "Brenner H and Gefeller O",
TITLE = "Use of the positive predictive value to correct for disease misclassification in epidemiologic studies",
YEAR
= "1993",
JOURNAL = "Am J Epidemiol",
VOLUME = "138",
PAGES = "1007-1015"
}
@BOOK{Carson1994,
AUTHOR = "Carson JL and Strom BL",
TITLE = "Medicaid databases. Chapter 15 in Strom BL: Pharmacoepidemiology",
PUBLISHER = "John Wiley and Sons, Chichester",
EDITION = "Second",
YEAR
= "1994"
}
bibtex_ex_refs.bib
Example of Bibtex in LaTeX
bibtex_ex.tex
\documentclass[12pt]{article}
\begin{document}
Example of Sections in LaTeX
\section{INTRODUCTION}
\label{intro}
This is section~\ref{intro}. Section~\ref{methods} will follow.
\section{NOTATION AND METHODS}
\label{methods}
This is section~\ref{methods} , which follows section~\ref{intro}.
\section{RESULTS}
\label{results}
This is section 3.
\subsection{ARE OF METHOD FOR ${\bf log(\hat{RR})}$ RELATIVE TO FULL VERIFICATION}
\label{arefull}
This is subsection~\ref{arefull}, which is within section~\ref{results}.
\subsection{ARE OF METHOD FOR ${\bf log(\hat{RR})}$ RELATIVE TO BG APPROACH}
\label{arebg}
This is subsection~\ref{arebg}, which is within section~\ref{results}.
\section{CONCLUSIONS}
\label{last}
This is section~\ref{last}. The first section was section~{intro}.
\end{document}
article_sections_ex.tex
Example of Sections in LaTeX
article_sections_ex.tex
\documentclass[12pt]{article}
\begin{document}
Example 2 of Sections in LaTeX
\section{INTRODUCTION}
\label{intro}
This is section~\ref{intro}. Section~\ref{methods} will follow.
\section{NOTATION AND METHODS}
\label{methods}
This is section~\ref{methods} , which follows section~\ref{intro}.
\section{RESULTS}
\label{results}
This is section 3.
\subsection{ARE OF METHOD FOR ${\bf log(\hat{RR})}$ RELATIVE TO FULL VERIFICATION}
\label{arefull}
This is subsection~\ref{arefull}, which is within section~\ref{results}.
\subsection{ARE OF METHOD FOR ${\bf log(\hat{RR})}$ RELATIVE TO BG APPROACH}
\label{arebg}
This is subsection~\ref{arebg}, which is within section~\ref{results}.
\section{CONCLUSIONS}
\label{last}
This is section~\ref{last}. The first section was section~{intro}.
\newpage
\tableofcontents
\end{document}
article_sections_ex2.tex
Example 2 of Sections in LaTeX
article_sections_ex2.tex
\documentclass[12pt]{article}
\begin{document}
\setcounter{page}{1}
Example of Journal Responses in LaTeX
\centerline{\underline{\bf \large Responses to Referees Comments}}
\,\ \vspace{-8pt} \\
The reviewers provided many helpful comments, and the manuscript has benefitted
tremendously from the collective guidance. We thank the reviewers.
\,\ \vspace{-13pt} \\
\centerline{\underline{\bf Responses to Referee A ``minor points''}}
\,\ \vspace{-13pt} \\
{\it Page 12: Is the bootstrap estimate of the sampling covariance matrix recomputed for each permutation
of the data?} \\
Yes, it is recomputed for each permutation. This is stated in Step 4b of elaboration of the coranova
procedure on page 12. Additionally, the statement ``For each random permutation, the bootstrap estimate
of $V$, $\widehat{V}_{Boot}$ is estimated in the process of estimating $S_B$.'' has been added (page 10, 5
lines from bottom).
\,\ \vspace{-1pt} \\
\centerline{\underline{\bf Responses to Referee B comments}}
\,\ \vspace{-35pt} \\
\begin{enumerate}
\item The manuscript does presume some statistical background. ...
\item We performed additional comparisons to other approaches, as the reviewer suggested, and found
important results. We thank the reviewer for their comment.
responses.tex
\end{enumerate}
\end{document}
Example of Journal Responses in LaTeX
responses.tex
Example of Letter in LaTeX
\documentstyle[12pt]{letter}
\raggedbottom \textwidth=6.2in \textheight=8.5in \oddsidemargin=.0in
\evensidemargin=.0in \headheight=-.6in \parskip=12pt \parindent=0.25in
\address{\,\ \vspace{0.3in} \\ }
\signature{Warren Bilker, Ph.D.}
\begin{document}
\begin{letter}{Roger E. Millsap \\
{\it Editor, MBR} \\ Department of Psychology \\
Arizona State University \\ 950 South McAllister Drive \\
Tempe, AZ 85287-1104 \\ }
\opening{\noindent{Professor Millsap:}}
We are submitting a revised and final version of the manuscript entitled
``A Two Factor ANOVA-like Test for Correlated Correlations: CORANOVA'',
for publication in Multivariate Behavioral Research. ...
Please send correspondences to: \\
\,\ \\
Warren Bilker, PhD \\ University of Pennsylvania, School of Medicine \\
Department of Biostatistics and Epidemiology \\ Room 601, Blockley Hall \\
423 Guardian Drive \\ Phila., PA 19104-6021
Thank you for the opportunity to have our work appear in Multivariate Behavioral Research.
\closing{Sincerely,}
\cc{ Colleen Brensinger, M.S. \\ Ruben C. Gur, Ph.D. }
\end{letter}
\end{document}
letter_ex1.tex
Example of Letter in LaTeX
letter_ex1.tex
Example of Inserting Picture in LaTeX
C:/FILES/PROJECTS/BSTA670/LaTeX_Maple_Mathematica/picture1.jpg
\documentclass[12pt]{article}
\usepackage{graphicx}
\graphicspath{%
{converted_graphics/}% inserted by PCTeX
{C:/}% inserted by PCTeX
}
\begin{document}
This is an example of inserting a picture in a LaTeX file.
\begin{figure}[h] % float placement: (h)ere, page (t)op, page (b)ottom, other (p)age
\centering
% file name: C:/FILES/PROJECTS/BSTA670/LaTeX_Maple_Mathematica/picture1.jpg
\includegraphics[width=5.67in,height=4.25in,keepaspectratio]{picture1}
\caption{Nice scenery}
\label{picture1}
\end{figure}
The picture above is figure~\ref{picture1}.
\end{document}
picture_ex1.tex
Example of Inserting Picture in LaTeX
picture_ex1.tex
Example of Slides in LaTeX using Beamer
\documentclass[pdf,t]{beamer}
\usepackage{graphicx}
\usepackage{bm}
\setbeamertemplate{footline}[page number]
\title{BSTA 670 (Fall 2008) - Statistical Computing \\
\vskip2ex
Lecture 9\\
\vskip2ex
Optimization II}
\author{}
\date{}
\begin{document}
\maketitle
\begin{frame}
\frametitle{Nelder-Mead Simplex Method}
Beamer_ex1.tex (1 of 3)
Example of Slides in LaTeX using Beamer
\begin{itemize}
\item The vector of parameters in K dimensions, $\bm\theta$
is to be minimized. A K-dimensional simplex, K-simplex, is defined by
K+1 points in K-space (in 1D, a line segment is defined by 2
points).
\item Select a starting point for $\bm\theta$,
$\bm\theta_0$.
\item Compute the centroid (average of the points of the K-simplex OR
center of mass of the K-simplex).
\begin{equation}
\tilde{\bm\theta}_{(0)}
= \frac{1}{K+1} \sum_{i=0}^{K} \bm\theta_{0i} \quad.\nonumber
\end{equation}
\item Do a 1-D search over $\bm\theta_K + \alpha
(\tilde{\bm\theta}_{(K)}-\bm\theta_K)$, where $\alpha\in[0,2]$, to find the
next $\bm\theta_K$.
\item Repeat until convergence.
\end{itemize}
\end{frame}
Beamer_ex1.tex (2 of 3)
Example of Slides in LaTeX using Beamer
\begin{frame}
\frametitle{A Model Problem: Widow's Pension Fund}
\begin{itemize}
\item We will demonstrate several of the optimization methods discussed on
the widow's pension fund problem that we used earlier for root finding.
\item Recall that this problem was to determine the parameters of a mixed
model: the mixture parameter $\xi$ and the Poisson intensity $\lambda$.
\item The log likelihood for this problem was
{\footnotesize
\begin{eqnarray*}
\ell (\xi , \lambda)
& = & n_0 \log \left( \xi + (1-\xi) e^{-\lambda} \right)
+ (N-n_0) \left[\log(1-\xi)-\lambda\right] \\
& + & \sum_{i=1}^{\infty} i \,\ n_i \log\lambda \quad.
\end{eqnarray*}
}
\end{itemize}
\end{frame}
\end{document}
Beamer_ex1.tex (3 of 3)
Example of Slides in LaTeX using Beamer
Beamer_ex1.tex Output
Example 2 of Slides in LaTeX using Beamer
Berkeley Theme Slides
\documentclass[pdf,t]{beamer}
\usetheme{Berkeley}
\usepackage{graphicx}
\usepackage{bm}
\setbeamertemplate{footline}[page number]
\title{BSTA 670 (Fall 2008) - Statistical Computing \\
\vskip2ex
Lecture 9\\
\vskip2ex
Optimization II}
\author{}
\date{}
\begin{document}
\maketitle
\begin{frame}
\frametitle{Nelder-Mead Simplex Method}
Beamer_ex1.tex (1 of 3)
Example 2 of Slides in LaTeX using Beamer
Beamer_ex2.tex Output
Other Presentation Themes for Beamer
Without Navigation Bars: default, Bergen, Boadilla,
Madrid, AnnArbor, CambridgeUS, Pittsburgh,
Rochester
With a Navigation Bar: Antibes, JuanLesPins, Montpellier
With a table of contents: Berkeley, PaloAlto, Goettingen,
Marburg, Hannover
With Mini Frame Navigation: Berlin, Ilmenau, Dresden,
Darmstadt, Frankfurt, Singapore, Szeged
With Section and Subsection Table: Copenhagen,
Luebeck, Malmoe, Warsaw
Beamer_ex2.tex Output
Example 3 of Slides in LaTeX using Beamer
\documentclass[pdf,t]{beamer}
\usepackage{graphicx}
\usepackage{bm}
\setbeamertemplate{footline}[page number]
\setbeamercolor{normal text}{bg=yellow!25}
\title{BSTA 670 (Fall 2008) - Statistical Computing\\
\vskip2ex
Lecture 9\\
\vskip2ex
\textcolor{brown}{Optimization II}}
\author{}
\date{}
\begin{document}
\maketitle
Beamer_ex3.tex (1 of 3)
Example 3 of Slides in LaTeX using Beamer
\begin{frame}
\frametitle{Nelder-Mead Simplex Method}
\begin{itemize}
\item The vector of \textcolor{green}{parameters in K dimensions} , $\bm\theta$
is to be minimized. A K-dimensional simplex, K-simplex, is defined byK+1 points in K-space (in 1D, a
line segment is defined by 2points).
\item Select a starting point for $\bm\theta$,$\bm\theta_0$.
\item Compute the centroid (average of the points of the K-simplex ORcenter of mass of the Ksimplex).
\begin{equation}
\tilde{\bm\theta}_{(0)}
= \frac{1}{K+1} \sum_{i=0}^{K} \bm\theta_{0i} \quad.\nonumber
\end{equation}
\item Do a 1-D search over $\bm\theta_K + \alpha
(\tilde{\bm\theta}_{(K)}-\bm\theta_K)$, where $\alpha\in[0,2]$, to find the
next $\bm\theta_K$.
\item \textcolor{blue}{Repeat until convergence}.
\end{itemize}
\end{frame}
Beamer_ex3.tex (2 of 3)
Example 3 of Slides in LaTeX using Beamer
\begin{frame}
\frametitle{A Model Problem: Widow's Pension Fund}
\begin{itemize}
\item We will demonstrate several of the optimization methods discussed on
the widow's pension fund problem that we used earlier for root finding.
\item Recall that this problem was to determine the parameters of a mixed
model: the mixture parameter $\xi$ and the Poisson intensity $\lambda$.
\item The log likelihood for this problem was
\textcolor{red}{
{\footnotesize
\begin{eqnarray*}
\ell (\xi , \lambda)
& = & n_0 \log \left( \xi + (1-\xi) e^{-\lambda} \right)
+ (N-n_0) \left[\log(1-\xi)-\lambda\right] \\
& + & \sum_{i=1}^{\infty} i \,\ n_i \log\lambda \quad.
\end{eqnarray*}
}
}
\end{itemize}
\end{frame}
\end{document}
Beamer_ex3.tex (3 of 3)
Example 3 of Slides in LaTeX using Beamer
Beamer_ex3.tex Output