Intermediate Programming in R Session 4: Avoiding Loops. Olivia Lau, PhD
|
|
- Horatio Pierce
- 6 years ago
- Views:
Transcription
1 Intermediate Programming in R Session 4: Avoiding Loops Olivia Lau, PhD
2 Outline Thinking in Parallel Vectorization Avoiding Loops with Homogenous Data Structures Avoiding Loops with Heterogenous Data Structures 2
3 Thinking in Parallel Independent operations can be performed in parallel Dependent operations cannot be performed in parallel Loops where the next loop iteration depends on values from the previous iteration e.g., in Bayesian statistics, some Markov Chain Monte Carlo methods These operations are inherently serial Important in some situations where R performs particularly slowly otherwise Opens the door to parallel computing You ve already been thinking in parallel with vectorized functions 3
4 Motivating Example: ID number of missing values Could use a nested loop mv <- rep(0, col(worldbank)) for (i in 1:ncol(worldbank)) { for (j in 1:nrow(worldbank)) { mv[i] <- mv[i] + is.na(worldbank[j, i]) } } mv Or loop through variables mv <- NULL for (i in 1:ncol(worldbank)) { tmp <- is.na(worldbank[[i]]) mv[i] <- sum(tmp) } mv Or avoid loops all together apply(worldbank, 2, function(x) sum(is.na(x))) 4
5 Vectorization Vectorized function take a vector as input and output a vector of the same length, eliminating the need for nested loops when dealing with 2D data structures From the previous example, the vectorized component is tmp <- is.na(worldbank[[i]]) If you are using a vectorized function in a loop and the loop iterations are independent, you can avoid the loop altogether using *apply() functions For homogenous data structures, use apply() For heterogenous data structures, use lapply(), sapply(), tapply(), or aggregate() 5
6 Homogenous Data Structures: Use apply() apply(x, MARGIN, FUN,...) For a matrix, use the same function on every row (MARGIN = 1) or column (MARGIN = 2) Also generalizes to an array Specify the dimensions to keep Sweep over the remaining dimensions Can specify more than one dimension to keep Function output has to have the same attributes for all margins First argument to the function has to be the margin selected from X Additional arguments to FUN can be specified User-defined functions can be used Output has to have the same length or dimension over all margins 6
7 Check In 1 Revisiting Assignment 1, create a co2 matrix (countries x years) from the worldbank data co2 <- matrix(na, nrow = 214, ncol = 7, dimnames = list(null, as.character(2002:2008))) for (i in 2002:2008) { co2[, as.character(i)] <- worldbank[worldbank$year == i, "CO2"] } Calculate the sum of per capita emissions by year globally apply(co2, 2, sum, na.rm = TRUE) Calculate average of yearly emissions by country for the period apply(co2, 1, mean, na.rm = TRUE) 7
8 Heterogenous Data Structures: Options for lists In a simple case, *apply() functions work on each element of a list Assumes that each list element works as input to the function Output does not have to have the same dimension for each application of the function Two options List in and list out lapply(x, FUN,...) List in, simplified output (vector, matrix, or array) sapply(x, FUN,...) 8
9 Options for Data Frames Recall that a data frame is a hybrid between a matrix and list Can behave like a matrix If all the variables in the data frame are of the same class, use apply() by row or column If all the variables in the data frame are not of the same class, subset appropriate variables first ll <- data.frame(row.num = paste0("row", 1:100), a = rnorm(100), b = runif(100)) apply(ll[, -1], 1, mean) Can behave like a list: lapply() or sapply() by variable 9
10 Check In 2 Summarize the worldbank data set by variable using lapply() lapply(worldbank, summary) Identify the numeric variables in the worldbank data set (omitting the Year variable) and summarize them using sapply() idx <- unlist(lapply(worldbank, is.numeric)) idx <- which(idx)[-1] sapply(worldbank[, idx], summary) 10
11 More Options for Data Frames A data frame can also behave like a ragged array Use a discrete (factor) variable to index groups Function is applied over the rows defined by each group Groups can be of different sizes, hence ragged In the most general case, treat the data frame as a list and use tapply(x, INDEX, FUN,...) Works like apply(), but INDEX is a vector with the same length as X, not a margin Difference is that input to the user-specified function is the set of list elements defined by the INDEX vector Special method for data frames: aggregate(formula, data, FUN,...) Takes a formula and data argument Formula has format y ~ x y is the variable to be aggregated x are the factors by which to stratify or group the y for the aggregation function 11
12 Check In 3 Using aggregate(), calculate the sum of CO2 emissions by year from the worldbank data aggregate(co2 ~ Year, data = worldbank, sum) Calculate the average emissions level by country over the period aggregate(co2 ~ Country.Name, data = worldbank, mean) Calculate the mean emissions level by year, for Countries with life expectancy greater than 60 years Countries with life expectancy less than or equal to 60 years aggregate(co2 ~ Year + I(life.expectancy > 60), data = worldbank, mean) 12
13 Assignment Review solution to Assignment 3 Reading for this week: Chapter 6 from the course text, Paul Teetor s R Cookbook Complete Assignment 4 13
Intermediate Programming in R Session 2: Loops. Olivia Lau, PhD
Intermediate Programming in R Session 2: Loops Olivia Lau, PhD Outline When to Use Loops Measuring and Monitoring R s Performance Different Types of Loops Fast Loops 2 When to Use Loops Loops repeat a
More informationIntroduction to the R Language
Introduction to the R Language Loop Functions Biostatistics 140.776 1 / 32 Looping on the Command Line Writing for, while loops is useful when programming but not particularly easy when working interactively
More informationIntermediate Programming in R Session 1: Data. Olivia Lau, PhD
Intermediate Programming in R Session 1: Data Olivia Lau, PhD Outline About Me About You Course Overview and Logistics R Data Types R Data Structures Importing Data Recoding Data 2 About Me Using and programming
More informationthe R environment The R language is an integrated suite of software facilities for:
the R environment The R language is an integrated suite of software facilities for: Data Handling and storage Matrix Math: Manipulating matrices, vectors, and arrays Statistics: A large, integrated set
More informationIntroduction to R. Nishant Gopalakrishnan, Martin Morgan January, Fred Hutchinson Cancer Research Center
Introduction to R Nishant Gopalakrishnan, Martin Morgan Fred Hutchinson Cancer Research Center 19-21 January, 2011 Getting Started Atomic Data structures Creating vectors Subsetting vectors Factors Matrices
More informationStat 579: List Objects
Stat 579: List Objects Ranjan Maitra 2220 Snedecor Hall Department of Statistics Iowa State University. Phone: 515-294-7757 maitra@iastate.edu, 1/10 Example: Eigenvalues of a matrix mm
More informationPackage future.apply
Version 1.0.0 Package future.apply June 20, 2018 Title Apply Function to Elements in Parallel using Futures Depends R (>= 3.2.0), future (>= 1.8.1) Imports globals (>= 0.12.0) Suggests datasets, stats,
More informationEcffient calculations
Ecffient calculations Vectorized computations The efficiency of calculations depends on how you perform them. Vectorized calculations, for example, avoid going trough individual vector or matrix elements
More informationApply. A. Michelle Lawing Ecosystem Science and Management Texas A&M University College Sta,on, TX
Apply A. Michelle Lawing Ecosystem Science and Management Texas A&M University College Sta,on, TX 77843 alawing@tamu.edu Schedule for today My presenta,on Review New stuff Mixed, Fixed, and Random Models
More informationEpidemiologic Analysis Using R
Epidemiologic Analysis Using R functions and indexing Charles DiMaggio and Steve Mooney Epidemiologic Analysis Using R Summer 2015 Outline 1 functions for epidemiologists marginals - apply() stratified
More informationR Programming: Worksheet 3
R Programming: Worksheet 3 By the end of the practical you should feel confident writing and calling functions, and using if(), for() and while() constructions. 1. Review (a) Write a function which takes
More informationLecture 14: The Split-Apply-Combine Paradigm Statistical Computing, Monday November 9, 2015
Lecture 14: The Split-Apply-Combine Paradigm Statistical Computing, 36-350 Monday November 9, 2015 Outline A quick reminder of what R can do How to make life easier with repeated tasks on large data sets
More informationSTAT 540: R: Sections Arithmetic in R. Will perform these on vectors, matrices, arrays as well as on ordinary numbers
Arithmetic in R R can be viewed as a very fancy calculator Can perform the ordinary mathematical operations: + - * / ˆ Will perform these on vectors, matrices, arrays as well as on ordinary numbers With
More informationan introduction to R for epidemiologists
an introduction to R for epidemiologists basic analyses and indexing Charles DiMaggio, PhD, MPH, PA-C New York University Department of Surgery and Population Health NYU-Bellevue Division of Trauma and
More informationPackage slam. February 15, 2013
Package slam February 15, 2013 Version 0.1-28 Title Sparse Lightweight Arrays and Matrices Data structures and algorithms for sparse arrays and matrices, based on inde arrays and simple triplet representations,
More informationSimple Parallel Statistical Computing in R
Simple Parallel Statistical Computing in R Luke Tierney Department of Statistics & Actuarial Science University of Iowa December 7, 2007 Luke Tierney (U. of Iowa) Simple Parallel Statistical Computing
More informationII.Matrix. Creates matrix, takes a vector argument and turns it into a matrix matrix(data, nrow, ncol, byrow = F)
II.Matrix A matrix is a two dimensional array, it consists of elements of the same type and displayed in rectangular form. The first index denotes the row; the second index denotes the column of the specified
More informationR:If, else and loops
R:If, else and loops Presenter: Georgiana Onicescu January 19, 2012 Presenter: Georgiana Onicescu R:ifelse,where,looping 1/ 17 Contents Vectors Matrices If else statements For loops Leaving the loop: stop,
More informationComputer vision: models, learning and inference. Chapter 10 Graphical Models
Computer vision: models, learning and inference Chapter 10 Graphical Models Independence Two variables x 1 and x 2 are independent if their joint probability distribution factorizes as Pr(x 1, x 2 )=Pr(x
More information#a- a vector of 100 random number from a normal distribution a<-rnorm(100, mean= 32, sd=6)
1 Transition to R Class 3: Basic functions for descriptive statistics and summarizing data Use simple functions and Xapply functions for summarizing and describing data Goals: (1) Summarizing continuous
More informationBasic Statistical Methods
Basic Statistical Methods Lecture 9 Nicholas Christian BIOST 2094 Spring 2011 Outline 1. Summary Statistics 2. Comparing Means 3. Comparing Variances 4. Comparing Proportions 5. Testing Normality 6. Testing
More informationWEEK 8: FUNCTIONS AND LOOPS. 1. Functions
WEEK 8: FUNCTIONS AND LOOPS THOMAS ELLIOTT 1. Functions Functions allow you to define a set of instructions and then call the code in a single line. In R, functions are defined much like any other object,
More informationR and parallel libraries. Introduction to R for data analytics Bologna, 26/06/2017
R and parallel libraries Introduction to R for data analytics Bologna, 26/06/2017 Outline Overview What is R R Console Input and Evaluation Data types R Objects and Attributes Vectors and Lists Matrices
More informationEffective R Programming
Effective R Programming Jacob Colvin February 21, 2009 Jacob Colvin () Effective R Programming February 21, 2009 1 / 21 1 Introduction Motivation 2 R Concepts Language Details 3 Debuging 4 Profiling Tidying
More informationECE521: Week 11, Lecture March 2017: HMM learning/inference. With thanks to Russ Salakhutdinov
ECE521: Week 11, Lecture 20 27 March 2017: HMM learning/inference With thanks to Russ Salakhutdinov Examples of other perspectives Murphy 17.4 End of Russell & Norvig 15.2 (Artificial Intelligence: A Modern
More informationPackage slam. December 1, 2016
Version 0.1-40 Title Sparse Lightweight Arrays and Matrices Package slam December 1, 2016 Data structures and algorithms for sparse arrays and matrices, based on inde arrays and simple triplet representations,
More informationPackage narray. January 28, 2018
Package narray January 28, 2018 Title Subset- And Name-Aware Array Utility Functions Version 0.4.0 Author Michael Schubert Maintainer Michael Schubert Stacking
More informationAn array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type.
Data Structures Introduction An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Representation of a large number of homogeneous
More informationProgramming with R. Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman
Programming with R Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman 1 Data Structures ˆ R has a rich set of self-describing data structures. > class(z) [1] "character" > class(x) [1] "data.frame"
More informationDescription/History Objects/Language Description Commonly Used Basic Functions. More Specific Functionality Further Resources
R Outline Description/History Objects/Language Description Commonly Used Basic Functions Basic Stats and distributions I/O Plotting Programming More Specific Functionality Further Resources www.r-project.org
More informationSection 13: data.table
Section 13: data.table Ed Rubin Contents 1 Admin 1 1.1 Announcements.......................................... 1 1.2 Last section............................................ 1 1.3 This week.............................................
More informationAN INTRODUCTION TO R
AN INTRODUCTION TO R DEEPAYAN SARKAR Language Overview II In this tutorial session, we will learn more details about the R language. Objects. Objects in R are anything that can be assigned to a variable.
More informationSTAT 540 Computing in Statistics
STAT 540 Computing in Statistics Introduces programming skills in two important statistical computer languages/packages. 30-40% R and 60-70% SAS Examples of Programming Skills: 1. Importing Data from External
More informationUsing The foreach Package
Steve Weston doc@revolutionanalytics.com December 9, 2017 1 Introduction One of R s most useful features is its interactive interpreter. This makes it very easy to learn and experiment with R. It allows
More informationCS4620/5620. Professor: Kavita Bala. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)
CS4620/5620 Affine and 3D Transformations Professor: Kavita Bala 1 Announcements Updated schedule on course web page 2 Prelim days finalized and posted Oct 11, Nov 29 No final exam, final project will
More informationPackage xwf. July 12, 2018
Package xwf July 12, 2018 Version 0.2-2 Date 2018-07-12 Title Extrema-Weighted Feature Extraction Author Willem van den Boom [aut, cre] Maintainer Willem van den Boom Extrema-weighted
More informationIntroduction to R for Beginners, Level II. Jeon Lee Bio-Informatics Core Facility (BICF), UTSW
Introduction to R for Beginners, Level II Jeon Lee Bio-Informatics Core Facility (BICF), UTSW Basics of R Powerful programming language and environment for statistical computing Useful for very basic analysis
More informationIntroduction to R, Github and Gitlab
Introduction to R, Github and Gitlab 27/11/2018 Pierpaolo Maisano Delser mail: maisanop@tcd.ie ; pm604@cam.ac.uk Outline: Why R? What can R do? Basic commands and operations Data analysis in R Github and
More informationChapter 7 Functions. Now consider a more advanced example:
Chapter 7 Functions 7.1 Chapter Overview Functions are logical groupings of code, a series of steps, that are given a name. Functions are especially useful when these series of steps will need to be done
More informationMicrosoft Office Excel Create a worksheet group. A worksheet group. Tutorial 6 Working With Multiple Worksheets and Workbooks
Microsoft Office Excel 2003 Tutorial 6 Working With Multiple Worksheets and Workbooks 1 Create a worksheet group A workbook is a collection of worksheets. You may want to work with the worksheets within
More informationAn Automated Testing Environment to support Operational Profiles of Software Intensive Systems
An Automated Testing Environment to support Operational Profiles of Software Intensive Systems Abstract: Robert S. Oshana Raytheon Systems Company oshana@raytheon.com (972)344-783 Raytheon Systems Company
More informationEPIB Four Lecture Overview of R
EPIB-613 - Four Lecture Overview of R R is a package with enormous capacity for complex statistical analysis. We will see only a small proportion of what it can do. The R component of EPIB-613 is divided
More informationHow to declare an array in C?
Introduction An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Representation of a large number of homogeneous values.
More informationPackage PottsUtils. R topics documented: February 19, 2015
Package PottsUtils February 19, 2015 Title Utility Functions of the Potts Models Version 0.3-2 Author Dai Feng [aut, cre], Luke Tierney [ctb] A package including several functions related to the Potts
More informationWeek 4. Big Data Analytics - data.frame manipulation with dplyr
Week 4. Big Data Analytics - data.frame manipulation with dplyr Hyeonsu B. Kang hyk149@eng.ucsd.edu April 2016 1 Dplyr In the last lecture we have seen how to index an individual cell in a data frame,
More informationIntroduction to R. Course in Practical Analysis of Microarray Data Computational Exercises
Introduction to R Course in Practical Analysis of Microarray Data Computational Exercises 2010 March 22-26, Technischen Universität München Amin Moghaddasi, Kurt Fellenberg 1. Installing R. Check whether
More informationPackage iotools. R topics documented: January 25, Version Title I/O Tools for Streaming
Version 0.2-5 Title I/O Tools for Streaming Package iotools January 25, 2018 Author Simon Urbanek , Taylor Arnold Maintainer Simon Urbanek
More informationThe boa Package. May 3, 2005
The boa Package May 3, 2005 Version 1.1.5-2 Date 2005-05-02 Title Bayesian Output Analysis Program (BOA) for MCMC Author Maintainer Depends R (>= 1.7) A menu-driven program and
More informationRelational Database Management Systems for Epidemiologists: SQL Part II
Relational Database Management Systems for Epidemiologists: SQL Part II Outline Summarizing and Grouping Data Retrieving Data from Multiple Tables using JOINS Summary of Aggregate Functions Function MIN
More informationGetting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018
Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018 Contents Overview 2 Generating random numbers 2 rnorm() to generate random numbers from
More informationSimulating from the Polya posterior by Glen Meeden, March 06
1 Introduction Simulating from the Polya posterior by Glen Meeden, glen@stat.umn.edu March 06 The Polya posterior is an objective Bayesian approach to finite population sampling. In its simplest form it
More informationLogical operators: R provides an extensive list of logical operators. These include
meat.r: Explanation of code Goals of code: Analyzing a subset of data Creating data frames with specified X values Calculating confidence and prediction intervals Lists and matrices Only printing a few
More informationWhenever R encounters a syntactically correct statement it executes it and a value is returned
Lecture 5: Flow control STAT598z: Intro. to computing for statistics Vinayak Rao Department of Statistics, Purdue University options(repr.plot.width=3, repr.plot.height=3) Statements in R separated by
More informationIntroduction to R gherardo varando
Introduction to R gherardo varando The R Software Environment As The R Project website states : and R is a free software environment for statistical computing and graphics. It compiles and runs on a wide
More informationIntro to R. Some history. Some history
Intro to R Héctor Corrada Bravo CMSC858B Spring 2012 University of Maryland Computer Science http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html?_r=2&pagewanted=1 http://www.forbes.com/forbes/2010/0524/opinions-software-norman-nie-spss-ideas-opinions.html
More informationParallel Computing with R and How to Use it on High Performance Computing Cluster
UNIVERSITY OF TEXAS AT SAN ANTONIO Parallel Computing with R and How to Use it on High Performance Computing Cluster Liang Jing Nov. 2010 1 1 ABSTRACT Methodological advances have led to much more computationally
More informationCSE 417 Dynamic Programming (pt 4) Sub-problems on Trees
CSE 417 Dynamic Programming (pt 4) Sub-problems on Trees Reminders > HW4 is due today > HW5 will be posted shortly Dynamic Programming Review > Apply the steps... 1. Describe solution in terms of solution
More informationProgramming with R. Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman
Programming with R Educational Materials 2006 S. Falcon, R. Ihaka, and R. Gentleman 1 Data Structures ˆ R has a rich set of self-describing data structures. > class(z) [1] "character" > class(x) [1] "data.frame"
More informationFirst steps in Parallel Computing
MilanoR 4th meeting October 24, 2013 First steps in Parallel Computing Anna Longari anna.longari@quantide.com Outline Parallel Computing Implicit Parallelism Explicit Parallelism Example on Amazon Servers
More informationR is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website:
Introduction to R R R is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website: http://www.r-project.org/ Code Editor: http://rstudio.org/
More informationCOMP Page Rank
COMP 4601 Page Rank 1 Motivation Remember, we were interested in giving back the most relevant documents to a user. Importance is measured by reference as well as content. Think of this like academic paper
More informationArrays: Higher Dimensional Arrays. CS0007: Introduction to Computer Programming
Arrays: Higher Dimensional Arrays CS0007: Introduction to Computer Programming Review If the == operator has two array variable operands, what is being compared? The reference variables held in the variables.
More informationPackage MultiVarMI. April 9, 2018
Type Package Title Multiple Imputation for Multivariate Data Version 1.0 Date 2018-04-08 Author Rawan Allozi, Hakan Demirtas Maintainer Rawan Allozi Package MultiVarMI April 9, 2018 Fully
More informationThe scope Package. April 19, 2006
The Package April 19, 2006 Type Package Title Data Manipulation Using Arbitrary Row and Column Criteria Version 1.0-2 Date 2006-04-17 Author Tim Bergsma Maintainer Tim Bergsma Calculate,
More informationStat405. Tables. Hadley Wickham. Tuesday, October 23, 12
Stat405 Tables Hadley Wickham Today we will use the reshape2 and xtable packages, and the movies.csv.bz2 dataset. install.packages(c("reshape2", "xtable")) 2.0 1.5 height 1.0 subject John Smith Mary Smith
More informationITS Introduction to R course
ITS Introduction to R course Nov. 29, 2018 Using this document Code blocks and R code have a grey background (note, code nested in the text is not highlighted in the pdf version of this document but is
More informationECE521 Lecture 21 HMM cont. Message Passing Algorithms
ECE521 Lecture 21 HMM cont Message Passing Algorithms Outline Hidden Markov models Numerical example of figuring out marginal of the observed sequence Numerical example of figuring out the most probable
More informationMANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 6 Professional Program: Data Administration and Management MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) AGENDA
More informationTutorial using BEAST v2.4.1 Troubleshooting David A. Rasmussen
Tutorial using BEAST v2.4.1 Troubleshooting David A. Rasmussen 1 Background The primary goal of most phylogenetic analyses in BEAST is to infer the posterior distribution of trees and associated model
More information2SAT Andreas Klappenecker
2SAT Andreas Klappenecker The Problem Can we make the following boolean formula true? ( x y) ( y z) (z y)! Terminology A boolean variable is a variable that can be assigned the values true (T) or false
More informationDemography 213 Branching and looping: Programming in R
Demography 213 Branching and looping: Programming in R Carl Mason carlm@demog.berkeley.edu September 11, 2016 Abstract This week we will learn how to program. Computer programming is a moderately complicated
More informationPackage biganalytics
Version 1.1.14 Date 2016-02-17 Package biganalytics February 18, 2016 Title Utilities for 'big.matrix' Objects from Package 'bigmemory' Author John W. Emerson and Michael J. Kane
More informationTexture Mapping. Texture (images) lecture 16. Texture mapping Aliasing (and anti-aliasing) Adding texture improves realism.
lecture 16 Texture mapping Aliasing (and anti-aliasing) Texture (images) Texture Mapping Q: Why do we need texture mapping? A: Because objects look fake and boring without it. Adding texture improves realism.
More informationlecture 16 Texture mapping Aliasing (and anti-aliasing)
lecture 16 Texture mapping Aliasing (and anti-aliasing) Texture (images) Texture Mapping Q: Why do we need texture mapping? A: Because objects look fake and boring without it. Adding texture improves realism.
More informationThe SQLiteDF Package
The SQLiteDF Package August 25, 2006 Type Package Title Stores data frames & matrices in SQLite tables Version 0.1.18 Date 2006-08-18 Author Maintainer Transparently stores data frames
More informationPackage batchmeans. R topics documented: July 4, Version Date
Package batchmeans July 4, 2016 Version 1.0-3 Date 2016-07-03 Title Consistent Batch Means Estimation of Monte Carlo Standard Errors Author Murali Haran and John Hughes
More informationPackage sgmcmc. September 26, Type Package
Type Package Package sgmcmc September 26, 2017 Title Stochastic Gradient Markov Chain Monte Carlo Version 0.2.0 Provides functions that performs popular stochastic gradient Markov chain Monte Carlo (SGMCMC)
More informationData mining: concepts and algorithms
Data mining: concepts and algorithms Practice Data mining Objective Exploit data mining algorithms to analyze a real dataset using the RapidMiner machine learning tool. The practice session is organized
More informationMinitab 17 commands Prepared by Jeffrey S. Simonoff
Minitab 17 commands Prepared by Jeffrey S. Simonoff Data entry and manipulation To enter data by hand, click on the Worksheet window, and enter the values in as you would in any spreadsheet. To then save
More informationlimma: A brief introduction to R
limma: A brief introduction to R Natalie P. Thorne September 5, 2006 R basics i R is a command line driven environment. This means you have to type in commands (line-by-line) for it to compute or calculate
More informationIntroduction to R. Educational Materials 2007 S. Falcon, R. Ihaka, and R. Gentleman
Introduction to R Educational Materials 2007 S. Falcon, R. Ihaka, and R. Gentleman 1 Data Structures ˆ R has a rich set of self-describing data structures. > class(z) [1] "character" > class(x) [1] "data.frame"
More informationE-Companion: On Styles in Product Design: An Analysis of US. Design Patents
E-Companion: On Styles in Product Design: An Analysis of US Design Patents 1 PART A: FORMALIZING THE DEFINITION OF STYLES A.1 Styles as categories of designs of similar form Our task involves categorizing
More informationCS281 Section 9: Graph Models and Practical MCMC
CS281 Section 9: Graph Models and Practical MCMC Scott Linderman November 11, 213 Now that we have a few MCMC inference algorithms in our toolbox, let s try them out on some random graph models. Graphs
More informationFunctional Programming. Biostatistics
Functional Programming Biostatistics 140.776 What is Functional Programming? Functional programming concentrates on four constructs: 1. Data (numbers, strings, etc) 2. Variables (function arguments) 3.
More informationTwo Dimensional Arrays
+ Two Dimensional Arrays + Two Dimensional Arrays So far we have studied how to store linear collections of data using a single dimensional array. However, the data associated with certain systems (a digital
More informationLab: Using R and Bioconductor
Lab: Using R and Bioconductor Robert Gentleman Florian Hahne Paul Murrell June 19, 2006 Introduction In this lab we will cover some basic uses of R and also begin working with some of the Bioconductor
More informationPackage glinternet. June 15, 2018
Type Package Package glinternet June 15, 2018 Title Learning Interactions via Hierarchical Group-Lasso Regularization Version 1.0.8 Date 2018-06-20 Author Michael Lim, Trevor Hastie Maintainer Michael
More informationMachine Learning. Sourangshu Bhattacharya
Machine Learning Sourangshu Bhattacharya Bayesian Networks Directed Acyclic Graph (DAG) Bayesian Networks General Factorization Curve Fitting Re-visited Maximum Likelihood Determine by minimizing sum-of-squares
More information## script to randomly sample and calculate haplotype diversity for 2 groups
## script to randomly sample and calculate haplotype diversity for 2 groups ## Input = a fasta file with mtdna sequences. source("h_sampler.r") fas = read.table("inputfile.fas", header=false) ## read in
More informationDSCI 325: Handout 24 Introduction to Writing Functions in R Spring 2017
DSCI 325: Handout 24 Introduction to Writing Functions in R Spring 2017 We have already used several existing R functions in previous handouts. For example, consider the Grades dataset. Once the data frame
More informationHidden Markov Models in the context of genetic analysis
Hidden Markov Models in the context of genetic analysis Vincent Plagnol UCL Genetics Institute November 22, 2012 Outline 1 Introduction 2 Two basic problems Forward/backward Baum-Welch algorithm Viterbi
More informationAutomatic Differentiation for R
Automatic Differentiation for R Radford M. Neal, University of Toronto Dept. of Statistical Sciences and Dept. of Computer Science Vector Institute Affiliate http://www.cs.utoronto.ca/ radford http://radfordneal.wordpress.com
More informationControl Flow Structures
Control Flow Structures STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat/stat133 Course web: gastonsanchez.com/stat133 Expressions 2 Expressions R code
More informationIntroduction to R Benedikt Brors Dept. Intelligent Bioinformatics Systems German Cancer Research Center
Introduction to R Benedikt Brors Dept. Intelligent Bioinformatics Systems German Cancer Research Center What is R? R is a statistical computing environment with graphics capabilites It is fully scriptable
More informationCS242: Probabilistic Graphical Models Lecture 3: Factor Graphs & Variable Elimination
CS242: Probabilistic Graphical Models Lecture 3: Factor Graphs & Variable Elimination Instructor: Erik Sudderth Brown University Computer Science September 11, 2014 Some figures and materials courtesy
More informationIntroduction to the doredis Package
Introduction to the doredis Package Bryan W. Lewis blewis@illposed.net February 24, 2011 1 Introduction The doredis package provides a parallel back end for foreach using Redis and the corresponding rredis
More informationText Mining with R: Building a Text Classifier
Martin Schweinberger July 28, 2016 This post 1 will exemplify how to create a text classifier with R, i.e. it will implement a machine-learning algorithm, which classifies texts as being either a speech
More informationComputer Vision Group Prof. Daniel Cremers. 4. Probabilistic Graphical Models Directed Models
Prof. Daniel Cremers 4. Probabilistic Graphical Models Directed Models The Bayes Filter (Rep.) (Bayes) (Markov) (Tot. prob.) (Markov) (Markov) 2 Graphical Representation (Rep.) We can describe the overall
More informationStat 579: Objects in R Vectors
Stat 579: Objects in R Vectors Ranjan Maitra 2220 Snedecor Hall Department of Statistics Iowa State University. Phone: 515-294-7757 maitra@iastate.edu, 1/23 Logical Vectors I R allows manipulation of logical
More information15 150: Principles of Functional Programming Some Notes on Regular Expression Matching
15 150: Principles of Functional Programming Some Notes on Regular Expression Matching Michael Erdmann Spring 2018 1 Introduction Regular expression matching is a very useful technique for describing commonly-occurring
More information