Installing R CRAN: –(R homepage: –Windows 95 and later  Base –rw2001.exe.

Slides:



Advertisements
Similar presentations
MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Advertisements

Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Introduction to Matlab
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
R tutorial g/methods2.2010/R-intro.pdf.
 Statistics package  Graphics package  Programming language  Can be used to share/reproduce analyses  Many new packages being created - can be downloaded.
Basics of Using R Xiao He 1. AGENDA 1.What is R? 2.Basic operations 3.Different types of data objects 4.Importing data 5.Basic data manipulation 2.
Introduction to GTECH 201 Session 13. What is R? Statistics package A GNU project based on the S language Statistical environment Graphics package Programming.
Introduction to MATLAB Simon O’Keefe Non-Standard Computation Group
Introduction to Exploratory Descriptive Data Analysis in S-Plus Jagdish S. Gangolly State University of New York at Albany.
Alternative text for elementary statistics –Elementary Concepts –Basic Statistics.
Introduction to R A. Di Bucchianico. Introduction to R2 Types of statistical software command-line software –requires knowledge of syntax of commands.
MATLAB TUTORIAL Dmitry Drutskoy Some material borrowed from the departmental MATLAB info session by Philippe Rigollet Kevin Wayne.
Concatenation MATLAB lets you construct a new vector by concatenating other vectors: – A = [B C D... X Y Z] where the individual items in the brackets.
Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,
Guide To UNIX Using Linux Third Edition
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
How to Use the R Programming Language for Statistical Analyses Part I: An Introduction to R Jennifer Urbano Blackford, Ph.D. Department of Psychiatry Kennedy.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Introduction to Damaris Zurell Dynamic Macroecology Swiss Federal Research Institute WSL
Nonparametric Econometrics1 Intro to Matlab for Data Analysis and Statistical Modeling.
Introduction to MATLAB
732A44 Programming in R.  Self-studies of the course book  2 Lectures (1 in the beginning, 1 in the end)  Labs (computer). Compulsory submission of.
Data, graphics, and programming in R 28.1, 30.1, Daily:10:00-12:45 & 13:45-16:30 EXCEPT WED 4 th 9:00-11:45 & 12:45-15:30 Teacher: Anna Kuparinen.
Introduction to to R Emily Kalah Gade University of Washington Credit to Kristin Siebel for development of much of this PowerPoint.
Arko Barman with modification by C.F. Eick COSC 4335 Data Mining Spring 2015.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
Piotr Wolski Introduction to R. Topics What is R? Sample session How to install R? Minimum you have to know to work in R Data objects in R and how to.
Chapter 1: Getting Started with MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
Using the R software R is an open source comprehensive statistical package, more and more used around the world. R project web site:
Ann Arbor ASA ‘Up and Running’ With R Prepared by volunteers of the Ann Arbor chapter of the American statistical association, in cooperation with the.
R packages/libraries Data input/output Rachel Carroll Department of Public Health Sciences, MUSC Computing for Research I, Spring 2014.
Matlab 14.html Cost: $100 Available in labs on Windows and Unix machines.
STAT 251 Lab 1. Outline Lab Accounts Introduction to R.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
STAT 534: Statistical Computing Hari Narayanan
Matlab Introduction  Getting Around Matlab  Matrix Operations  Drawing Graphs  Calculating Statistics  (How to read data)
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Introduction to Exploratory Descriptive Data Analysis in S-Plus Jagdish S. Gangolly State University of New York at Albany.
Prepared by volunteers of the Ann Arbor Chapter of the American Statistical Association, in cooperation with the Department of Statistics and the Center.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
SCRIPTS AND FUNCTIONS DAVID COOPER SUMMER Extensions MATLAB has two main extension types.m for functions and scripts and.mat for variable save files.
R tutorial Stat 140 Linjuan Qian
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Prepared by volunteers of the Ann Arbor Chapter of the American Statistical Association, in cooperation with the Department of Statistics and the Center.
Computing for Research I Spring 2013 Primary Instructor: Elizabeth Garrett-Mayer Introduction to R March 5.
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Before the class starts: 1) login to a computer 2) start RStudio 3) download Intro.R from MyCourses 4) open Intro.R in Rstudio 5) Download “R in Action”
Introduction to MATLAB
Programming in R Intro, data and programming structures
R programming language
Introduction to R Samal Dharmarathna.
LISAM. Statistical software.
Scripts & Functions Scripts and functions are contained in .m-files
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Introduction to Matlab
Matlab Workshop 9/22/2018.
StatLab Matlab Workshop
MATH 493 Introduction to MATLAB
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Demo of Basic Matlab Features
R Course 1st Lecture.
Using R for Data Analysis and Data Visualization
R tutorial
Presentation transcript:

