Introduction to R. Stat Statistical Computing - Summer Dr. Junvie Pailden. July 5, Southern Illinois University Edwardsville
|
|
- Maryann Watts
- 5 years ago
- Views:
Transcription
1 Introduction to R Stat Statistical Computing - Summer 2016 Dr. Junvie Pailden Southern Illinois University Edwardsville July 5, 2016
2 Why R R offers a powerful and appealing interactive environment for exploring data, running simulations, etc. R is platform independent meaning it is available on Windows, Mac, and Linux. R has the best help resources both online (just google any issue/question) and using help(...), e.g. help(lm). R is not a black box software, i.e., you can trace how a function or package works by following the R script, e.g. lm() Many more!!!
3 Install R and RStudio on Windows 1 Download R from (click on "Download R for Windows" > "base" > "Download R 3.x.x for Windows") 2 Install R. Leave all default settings in the installation options. 3 Download RStudio from and install it. Leave all default settings in the installation options. 4 Open RStudio.
4 Commands on R Console > # create an integer sequence > 3:7 [1] > # create an sequence from 0 to 3 with 0.5 increment > seq(0,3,by=0.5) [1] > # create a repeated sequence > rep(pi,4) [1] > # Basic Operations > (2-3)*(3/4) [1] -0.75
5 Concatenate operator Concatenate operator > c(6,20,-3) # numbers [1] > c("words","are","wind") # strings [1] "words" "are" "wind" > # Operations > c(1,2,3,4) + 1 [1] > 1/ c(1,2,3,4) [1] > c(1,2,3,4)^2 [1]
6 Variable assignment > x <- 3 > # is the same as > 3 -> x > # and x = 3 Be careful with = because it does not mean equals. For that, you need == operator > one <- 1 ; two <- 2 > one = two # Assign the value of "two" to "one" > one [1] 2 > two [1] 2 Let s start again > one <- 1 ; two <- 2 > one == two [1] FALSE
7 Commonly Used Operators Scalar addition and multiplication > a <- sqrt(2); b <- 1:3; c <- 2:4 > a + b [1] > a * b [1] Entrywise multiplication > b * c [1] x modulus y > 17 %% 5 [1] 2 Integer Division > 17 %/% 5 [1] 3
8 Some built-in functions in R General Form f(argument1, argument2,...) > b <- c(1,2,3) > sum(b) [1] 6 > exp(1) [1] > cos( ) [1] -1 > log(x=64,base=4) [1] 3
9 Simple Summaries > height <- 58:72 > weight <- c(115,117,120,123,126,129,132,135,139, + 142,146,150,154,159,164) > hbar <- mean(height) # mean of height > hbar [1] 65 > hvar <- var(height) # variance of height > hvar [1] 20 > n <- length(height) > sum(height)/n [1] 65 > sum((height-hbar)^2)/(n-1) [1] 20
10 Correlation: Your turn Find the correlation of height and weight? > # size > n <- length(height) > # mean > hbar <- mean(height) > wbar <- mean(weight) > # standard deviation > sdh <- sd(height) > sdw <- sd(weight) > # correlation coefficient > r <- sum((height-hbar)*(weight-wbar))/(sdh*sdw*(n-1)) > r [1]
11 Writing Functions in R General Form function(arglist) expr return(value) > my_fun <- function(x,y){ + x + y + } > my_fun(1,2) [1] 3 Body of the function does not need to be in separate lines. If the body of the function is only one line, then braces aren t necessary. > my_fun2 <- function(x,y) x + y > my_fun2(1,2) [1] 3
12 More on functions in R I can set default values, say y=5 > my_fun2 <- function(x,y=5) x + y > my_fun2(1) [1] 6 The sapply() function accepts a list and a function, then applies the function to every element of that list and returns the result. Because functions are also objects, I can pass a function into another function as the argument. > l <- 1:5 > sapply(l, my_fun2) [1]
13 Special Values There are a few special values that are used in R The NA values are used to represent missing values. You may encounter NA values in text loaded in R or in data loaded from databases (to replace Null values). > v <- c(1,2,3) > length(v) <- 4 > v [1] NA If a computation results in a number that is too big, R will return Inf for a positive and -Inf for a negative. > 2^1024 [1] Inf > -2^1024 [1] -Inf > 1/0 [1] Inf > Inf-Inf # will return `NaN`
14 Lists A list, in R use list(), is an ordered collection of objects of possibly different types. Lists are frequently used to return several results of a function in a single object. > arya <- list(name='arya of Winterfell',age=11,northman=TRUE) > arya $name [1] "Arya of Winterfell" $age [1] 11 $northman [1] TRUE You can see that the name of each item is preceded by a $. You can then reference each item in the list by its position or its name.
15 Matrices A matrix is a two-dimensional array. Matrices (same as vectors) can hold elements only of the same type. > # 2 by 4 matrix > m <- matrix(1:8,nrow=2,ncol=4) > m [,1] [,2] [,3] [,4] [1,] [2,] By default, the matrix is populated by column. To populate the matrix by row, add byrow=true in the argument. To access the matrix, use square brackets. > m[2,1] # entry on 2nd row, 1s column [1] 2 > m[2:3] # 2rd to 3th entry columnwise [1] 2 3
16 Matrices (con t) You can also give names to each row and each column using dimnames(). > dimnames(m) <- list(c('a','b'),c('p','q','r','s')) > m p q r s a b Combine objects by rows rbind() or columns cbind() > S <- rbind(rep(false,5),rep(na,5)) > rownames(s) <- c('all False','All NA') > S [,1] [,2] [,3] [,4] [,5] All False FALSE FALSE FALSE FALSE FALSE All NA NA NA NA NA NA
17 Arrays An array is an extention of the vector to more than two dimensions. > # 2 by 3 by 2 array > A <- array(1:12,c(2,3,2)) > A,, 1 [,1] [,2] [,3] [1,] [2,] 2 4 6,, 2 [,1] [,2] [,3] [1,] [2,]
18 Arrays (Con t) Interchange the first two subscripts on a 3-way array A > At <- aperm(a, c(2,1,3)) > At,, 1 [,1] [,2] [1,] 1 2 [2,] 3 4 [3,] 5 6,, 2 [,1] [,2] [1,] 7 8 [2,] 9 10 [3,] 11 12
19 Factors in R Values can be nominal, ordinal, or continuous. In R, nominal and ordinal values are represented by factor(). > trident <- c('a','a','b','b','b','c') > factor(trident) [1] a a b b b c Levels: a b c By default, factor levels are created in alphabetical order. > saltpans <- c('c','b','a') > factor(trident,order=true,levels=saltpans) [1] a a b b b c Levels: c < b < a
20 Functions as Arguments Many of R functions require functions as arguments (e.g. integrate). Suppose we need to compute the beta function 1 B(a,b) = x a 1 (1 x) b 1 dx, a > 0,b > 0. 0 First we write a function that returns the integrand evaluated at a point x. The additional arguments a and b specify the exponents. > f <- function(x, a=1, b=1){ + x^(a-1)*(1-x)^(b-1) + } > x <- seq(0, 1,.2) # seq from 0 to 1 with steps of.2 > f(x, a=2, b=2) [1] > integrate(f, lower=0, upper=1, a=2, b=2) with absolute error < 1.9e-15
21 Apply function in R Applies a function to sections of an array (or matrix) and returns the results in an array (or matrix). apply(array, margin, function,...) The margin argument is used to specify which margin we want to apply the function to and which margin we wish to keep. > #row sums of matrix m from previous slide, margin is 1 > apply(m, 1, sum) a b > #column sums of m, margin is 2 > apply(m, 2, sum) p q r s
22 Data Frames A data frame is a list that contains multiple named vectors of the same length. Whereas we usually use spreadsheet or database table by row, data frames are constructed by columns. > # Recall correlation coeff from previous slide > data.frame(hbar,wbar,sdh,sdw,r) hbar wbar sdh sdw r > # can also be used in functions > myfun_df <- function(x) data.frame(mean = mean(x), + variance = var(x)) > myfun_df(1:20) mean variance
23 Conditionals if (arglist is satisfied) { \ \ do this one } else { \ \ do this two } Create a function that tells you whether a variable is greater than 20. > my_cond <- function(x){ if (x > 20) { + print("x is greater than 20") + } else { + print("x is less than 20") + } + } > x <- 10 > my_cond(x) [1] "x is less than 20"
24 Repeat Loops in R R has three forms of loops. The first is repeat w/c repeats a particular expression until it hits a break keyword. > x <- 0 > repeat{if (x>4) break + else {print(x); x <- x+1} } [1] 0 [1] 1 [1] 2 [1] 3 [1] 4 Within the outermost braces is an if-else expression: if (x>4) break else print(x); x <- x+1. The inner set of braces is part of the else clause: print(x); x <- x+1. The semicolon separates the clause into two parts. The first is print statement, and the second increments x so that the condition that termintes the loop, x>4, is eventually satisfied.
25 While and For Loops in R > x <- 0 > while (x < 5) {print (x); x <- x + 1} [1] 0 [1] 1 [1] 2 [1] 3 [1] 4 For loops iterate through each item in a vector or a list: > for (x in 0:4) print(x) [1] 0 [1] 1 [1] 2 [1] 3 [1] 4 The colon creates a vector, passing each integer from 0 to 4 to the loop.
26 Fibonacci Sequence Find the first 10 Finonacci numbers. > len <- 10 > fibvals <- numeric(len) # creates a vector of 0's > fibvals[1] <- 1 > fibvals[2] <- 1 > for (i in 3:len) { + fibvals[i] <- fibvals[i-1]+fibvals[i-2] + } > fibvals [1]
27 Your Turn - Seatwork time! 1 Create the vector (20,19,...,2,1) and call it myvec. 2 Create the identity matrix I 3 3 Create the matrix with rows (2,1,2) and (1,0, 1). Multiply the resulting matrix with I 3. 4 Write a function norm that will compute the Euclidean norm of a numeric vector x = (x 1,...,x n ) given by n x = xi 2. Try this function on the vectors (0,0,0,1) and (2,5,2,4) to check that your function result is correct. i=1
28 Package.R An R package is a set of related functions and help files, bundled together. It is similar to libraries in C or toolbox in Matlab. * Normally, all functions within a single package are related: for example, the stats package contains functions for statistical analysis. There are few public repositories of packages: the largest is CRAN hosted by the R foundation with more than 4000 packages, and is mirrored in many sites worldwide. Of course, you need internet connection to do this. To use a package, you first need to install it into R. If you re using the R console user interface, you can use the package installer from the menu. You can also install R packages directly through R console using install.packages(). To load up an R package, use the library().
Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #16 Loops: Matrix Using Nested for Loop In this section, we will use the, for loop to code of the matrix problem.
More informationIntroduction to Matlab. By: Dr. Maher O. EL-Ghossain
Introduction to Matlab By: Dr. Maher O. EL-Ghossain Outline: q What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control
More informationOUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.
1 LECTURE 3 OUTLINES Variable names in MATLAB Examples Matrices, Vectors and Scalar Scalar Vectors Entering a vector Colon operator ( : ) Mathematical operations on vectors examples 2 VARIABLE NAMES IN
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 informationConstraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial
1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the
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 informationJME Language Reference Manual
JME Language Reference Manual 1 Introduction JME (pronounced jay+me) is a lightweight language that allows programmers to easily perform statistic computations on tabular data as part of data analysis.
More informationA Brief Introduction to R
A Brief Introduction to R Babak Shahbaba Department of Statistics, University of California, Irvine, USA Chapter 1 Introduction to R 1.1 Installing R To install R, follow these steps: 1. Go to http://www.r-project.org/.
More informationGetting started with MATLAB
Sapienza University of Rome Department of economics and law Advanced Monetary Theory and Policy EPOS 2013/14 Getting started with MATLAB Giovanni Di Bartolomeo giovanni.dibartolomeo@uniroma1.it Outline
More informationMBV4410/9410 Fall Bioinformatics for Molecular Biology. Introduction to R
MBV4410/9410 Fall 2018 Bioinformatics for Molecular Biology Introduction to R Outline Introduce R Basic operations RStudio Bioconductor? Goal of the lecture Introduce you to R Show how to run R, basic
More informationENGG1811 Computing for Engineers Week 10 Matlab: Vectorization. (No loops, please!)
ENGG1811 Computing for Engineers Week 10 Matlab: Vectorization. (No loops, please!) ENGG1811 UNSW, CRICOS Provider No: 00098G1 W10 slide 1 Vectorisation Matlab is designed to work with vectors and matrices
More informationUnit 3 Decision making, Looping and Arrays
Unit 3 Decision making, Looping and Arrays Decision Making During programming, we have a number of situations where we may have to change the order of execution of statements based on certain conditions.
More informationIntroduction to MATLAB
Introduction to MATLAB Introduction MATLAB is an interactive package for numerical analysis, matrix computation, control system design, and linear system analysis and design available on most CAEN platforms
More informationAn introduction to R 1 / 29
An introduction to R 1 / 29 What is R? R is an integrated suite of software facilities for data manipulation, calculation and graphical display. Among other things it has: an effective data handling and
More informationStochastic Models. Introduction to R. Walt Pohl. February 28, Department of Business Administration
Stochastic Models Introduction to R Walt Pohl Universität Zürich Department of Business Administration February 28, 2013 What is R? R is a freely-available general-purpose statistical package, developed
More informationIntroduction to Matlab. By: Hossein Hamooni Fall 2014
Introduction to Matlab By: Hossein Hamooni Fall 2014 Why Matlab? Data analytics task Large data processing Multi-platform, Multi Format data importing Graphing Modeling Lots of built-in functions for rapid
More informationIntroduction to MATLAB. Simon O Keefe Non-Standard Computation Group
Introduction to MATLAB Simon O Keefe Non-Standard Computation Group sok@cs.york.ac.uk Content n An introduction to MATLAB n The MATLAB interfaces n Variables, vectors and matrices n Using operators n Using
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 informationIntroduction to Matlab
Introduction to Matlab Andreas C. Kapourani (Credit: Steve Renals & Iain Murray) 9 January 08 Introduction MATLAB is a programming language that grew out of the need to process matrices. It is used extensively
More informationBasic R Part 1 BTI Plant Bioinformatics Course
Basic R Part 1 BTI Plant Bioinformatics Course Spring 2013 Sol Genomics Network Boyce Thompson Institute for Plant Research by Jeremy D. Edwards What is R? Statistical programming language Derived from
More informationEE 301 Signals & Systems I MATLAB Tutorial with Questions
EE 301 Signals & Systems I MATLAB Tutorial with Questions Under the content of the course EE-301, this semester, some MATLAB questions will be assigned in addition to the usual theoretical questions. This
More informationAN INTRODUCTION TO MATLAB
AN INTRODUCTION TO MATLAB 1 Introduction MATLAB is a powerful mathematical tool used for a number of engineering applications such as communication engineering, digital signal processing, control engineering,
More information8.1 R Computational Toolbox Tutorial 3
8.1 R Computational Toolbox Tutorial 3 Introduction to Computational Science: Modeling and Simulation for the Sciences, 2 nd Edition Angela B. Shiflet and George W. Shiflet Wofford College 2014 by Princeton
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 informationSMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014
SMS 3515: Scientific Computing Lecture 1: Introduction to Matlab 2014 Instructor: Nurul Farahain Mohammad 1 It s all about MATLAB What is MATLAB? MATLAB is a mathematical and graphical software package
More informationThe Warhol Language Reference Manual
The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming
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 informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationIntroduction to MATLAB
Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse
More informationUniversity of Alberta
A Brief Introduction to MATLAB University of Alberta M.G. Lipsett 2008 MATLAB is an interactive program for numerical computation and data visualization, used extensively by engineers for analysis of systems.
More informationSTATISTICS 579 R Tutorial : Programming in R
Fall 2005 1. Conditional computation in R: STATISTICS 579 R Tutorial : Programming in R The basic control structure available in R for conditional computation is of the form if (cond) expr-1 else expr-2
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 informationDr Richard Greenaway
SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 3 Creating, Organising & Processing Data Dr Richard Greenaway 3 Creating, Organising & Processing Data In this Workshop the matrix type is introduced
More informationBusiness Statistics: R tutorials
Business Statistics: R tutorials Jingyu He September 29, 2017 Install R and RStudio R is a free software environment for statistical computing and graphics. Download free R and RStudio for Windows/Mac:
More informationPackage gpr. February 20, 2015
Package gpr February 20, 2015 Version 1.1 Date 2013-08-27 Title A Minimalistic package to apply Gaussian Process in R License GPL-3 Author Maintainer ORPHANED Depends R (>= 2.13) This package provides
More informationMATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED. Christian Daude 1
MATLAB COURSE FALL 2004 SESSION 1 GETTING STARTED Christian Daude 1 Introduction MATLAB is a software package designed to handle a broad range of mathematical needs one may encounter when doing scientific
More informationGRAD6/8104; INES 8090 Spatial Statistic Spring 2017
Lab #1 Basics in Spatial Statistics (Due Date: 01/30/2017) PURPOSES 1. Get familiar with statistics and GIS 2. Learn to use open-source software R for statistical analysis Before starting your lab, create
More informationMAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB
MATLAB sessions: Laboratory MAT 75 Laboratory Matrix Computations and Programming in MATLAB In this laboratory session we will learn how to. Create and manipulate matrices and vectors.. Write simple programs
More informationMATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA
MATLAB for beginners KiJung Yoon, 1 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA 1 MATLAB Tutorial I What is a matrix? 1) A way of representation for data (# of
More informationControl Structures. CIS 118 Intro to LINUX
Control Structures CIS 118 Intro to LINUX Basic Control Structures TEST The test utility, has many formats for evaluating expressions. For example, when given three arguments, will return the value true
More informationInlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS
Inlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS 1 6 3 Matlab 3.1 Fundamentals Matlab. The name Matlab stands for matrix laboratory. Main principle. Matlab works with rectangular
More informationProgramming & Data Structure Laboratory. Day 2, July 24, 2014
Programming & Data Structure Laboratory Day 2, July 24, 2014 Loops Pre and post test loops for while do-while switch-case Pre-test loop and post-test loop Condition checking True Loop Body False Loop Body
More informationChapter 2: Functions and Control Structures
Chapter 2: Functions and Control Structures TRUE/FALSE 1. A function definition contains the lines of code that make up a function. T PTS: 1 REF: 75 2. Functions are placed within parentheses that follow
More informationPart #1. A0B17MTB Matlab. Miloslav Čapek Filip Kozák, Viktor Adler, Pavel Valtr
A0B17MTB Matlab Part #1 Miloslav Čapek miloslav.capek@fel.cvut.cz Filip Kozák, Viktor Adler, Pavel Valtr Department of Electromagnetic Field B2-626, Prague You will learn Scalars, vectors, matrices (class
More informationStatistical Programming with R
Statistical Programming with R Lecture 6: Programming Examples Bisher M. Iqelan biqelan@iugaza.edu.ps Department of Mathematics, Faculty of Science, The Islamic University of Gaza 2017-2018, Semester 1
More informationPhysics 326G Winter Class 2. In this class you will learn how to define and work with arrays or vectors.
Physics 326G Winter 2008 Class 2 In this class you will learn how to define and work with arrays or vectors. Matlab is designed to work with arrays. An array is a list of numbers (or other things) arranged
More informationLecture 15 MATLAB II: Conditional Statements and Arrays
Lecture 15 MATLAB II: Conditional Statements and Arrays 1 Conditional Statements 2 The boolean operators in MATLAB are: > greater than < less than >= greater than or equals
More informationIntroduction to Matlab
Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing
More informationScilab Programming. The open source platform for numerical computation. Satish Annigeri Ph.D.
Scilab Programming The open source platform for numerical computation Satish Annigeri Ph.D. Professor, Civil Engineering Department B.V.B. College of Engineering & Technology Hubli 580 031 satish@bvb.edu
More informationMATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks
MATLAB Basics Stanley Liang, PhD York University Configure a MATLAB Package Get a MATLAB Student License on Matworks Visit MathWorks at https://www.mathworks.com/ It is recommended signing up with a student
More informationStatistical Programming with R
Statistical Programming with R Lecture 5: Simple Programming Bisher M. Iqelan biqelan@iugaza.edu.ps Department of Mathematics, Faculty of Science, The Islamic University of Gaza 2017-2018, Semester 1 Functions
More information1 Introduction to MATLAB
1 Introduction to MATLAB 1.1 General Information Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good
More informationHow to learn MATLAB? Some predefined variables
ECE-S352 Lab 1 MATLAB Tutorial How to learn MATLAB? 1. MATLAB comes with good tutorial and detailed documents. a) Select MATLAB help from the MATLAB Help menu to open the help window. Follow MATLAB s Getting
More informationMcTutorial: A MATLAB Tutorial
McGill University School of Computer Science Sable Research Group McTutorial: A MATLAB Tutorial Lei Lopez Last updated: August 2014 w w w. s a b l e. m c g i l l. c a Contents 1 MATLAB BASICS 3 1.1 MATLAB
More informationECE Lesson Plan - Class 1 Fall, 2001
ECE 201 - Lesson Plan - Class 1 Fall, 2001 Software Development Philosophy Matrix-based numeric computation - MATrix LABoratory High-level programming language - Programming data type specification not
More informationUNIT - I. Introduction to C Programming. BY A. Vijay Bharath
UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been
More informationMATLAB NOTES. Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional.
MATLAB NOTES Matlab designed for numerical computing. Strongly oriented towards use of arrays, one and two dimensional. Excellent graphics that are easy to use. Powerful interactive facilities; and programs
More informationR: BASICS. Andrea Passarella. (plus some additions by Salvatore Ruggieri)
R: BASICS Andrea Passarella (plus some additions by Salvatore Ruggieri) BASIC CONCEPTS R is an interpreted scripting language Types of interactions Console based Input commands into the console Examine
More information1 Introduction to MATLAB
1 Introduction to MATLAB 1.1 Quick Overview This chapter is not intended to be a comprehensive manual of MATLAB R. Our sole aim is to provide sufficient information to give you a good start. If you are
More informationThe Very Basics of the R Interpreter
Chapter 2 The Very Basics of the R Interpreter OK, the computer is fired up. We have R installed. It is time to get started. 1. Start R by double-clicking on the R desktop icon. 2. Alternatively, open
More informationa suite of operators for calculations on arrays, in particular
The R Environment (Adapted from the Venables and Smith R Manual on www.r-project.org and from Andreas Buja s web site for Applied Statistics at http://www-stat.wharton.upenn.edu/ buja/stat-541/notes-stat-541.r)
More informationAn Introduction to R 1.1 Getting started
An Introduction to R 1.1 Getting started Dan Navarro (daniel.navarro@adelaide.edu.au) School of Psychology, University of Adelaide ua.edu.au/ccs/people/dan DSTO R Workshop, 29-Apr-2015 There s a book http://ua.edu.au/ccs/teaching/lsr/
More information2.0 MATLAB Fundamentals
2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,
More informationIntroduction to MATLAB
Introduction to MATLAB Introduction: MATLAB is a powerful high level scripting language that is optimized for mathematical analysis, simulation, and visualization. You can interactively solve problems
More informationCrayon (.cry) Language Reference Manual. Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361)
Crayon (.cry) Language Reference Manual Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361) 1 Lexical Elements 1.1 Identifiers Identifiers are strings used
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 informationIntroduction to MATLAB for Engineers, Third Edition
PowerPoint to accompany Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 2 Numeric, Cell, and Structure Arrays Copyright 2010. The McGraw-Hill Companies, Inc. This work is
More informationENGR 1181 MATLAB 02: Array Creation
ENGR 1181 MATLAB 02: Array Creation Learning Objectives: Students will read Chapter 2.1 2.4 of the MATLAB book before coming to class. This preparation material is provided to supplement this reading.
More informationR Primer for Introduction to Mathematical Statistics 8th Edition Joseph W. McKean
R Primer for Introduction to Mathematical Statistics 8th Edition Joseph W. McKean Copyright 2017 by Joseph W. McKean at Western Michigan University. All rights reserved. Reproduction or translation of
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 informationMAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB
MATLAB sessions: Laboratory MAT 75 Laboratory Matrix Computations and Programming in MATLAB In this laboratory session we will learn how to. Create and manipulate matrices and vectors.. Write simple programs
More informationIntroduction to 3/15/2012. Poll Are You Sticking Around for Part 2? 1. Yes 2. No. Steve Berman, FCAS, MAAA Jim Guszcza, FCAS, MAAA
Introduction to CAS RPM Seminar March 19, 2012 Steve Berman, FCAS, MAAA Jim Guszcza, FCAS, MAAA Poll Are You Sticking Around for Part 2? 1. Yes 2. No 1 1 Poll How Much Do You Know About R? 1. Isn t that
More informationLecture 1: Getting Started and Data Basics
Lecture 1: Getting Started and Data Basics The first lecture is intended to provide you the basics for running R. Outline: 1. An Introductory R Session 2. R as a Calculator 3. Import, export and manipulate
More informationRepetition Structures Chapter 9
Sum of the terms Repetition Structures Chapter 9 1 Value of the Alternating Harmonic Series 0.9 0.8 0.7 0.6 0.5 10 0 10 1 10 2 10 3 Number of terms Objectives After studying this chapter you should be
More information7 Control Structures, Logical Statements
7 Control Structures, Logical Statements 7.1 Logical Statements 1. Logical (true or false) statements comparing scalars or matrices can be evaluated in MATLAB. Two matrices of the same size may be compared,
More informationLecture 2. Arrays. 1 Introduction
1 Introduction Lecture 2 Arrays As the name Matlab is a contraction of matrix laboratory, you would be correct in assuming that Scilab/Matlab have a particular emphasis on matrices, or more generally,
More informationECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu
ECON 502 INTRODUCTION TO MATLAB Nov 9, 2007 TA: Murat Koyuncu 0. What is MATLAB? 1 MATLAB stands for matrix laboratory and is one of the most popular software for numerical computation. MATLAB s basic
More informationComputer Programming ECIV 2303 Chapter 6 Programming in MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering
Computer Programming ECIV 2303 Chapter 6 Programming in MATLAB Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering 1 Introduction A computer program is a sequence of computer
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #43 Multidimensional Arrays In this video will look at multi-dimensional arrays. (Refer Slide Time: 00:03) In
More informationPART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More informationLecture 2: Variables, Vectors and Matrices in MATLAB
Lecture 2: Variables, Vectors and Matrices in MATLAB Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1 and Chapter 2. Variables
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 the R Language
Introduction to the R Language Data Types and Basic Operations Starting Up Windows: Double-click on R Mac OS X: Click on R Unix: Type R Objects R has five basic or atomic classes of objects: character
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 informationLaboratory 1 Introduction to MATLAB for Signals and Systems
Laboratory 1 Introduction to MATLAB for Signals and Systems INTRODUCTION to MATLAB MATLAB is a powerful computing environment for numeric computation and visualization. MATLAB is designed for ease of use
More informationIntroduction to MATLAB Programming
Introduction to MATLAB Programming Arun A. Balakrishnan Asst. Professor Dept. of AE&I, RSET Overview 1 Overview 2 Introduction 3 Getting Started 4 Basics of Programming Overview 1 Overview 2 Introduction
More informationMAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB
MAT 75 Laboratory Matrix Computations and Programming in MATLAB In this laboratory session we will learn how to. Create and manipulate matrices and vectors.. Write simple programs in MATLAB NOTE: For your
More informationLesson 9: Introduction To Arrays (Updated for Java 1.5 Modifications by Mr. Dave Clausen)
Lesson 9: Introduction To Arrays (Updated for Java 1.5 Modifications by Mr. Dave Clausen) 1 Lesson 9: Introduction Objectives: To Arrays Write programs that handle collections of similar items. Declare
More informationMATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras
MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras Module No. #01 Lecture No. #1.1 Introduction to MATLAB programming
More informationTeaching Manual Math 2131
Math 2131 Linear Algebra Labs with MATLAB Math 2131 Linear algebra with Matlab Teaching Manual Math 2131 Contents Week 1 3 1 MATLAB Course Introduction 5 1.1 The MATLAB user interface...........................
More informationOutline. User-based knn Algorithm Basics of Matlab Control Structures Scripts and Functions Help
Outline User-based knn Algorithm Basics of Matlab Control Structures Scripts and Functions Help User-based knn Algorithm Three main steps Weight all users with respect to similarity with the active user.
More informationCMAT Language - Language Reference Manual COMS 4115
CMAT Language - Language Reference Manual COMS 4115 Language Guru: Michael Berkowitz (meb2235) Project Manager: Frank Cabada (fc2452) System Architect: Marissa Ojeda (mgo2111) Tester: Daniel Rojas (dhr2119)
More informationENGR 1181 MATLAB 09: For Loops 2
ENGR 1181 MATLAB 09: For Loops Learning Objectives 1. Use more complex ways of setting the loop index. Construct nested loops in the following situations: a. For use with two dimensional arrays b. For
More informationPackage SSLASSO. August 28, 2018
Package SSLASSO August 28, 2018 Version 1.2-1 Date 2018-08-28 Title The Spike-and-Slab LASSO Author Veronika Rockova [aut,cre], Gemma Moran [aut] Maintainer Gemma Moran Description
More informationSome elements for Matlab programming
Some elements for Matlab programming Nathalie Thomas 2018 2019 Matlab, which stands for the abbreviation of MATrix LABoratory, is one of the most popular language for scientic computation. The classical
More informationEGR 111 Introduction to MATLAB
EGR 111 Introduction to MATLAB This lab introduces the MATLAB help facility, shows how MATLAB TM, which stands for MATrix LABoratory, can be used as an advanced calculator. This lab also introduces assignment
More informationProgramming Language and Translator
Programming Language and Translator Project Proposal Language For Linear Algebra (LFLA) Author: Chenzhe Qian Guitian Lan Jin Liang Zhiyuan Guo UNI: cq2185 gl2510 jl4598 zg2201 September 30, 2015 Motivation
More informationSummer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define
CS 6A Scheme Summer 207 Discussion 0: July 25, 207 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,
More informationMATLAB Tutorial III Variables, Files, Advanced Plotting
MATLAB Tutorial III Variables, Files, Advanced Plotting A. Dealing with Variables (Arrays and Matrices) Here's a short tutorial on working with variables, taken from the book, Getting Started in Matlab.
More informationSummer 2009 REU: Introduction to Matlab
Summer 2009 REU: Introduction to Matlab Moysey Brio & Paul Dostert June 29, 2009 1 / 19 Using Matlab for the First Time Click on Matlab icon (Windows) or type >> matlab & in the terminal in Linux. Many
More information