Sweave: Reproducible Research Using R and LATEX

Total Page:16

File Type:pdf, Size:1020Kb

Sweave: Reproducible Research Using R and LATEX Sweave: Reproducible Research using R and LATEX Sandra D. Griffith Department of Biostatistics and Epidemiology University of Pennsylvania [email protected] Biostatistics Computing Workshop Series March 15, 2012 S. Griffith ([email protected]) Sweave 15 March 2012 1 / 20 Non-reproducible Research • Characteristics I Prepare or manipulate data in a spreadsheet I Cut and paste output to create tables I Multiple versions of data and analysis scripts I Create many versions of graphics, selecting only one for final presentation of results • Problems I Data, code, and results not linked I Any changes in analysis or data require manual regeneration of results I Workflow or organization scheme may change over time I Can be difficult to replicate in the future I Less forensic evidence if results are questioned S. Griffith ([email protected]) Sweave 15 March 2012 2 / 20 Response to Duke University Scandal \We now require most of our reports to be written using Sweave, a literate programming combination of LATEX source and R code (SASweave and odfWeave are also available) so that we can rerun the reports as needed and get the same results." S. Griffith ([email protected]) Sweave 15 March 2012 3 / 20 Sweave: Conceptual Overview • Link data, code, and results with a single .Rnw file I Similar to .tex file, but includes interspersed \chunks" of R code I Uses noweb syntax for literate programming • Weave .Rnw file to produce .tex file which includes output from R code • Compile TeX file to PDF or PS files as usual • Tangle .Rnw file to extract R code into separate file • In addition to including them in the output, creates individual files for each figure • Can refer to within-chunk R expressions in regular document text using Sexpr S. Griffith ([email protected]) Sweave 15 March 2012 4 / 20 Getting Started with Sweave • Assume R and LATEX already installed • Sweave.sty is already included with base R installation I Preferred method: include R folder containing Sweave.sty in your TeX path F Will automatically update style file when you update R I Copy Sweave.sty to a centralized location with other style files, also in your TeX path F Requires manual updates, but can be located in a central location shared among computers (e.g. Dropbox) I Hard path: include \usepackage{...\Sweave} in preamble I Copy Sweave.sty into same folder as each .Rnw file S. Griffith ([email protected]) Sweave 15 March 2012 5 / 20 Anatomy of a Code Chunk << label (optional), options >>= insert R code here @ Commonly-used options (see manual for full list) • echo = F Suppress R input from appearing in document (default = T) • eval = F R code not evaluated (default = T) • results = hide Suppress R output from appearing in document (default = verbatim) • results = tex R output will be read as TeX (default = verbatim) • fig = T Code chuck includes a figure (default = F) S. Griffith ([email protected]) Sweave 15 March 2012 6 / 20 Global Options Default options can be set in preamble and updated throughout document • Set R chunk options \SweaveOpts{eval=T, echo=F} • Preserve comments and spacing of echoed R code \SweaveOpts{keep.source=TRUE} • Figure options for height, width, and file type S. Griffith ([email protected]) Sweave 15 March 2012 7 / 20 Example <<echo=T>>= x <- exp(2.3) x @ > x <- exp(2.3) > x [1] 9.974182 <<echo=F>>= x <- exp(2.3) x @ [1] 9.974182 <<echo=T, results=hide>>= x <- exp(2.3) x @ > x <- exp(2.3) > x S. Griffith ([email protected]) Sweave 15 March 2012 8 / 20 Compiling an Sweave Document • Manually (Windows or Mac) 1. Run Sweave(`foo.Rnw') in R console 2. Open foo.tex in a TeX editor 3. Compile PDF using TeX editor 4. Stangle(`foo.Rnw') to extract R code if desired • Manually (Linux/Unix) 1. Run R CMD Sweave foo.Rnw 2. Run pdflatex foo or latex foo • Integrated Development Environment (IDE) I Rstudio, Emacs (ESS), Eclipse (StatEt), etc. I If supported, usually one click/command for all steps (Sweave, compile TeX, view PDF) S. Griffith ([email protected]) Sweave 15 March 2012 9 / 20 RStudio S. Griffith ([email protected]) Sweave 15 March 2012 10 / 20 The xtable Package: Basic Table Code R package to convert many R objects to LATEXor HTML tables <<label=tab:GenderRace, results=tex>>= library(xtable) data(tli) xtable(table(tli$ethnicty, tli$sex), caption="Distribution of gender and ethnicity") @ <<label=tab:LM1, results=tex>>= lm1 <- lm(tlimth ~ sex + ethnicty, data=tli) xtable(lm1, caption="Linear Model Results") @ S. Griffith ([email protected]) Sweave 15 March 2012 11 / 20 The xtable package: Basic Table Output FM BLACK 11 12 HISPANIC 8 12 OTHER 2 0 WHITE 30 25 Table: Distribution of gender and ethnicity Estimate Std. Error t value Pr(>jtj) (Intercept) 71.0226 3.2894 21.59 0.0000 sexM 3.3734 2.8594 1.18 0.2410 ethnictyHISPANIC -3.7466 4.3044 -0.87 0.3863 ethnictyOTHER 18.4774 10.4716 1.76 0.0809 ethnictyWHITE 7.4622 3.4964 2.13 0.0354 Table: Linear Model Results S. Griffith ([email protected]) Sweave 15 March 2012 12 / 20 The xtable package: Customized Tables > mat <- round(matrix(c(0.9, 0.89, 200, 0.045, 2.0), + c(1, 5)), 4) > rownames(mat) <- "$y_{t-1}$" > colnames(mat) <- c("$R^2$", "$\\bar{R}^2$", + "F-stat", "S.E.E", "DW") > mat <- xtable(mat) > print(mat, sanitize.text.function = function(x){x}) R2 R¯ 2 F-stat S.E.E DW yt−1 0.90 0.89 200.00 0.04 2.00 Almost all functionality available for LATEX tables can be included directly in R code using xtable S. Griffith ([email protected]) Sweave 15 March 2012 13 / 20 Aside: Using xtable for MS Word Tables Non-statistical collaborators often prefer tabular results in MS Word xtable(table(tli$ethnicty, tli$sex), file="TabGenderRace", type="html" ) 1. Save results in HTML file using xtable() in R 2. Open \TabGenderRace.htm" in a browser 3. Copy and paste into Word document as a fully-formatted table S. Griffith ([email protected]) Sweave 15 March 2012 14 / 20 Basic Figure Example <<fig=T, echo=F, width=5, height=3.5>>= plot(1:10, rnorm(10)) @ ● ● ● 1 ● 0 ● ● ● ● ● rnorm(10) −1 −2 ● 2 4 6 8 10 1:10 NB: Embed figure chunk within a LATEX figure environment for more precise control S. Griffith ([email protected]) Sweave 15 March 2012 15 / 20 Large or Computationally Intensive Projects • Use input statements or make files • save() and load() intermediate results • Conditional evaluation if (file exists) {load file} else {run; save file}) • Change R chunk evaluation options as necessary • R package: cacheSweave to cache intermediate results S. Griffith ([email protected]) Sweave 15 March 2012 16 / 20 Including R code as an Appendix • Useful for homework, solution sets, etc. • Include \usepackage{listings} in the preamble • Include the following R chunk and TeX code in foo.Rnw where you would like to place appendix <<echo=FALSE, results=hide, split=TRUE>>= Stangle(file="foo.Rnw",output="foo.R", annotate=FALSE) @ \pagebreak \section{R Code} \texttt{\lstinputlisting[emptylines=0]{foo.R}} S. Griffith ([email protected]) Sweave 15 March 2012 17 / 20 Miscellaneous Sweave Tricks • Load all libraries in one chunk with results = hide option to suppress unwanted output (e.g. package dependencies) • Beamer presentations I Include [fragile] option for every frame with R code to handle verbatim output I For frames with TeX and verbatim output, must include [containsverbatim] option instead • R graphics package ggplot2 I Must use print() wrapper for ggplot objects • R session information > toLatex(sessionInfo(), locale=F) I R version 2.14.1 (2011-12-22), x86_64-pc-mingw32 I Base packages: base, datasets, graphics, grDevices, methods, stats, utils I Other packages: xtable 1.7-0 I Loaded via a namespace (and not attached): tools 2.14.1 S. Griffith ([email protected]) Sweave 15 March 2012 18 / 20 Alternatives for Reproducible Research • R for other document formats I HTML: R2HTML I Open Office: odfWeave I MS Word: Sword I MS Powerpoint: R2PPT • Other statistical packages I Statweave for SAS, Stata, or MATLAB and LATEX or Open Office I Various other software-specific report generators S. Griffith ([email protected]) Sweave 15 March 2012 19 / 20 Resources • Sweave user manual (Friedrich Leisch): http://www.stat. uni-muenchen.de/~leisch/Sweave/Sweave-manual.pdf • Stack Overflow questions tagged Sweave: http://stackoverflow.com/questions/tagged/sweave • Keith Baggerly's introduction to Sweave: http://bioinformatics. mdanderson.org/SweaveTalk/sweaveTalkb.pdf • QuickR summary of alternatives to Sweave: http://www.statmethods.net/interface/output.html • Citing R with Sweave: http://biostat.mc.vanderbilt.edu/ wiki/pub/Main/SweaveLatex/RCitation.pdf • xtable gallery with examples: http://cran.r-project.org/web/ packages/xtable/vignettes/xtableGallery.pdf S. Griffith ([email protected]) Sweave 15 March 2012 20 / 20.
Recommended publications
  • Sweave User Manual
    Sweave User Manual Friedrich Leisch and R-core June 30, 2017 1 Introduction Sweave provides a flexible framework for mixing text and R code for automatic document generation. A single source file contains both documentation text and R code, which are then woven into a final document containing • the documentation text together with • the R code and/or • the output of the code (text, graphs) This allows the re-generation of a report if the input data change and documents the code to reproduce the analysis in the same file that contains the report. The R code of the complete 1 analysis is embedded into a LATEX document using the noweb syntax (Ramsey, 1998) which is usually used for literate programming Knuth(1984). Hence, the full power of LATEX (for high- quality typesetting) and R (for data analysis) can be used simultaneously. See Leisch(2002) and references therein for more general thoughts on dynamic report generation and pointers to other systems. Sweave uses a modular concept using different drivers for the actual translations. Obviously different drivers are needed for different text markup languages (LATEX, HTML, . ). Several packages on CRAN provide support for other word processing systems (see Appendix A). 2 Noweb files noweb (Ramsey, 1998) is a simple literate-programming tool which allows combining program source code and the corresponding documentation into a single file. A noweb file is a simple text file which consists of a sequence of code and documentation segments, called chunks: Documentation chunks start with a line that has an at sign (@) as first character, followed by a space or newline character.
    [Show full text]
  • ESS — Emacs Speaks Statistics
    ESS — Emacs Speaks Statistics ESS version 5.14 The ESS Developers (A.J. Rossini, R.M. Heiberger, K. Hornik, M. Maechler, R.A. Sparapani, S.J. Eglen, S.P. Luque and H. Redestig) Current Documentation by The ESS Developers Copyright c 2002–2010 The ESS Developers Copyright c 1996–2001 A.J. Rossini Original Documentation by David M. Smith Copyright c 1992–1995 David M. Smith Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Chapter 1: Introduction to ESS 1 1 Introduction to ESS The S family (S, Splus and R) and SAS statistical analysis packages provide sophisticated statistical and graphical routines for manipulating data. Emacs Speaks Statistics (ESS) is based on the merger of two pre-cursors, S-mode and SAS-mode, which provided support for the S family and SAS respectively. Later on, Stata-mode was also incorporated. ESS provides a common, generic, and useful interface, through emacs, to many statistical packages. It currently supports the S family, SAS, BUGS/JAGS, Stata and XLisp-Stat with the level of support roughly in that order. A bit of notation before we begin. emacs refers to both GNU Emacs by the Free Software Foundation, as well as XEmacs by the XEmacs Project. The emacs major mode ESS[language], where language can take values such as S, SAS, or XLS.
    [Show full text]
  • Species' Traits and Phylogenetic
    Northern Michigan University NMU Commons All NMU Master's Theses Student Works 8-2018 CLIMATE DRIVEN RANGE SHIFTS OF NORTH AMERICAN SMALL MAMMALS: SPECIES’ TRAITS AND PHYLOGENETIC INFLUENCES Katie Nehiba [email protected] Follow this and additional works at: https://commons.nmu.edu/theses Part of the Ecology and Evolutionary Biology Commons Recommended Citation Nehiba, Katie, "CLIMATE DRIVEN RANGE SHIFTS OF NORTH AMERICAN SMALL MAMMALS: SPECIES’ TRAITS AND PHYLOGENETIC INFLUENCES" (2018). All NMU Master's Theses. 557. https://commons.nmu.edu/theses/557 This Open Access is brought to you for free and open access by the Student Works at NMU Commons. It has been accepted for inclusion in All NMU Master's Theses by an authorized administrator of NMU Commons. For more information, please contact [email protected],[email protected]. CLIMATE DRIVEN RANGE SHIFTS OF NORTH AMERICAN SMALL MAMMALS: SPECIES’ TRAITS AND PHYLOGENETIC INFLUENCES By Katie R. Nehiba THESIS Submitted to Northern Michigan University In partial fulfillment of the requirements For the degree of MASTER OF SCIENCE Office of Graduate Education and Research July 2018 ABSTRACT By Katie R. Nehiba Current anthropogenically-driven climate change is accelerating at an unprecedented rate. In response, species’ ranges may shift, tracking optimal climatic conditions. Species-specific differences may produce predictable differences in the extent of range shifts. I evaluated if patterns of predicted responses to climate change were strongly related to species’ taxonomic identities and/or ecological characteristics of species’ niches, elevation and precipitation. I evaluated differences in predicted range shifts in well-sampled small mammals that are restricted to North America: kangaroo rats, voles, chipmunks, and ground squirrels.
    [Show full text]
  • Reproducible Research.. Using Sweave, Knitr and Pandoc
    Reproducible Research.. Using Sweave, Knitr and Pandoc Aedín Culhane [email protected] Nov 20th 2012 My R Course Website http://bcb.dfci.harvard.edu/~aedin/ My HSPH homepage http://www.hsph.harvard.edu/research/aedin-culhane/ When issues of reproducibility arise • ``Remember that microarray analysis you did six months ago? We ran a few more arrays. Can you add them to the project and repeat the same analysis?'' • ``The statistical analyst who looked at the data I generated previously is no longer available. Can you get someone else to analyze my new data set using the same methods (and thus producing a report I can expect to understand)?'' • ``Please write/edit the methods sections for the abstract/paper/grant proposal I am submitting based on the analysis you did several months ago.'' From Keith Baggerly • Selected articles published in Nature Genetics between January 2005 and December 2006 that had used profiling with microarrays • Of the 56 items retrieved electronically, 20 articles were considered potentially eligible for the project • The four teams were from – University of Alabama at Birmingham (UAB) – Stanford/Dana-Farber (SD) – London (L) and Ioannina/Trento (IT) • Each team was comprised of 3-6 scientists who worked together to evaluate each article. Results • Result could be reproduced n=2 • Reproduced with discrepancy n=6 • Could not be reproduced n=10 – No data n=4 (no data n=2, subset n=1, no reporter data n=1) – Confusion over matching of data to analysis (n=2) – Specialized software required and not available (n=1)m – Raw data available but could not be processed n=2 Reproducibility of Analysis Ioannidis JP, Allison DB, Ball CA, Coulibaly I, Cui X, Culhane AC, et al, (2009) Repeatability of published microarray gene expression Analyses.
    [Show full text]
  • Dynamic Documents with R and Knitr, by Yihui Xie 116 Tugboat, Volume 35 (2014), No
    TUGboat, Volume 35 (2014), No. 1 115 ● ● ● Book review: Dynamic Documents with R ● ● ● and knitr, by Yihui Xie ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Boris Veytsman ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Yihui Xie, Dynamic Documents with R and knitr. ● ● ● ● ● ● ● ● ● ● ● ● ● ● Chapman & Hall/CRC Press, 2013, 190+xxvi pp. ● ● ● ● ● ● ● ● ● US$ ISBN ● Paperback, 59.95. 978-1482203530. ● ● ● ● Petal Length, cm Petal ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 1 2 3 4 5 6 7 0.5 1.0 1.5 2.0 2.5 Petal Width, cm This plot shows an almost linear dependence between the parameters. We can try a linear fit for these data: model <- lm(Petal.Length ˜ Petal.Width, data = iris) model$coefficients ## (Intercept) Petal.Width ## 1.084 2.230 summary(model)$r.squared ## [1] 0.9271 The large value of R2 = 0.9271 indicates the good quality of the fit. Of course we can replot the data There are several reasons why this book might be of together with the prediction of the linear model: interest to a TEX user. First, LATEX has a prominent place in the book. Second, the book describes a very plot(Petal.Length ˜ Petal.Width, interesting offshoot of literate programming, a topic data = iris, xlab = "Petal Width, cm", traditionally popular in the TEX community. Third, ylab = "Petal Length, cm") abline(model) since a number of TEX users work with data analysis and statistics, R could be a useful tool for them. Since some TUGboat readers are likely not fa- ● ● ● miliar with R, I would like to start this review with ● ● a short description of the software. R [1] is a free ● ● ● ● ● ● ● ● ● ● ● implementation of the S language (sometimes R is ● ● ● ● ● ● ● ● ● ● ● ● ● ● called GNU S).
    [Show full text]
  • LYX and Knitr
    knitr.1 LYX and knitr The knitr package allows one to embed R code within LYX and LATEX documents. When a document is compiled into a PDF, LYX/LATEX connects to R to run the R code and the code/output is automatically put into the PDF. In addition to this being a convenient way to use both LYX/LATEX with R, it also provides an important component to the reproducibility of research (RR). For example, one can include the code for a data analysis de- scribed in a paper. This ensures that there would be no “copying and pasting errors” and also provide readers of the paper an im- mediate way to reproduce the research. RR continues to become more important and fortunately more tools are being developed to make it possible. Below are some discussions on the topic: • AMSTAT News column on RR at http://magazine. amstat.org/blog/2011/01/01/scipolicyjan11. • CRAN task view for RR and R at http://cran.r-project. org/web/views/ReproducibleResearch.html. • Yihui Xie: Author of knitr – First and second editions of his Dynamic Documents with R and knitr book. Note that this book was typed in LYX. – Website for knitr at http://yihui.name/knitr The Sweave environment is another way to include R code inside of LYX/LATEX. This was developed prior to knitr, but it is more difficult to use. The purpose of this section is to examine the main compo- nents of knitr so that you will be able to complete the rest of the semester using LYX and knitr together for all assign- ments in our course! Also, a very important purpose is to give you the tools needed to complete all assignments in other R- based courses by using knitr and LYX together! The files used knitr.2 here are intro_example_cereal.lyx, intro_example_cereal.pdf, cereal.csv, ExternalCode.R, FirstBeamer-knitr.zip, JSM2015.zip, and RMarkdown.zip.
    [Show full text]
  • Book of Abstracts
    Book of Abstracts June 27, 2015 1 Conference Sponsors Diamond Sponsor Platinum Sponsors Gold Sponsors Silver Sponsors Open Analytics Bronze Sponsors Media Sponsors 2 Conference program Time Tuesday Wednesday Thursday Friday 08:00 Registration opens Registration opens Registration opens Registration opens 08:30 – 09:00 Opening session (by Rector peR! M. Johansen, Aalborg University) Aalborghallen 09:00 – 10:00 Romain François Di Cook Thomas Lumley Aalborghallen Aalborghallen Aalborghallen 10:00 – 10:30 Coffee break Coffee break Coffee break (15 min) ee break Sponsored by Quantide Sponsored by Alteryx ff Session 1 Session 4 10:30 – 12:00 Sponsor session (10:15) Kaleidoscope 1 Kaleidoscope 4 Aalborghallen Aalborghallen Aalborghallen incl. co Morning Tutorials DataRobot Ecology Medicine Gæstesalen Gæstesalen RStudio Teradata Networks Regression Musiksalen Musiksalen Revolution Analytics Reproducibility Commercial Offerings alteryx Det Lille Teater Det Lille Teater TIBCO H O Interfacing Interactive graphics 2 Radiosalen Radiosalen HP 12:00 – 13:00 Sandwiches Lunch (standing buffet) Lunch (standing buffet) Break: 12:00 – 12:30 Sponsored by Sponsored by TIBCO ff Revolution Analytics Ste en Lauritzen (12:30) Aalborghallen Session 2 Session 5 13:00 – 14:30 13:30: Closing remarks Kaleidoscope 2 Kaleidoscope 5 Aalborghallen Aalborghallen 13:45: Grab ’n go lunch 14:00: Conference ends Case study Teaching 1 Gæstesalen Gæstesalen Clustering Statistical Methodology 1 Musiksalen Musiksalen ee break Data Management Machine Learning 1 ff Det Lille Teater Det Lille
    [Show full text]
  • The R Journal, June 2012
    The Journal Volume 2/1, June 2010 A peer-reviewed, open-access publication of the R Foundation for Statistical Computing Contents Editorial..................................................3 Contributed Research Articles IsoGene: An R Package for Analyzing Dose-response Studies in Microarray Experiments..5 MCMC for Generalized Linear Mixed Models with glmmBUGS ................. 13 Mapping and Measuring Country Shapes............................... 18 tmvtnorm: A Package for the Truncated Multivariate Normal Distribution........... 25 neuralnet: Training of Neural Networks............................... 30 glmperm: A Permutation of Regressor Residuals Test for Inference in Generalized Linear Models.................................................. 39 Online Reproducible Research: An Application to Multivariate Analysis of Bacterial DNA Fingerprint Data............................................ 44 Two-sided Exact Tests and Matching Confidence Intervals for Discrete Data.......... 53 Book Reviews A Beginner’s Guide to R......................................... 59 News and Notes Conference Review: The 2nd Chinese R Conference........................ 60 Introducing NppToR: R Interaction for Notepad++......................... 62 Changes in R 2.10.1–2.11.1........................................ 64 Changes on CRAN............................................ 72 News from the Bioconductor Project.................................. 85 R Foundation News........................................... 86 2 The Journal is a peer-reviewed publication of
    [Show full text]
  • Introduction to R: Part V Annex
    Introduction to R: Part V Annex Alexandre Perera i Lluna1;2 1Centre de Recerca en Enginyeria Biomèdica (CREB) Departament d’Enginyeria de Sistemes, Automàtica i Informàtica Industrial (ESAII) Universitat Politècnica de Catalunya mailto:[email protected] 2Centro de Investigación Biomédica en Red en Bioingeniería, Biomateriales y Nanomedicina (CIBER-BBN) Jan 2011 / Introduction to R Universitat Rovira i Virgili Integration to other Languages Writing parallel code in R Bibliography ContentsI 1 Integration to other Languages R4Calc, OpenOffice LATEX R integration into Latex, Sweave 2 Writing parallel code in R Parallel code: when, how and why? R, Rmpi, Snow 3 Bibliography Alexandre Perera i Lluna; Introduction to R: Part V Integration to other Languages R4Calc, OpenOffice Writing parallel code in R LATEX Bibliography R integration into Latex, Sweave R and Calc R and Calc is an extension to Calc application, part of the OO.o suite (OpenOffice.org): Allows to see R objects from the OO.o menu R should be started with Rserve running: library(Rserve) Rserve() in OO.o, Use the menu bar R Add-on > Rdump() It will open a dialog, input rnorm(10) cor.test(c(1,2,3,4), c(1,2,2,3)) A new sheet will open with the result of the link to R http: //wiki.services.openoffice.org/wiki/R_and_Calc Alexandre Perera i Lluna; Introduction to R: Part V Integration to other Languages R4Calc, OpenOffice Writing parallel code in R LATEX Bibliography R integration into Latex, Sweave What is latex? LATEX (written as LaTeX in plain text, pronounced as /l\'atej/ ) is: Is a document markup language Is document preparation system for the TEX typesetting program Originally written in 1984 by Leslie Lamport at SRI International Only to the language in which documents are written, not to the text editor itself.
    [Show full text]
  • Datascientist Manual
    DATASCIENTIST MANUAL . 2 « Approcherait le comportement de la réalité, celui qui aimerait s’epanouir dans l’holistique, l’intégratif et le multiniveaux, l’énactif, l’incarné et le situé, le probabiliste et le non linéaire, pris à la fois dans l’empirique, le théorique, le logique et le philosophique. » 4 (* = not yet mastered) THEORY OF La théorie des probabilités en mathématiques est l'étude des phénomènes caractérisés PROBABILITY par le hasard et l'incertitude. Elle consistue le socle des statistiques appliqué. Rubriques ↓ Back to top ↑_ Notations Formalisme de Kolmogorov Opération sur les ensembles Probabilités conditionnelles Espérences conditionnelles Densités & Fonctions de répartition Variables aleatoires Vecteurs aleatoires Lois de probabilités Convergences et théorèmes limites Divergences et dissimilarités entre les distributions Théorie générale de la mesure & Intégration ------------------------------------------------------------------------------------------------------------------------------------------ 6 Notations [pdf*] Formalisme de Kolmogorov Phé nomé né alé atoiré Expé riéncé alé atoiré L’univérs Ω Ré alisation éléméntairé (ω ∈ Ω) Evé némént Variablé aléatoiré → fonction dé l’univér Ω Opération sur les ensembles : Union / Intersection / Complémentaire …. Loi dé Augustus dé Morgan ? Independance & Probabilités conditionnelles (opération sur des ensembles) Espérences conditionnelles 8 Variables aleatoires (discret vs reel) … Vecteurs aleatoires : Multiplét dé variablés alé atoiré (discret vs reel) … Loi marginalés Loi
    [Show full text]
  • Short Introduction to ESS
    Why? Emacs ESS Demo Summary Short Introduction to ESS Dirk Eddelbuettel [email protected], [email protected] With thanks to ESS Core for their presentations in SVN Short presentation Chicago R User Group 16 December 2010 Dirk Eddelbuettel Short Introduction to ESS Why? Emacs ESS Demo Summary For programmers Outline 1 Why? 2 Emacs 3 ESS 4 Demo 5 Summary Dirk Eddelbuettel Short Introduction to ESS Why? Emacs ESS Demo Summary For programmers Why? Source: http://xkcd.com/378/ Dirk Eddelbuettel Short Introduction to ESS Why? Emacs ESS Demo Summary For programmers Why? Source: http://www.io.com/~dierdorf/emacsvi.html Dirk Eddelbuettel Short Introduction to ESS Why? Emacs ESS Demo Summary Overview Pro/Con How Outline 1 Why? 2 Emacs 3 ESS 4 Demo 5 Summary Dirk Eddelbuettel Short Introduction to ESS Why? Emacs ESS Demo Summary Overview Pro/Con How Overview Emacs is the extensible, customizable, self-documenting real-time display editor. One of the oldest and yet still most powerful display editors The name Emacs comes from Editor (or Extensible) MACroS. (source of other amusing acronym expansions) Originally written in 1976 as a set of extensions to TECO (Text Editor and COrrector). It has since evolved. Dirk Eddelbuettel Short Introduction to ESS Why? Emacs ESS Demo Summary Overview Pro/Con How Pros and Cons for Emacs Why use Emacs? It is a powerful text editor which can be extended to be a general interface to a computer (everything can be done within it). It is highly portable (in its own way) across many platforms. Why do not use it? It has a different user interface, which is understandable given its age (little change since 1985).
    [Show full text]
  • Stat 302 Statistical Software and Its Applications the Knitr Package and Rstudio
    Stat 302 Statistical Software and Its Applications The knitr Package and RStudio Fritz Scholz Department of Statistics, University of Washington Winter Quarter 2015 January 8, 2015 1 The knitr Package The knitr package integrates code, output, and narrative. It was created by Yihui Xie who was inspired by Sweave. Right click on the R icon and start an Administrator R session. Install knitr via install.packages("knitr", dependencies=TRUE) It is assumed that LATEX is already installed on your system. In the initial use of knitr in R or RStudio you may be prompted to install further LATEX packages. That happens just once and is automatic. 2 First Usage of knitr Create a working directory, say EX2. Inside EX2 and using a text editor create a le named minimal.Rnw with content shown on the next two slides. Note that it looks very much like a LATEX le in structure, except for the chunk delimited by <<plot .... >>= R code commands @ Also note the use of \Sexpr{...} to access contents of R objects created with the R commands. You can use ’right’ or ’left’ in place of ’center’ in fig.align. The plot after << acts as plot le name handle, see the gure subfolder in EX2. Dierent plots require dierent handles. 3 Content of minimal.Rnw (Slide 1) \documentclass{article} \setlength{\topmargin}{-1in} \setlength{\oddsidemargin}{-.25in} \setlength{\evensidemargin}{-.25in} \setlength{\textwidth}{7in} \setlength{\textheight}{10in} \begin{document} \begin{flushright} \parbox{1in}{Fritz Scholz\\ ID: 1234567\vspace{1.25in} } \includegraphics[width=.5in]{./figure/fritzbuzz.jpg} \end{flushright} \begin{center} {\large A Minimal Example}\vspace{.1in}\\ Fritz Scholz \end{center} We examine the relationship between speed and stopping distance using a linear regression model: $Y=\beta_0+\beta_1 x+\epsilon$.
    [Show full text]