Installing R CRAN: –(R homepage: –Windows 95 and later  Base –rw2001.exe

Editors for R WinEdt – –Download winedt 5.3 or 5.4 –RWinEdt package  Other  Editing Support  R-WinEdthttp://cran.r-project.org/ –Download most recent zip file Packages  Install package(s) from local zip files Library(RWinEdt) –To make automatic: R  rw2001  etc  Rprofile –Type commands, highlight, R-Paste –Use ## for comments –Free for about 100 uses, student license is $30 EMACS – –ESS package –Free!

General R workspace –Show what’s been stored: ls() or objects() –Remove individual objects: rm(a, b, etc.) –Clear entire workspace: rm(list=ls()) Quit: q() or file  exit Save workspace? Where to store R files: file  change directory File  load workspace or save workspace save() or save.image() Up arrow repeats prior commands R is case sensitive “>” – start new command; “+” – finish command Customize R –Options() –Edit  GUI preferences

Assignments and some basic math The assignment operator consists of ‘<‘ and ‘-’ and points from the expression to the name given to that expression x <- 10 assigns the number 10 to the letter x Assignments can be made in either direction R as an over-qualified calculator Log, exp Mean, median, mode, max, min, sd Trigonometry Set operations Logical operators:, >=, ==, !=

Vectors Vectors have length, but no dimension >length(vector) c() concatenates or combines numbers inside () into a vector or list seq() generates sequence Can specify length of sequence and increment rep() replicates elements >sort(vector) sorts items in vector Can use usual arithmetic and mathematical functions on vectors Logical vectors Character vectors Indexing a vector: >vector[i]

Matrices Matrices have length and dimensions >length(M); dim(M) Generating matrices By combining vectors: rbind(); cbind() >matrix() command Transpose >t(M) Diagonal >diag(M) Inverse >solve(M) Multiplying matrices: M%*%N Indexing matrices

Some simple functions Writing a user function >function( argument list ){expressions} Expressions or commands can be grouped together in {}, as they often are when writing functions. The value of the grouped commands is the result of the last expression. Conditionals ‘if’, ‘else’ Loops ‘for’

Probability distributions norm, binom, beta, cauchy, chisq, exp, f, gamma, geom, hyper, lnorm, logis, nbinom, t, unif, weibull, wilcox Four prefixes: ‘d’ for density (PDF) ‘p’ for distribution (CDF) ‘q’ for quantile (percentiles) ‘r’ for random generation (simulation) Each distribution has arguments that need to be specified

Loading Stata, SPSS, SAS files –Library(foreign) Stata: read.dta SPSS: read.spss SAS: read.xport (must first create export file in SAS) Excel files –Files must be saved as comma separated value or.csv –read.table, read.csv, read.csv2: identical except for defaults Watch the direction of ‘/’! >load(“.Rdata”) Loading and running R programs >source(“.R”)

Data >summary(data) >names(data); >attributes(data) Editing data >fix(data) or >edit(data) >data$var >attach(data) in order to remove need of ‘$’ >detach(data)

NA, NaN, and Null NA or “Not Available” –Applies to many modes – character, numeric, etc. NaN or “Not a Number” –Applies only to numeric modes NULL –Lists with zero length

Lm, glm, nlm, optim Linear models >lm(y~x1+x2) Generalized linear models >glm(y~x1+x2, family=“”) See help(family) for family options; family specifies error distribution Non-linear minimization >nlm(f, p) where f is the function to be minimized and p are the starting parameters Optimization >optim(par, fn) where par are the initial values and fn is the function to be minimized

Graphics >par() is used to set graphical options mfrow and mfcol >plot(x,y) >identify(); >abline() Arguments: type, point style, labels, etc. Boxplot, histograms, sunflowerplots, piecharts, etc. Saving them –As.pdf or.ps files >dev.off() –Know the current directory

Help! >help(package=stats) –Lists functions in the specified package >help(glm) or >?glm >help(“{“) for characters Help  Html help  Search Engine & Keywords –Potentially most helpful R documentation –command{package}

Other Resources The R Manuals under Documentation at Mark Handcock’s website at ks.html ks.html Jonathan Barron’s R resources at Fox, John An R and S-PLUS Companion to Applied Regression Cori Mar is teaching an intro to R class in the main CSSCR lab on Wednesday from 3:30-5