Statistics 540 Computing in Statistics

Slides:



Advertisements
Similar presentations
R for Macroecology Aarhus University, Spring 2011.
Advertisements

Training on R For 3 rd and 4 th Year Honours Students, Dept. of Statistics, RU Empowered by Higher Education Quality Enhancement Project (HEQEP) Department.
General Computer Science for Engineers CISC 106 Lecture 04 Roger Craig Computer and Information Sciences 9/11/2009.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
Introduction to Computing Dr. Nadeem A Khan. Lecture 24.
Lecture 7 Sept 19, 11 Goals: two-dimensional arrays (continued) matrix operations circuit analysis using Matlab image processing – simple examples Chapter.
Lecture 6 Sept 15, 09 Goals: two-dimensional arrays matrix operations circuit analysis using Matlab image processing – simple examples.
1 Statistics 517 Computing in Statistics © Fall 2004 Don Edwards and the University of South Carolina.
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.
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 to R Emily Kalah Gade University of Washington Credit to Kristin Siebel for development of much of this PowerPoint.
Data Objects in R Vector1 dimensionAll elements have the same data types Data types: numeric, character logic, factor Matrix2 dimensions Array2 or more.
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
Chapter 4 Review: Manipulating Matrices Introduction to MATLAB 7 Engineering 161.
Advanced Topics- Functions Introduction to MATLAB 7 Engineering 161.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
STAT 534: Statistical Computing Hari Narayanan
Matlab Basic. MATLAB Product Family 2 3 Entering & Quitting MATLAB To enter MATLAB double click on the MATLAB icon. To Leave MATLAB Simply type quit.
PROGRAMMING IN R Introduction to R. In this session I will: Introduce you to the R program and windows Show how to install R Write basic programs in R.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
S-PLUS Lecture 4 Jaeyong Lee Pennsylvania State University.
Array Accessing and Strings ENGR 1187 MATLAB 3. Today's Topics  Array Addressing (indexing)  Vector Addressing (indexing)  Matrix Addressing (indexing)
Engineering Computing I Chapter 5 Pointers and Arrays.
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
Working with data in R 2 Fish 552: Lecture 3. Recommended Reading An Introduction to R (R Development Core Team) –
Introduction to R and Data Science Tools in the Microsoft Stack Jamey Johnston.
Review for Test2. Scope 8 problems, 60 points. 1 Bonus problem (5 points) Coverage: – Test 1 coverage – Exception Handling, Switch Statement – Array of.
Programming in R Intro, data and programming structures
Chapter 12 Enumerated, Structure, and Union Types Objectives
The R Book Chapter 2: Essentials of the R Language Session 6.
Arrays: Checkboxes and Textareas
Lecture: MATLAB Chapter 1 Introduction
Introduction Osborn.
Introduction to MATLAB
Chapter 2 Assignment and Interactive Input
Naomi Altman Department of Statistics (Based on notes by J. Lee)
EGR 115 Introduction to Computing for Engineers
2) Platform independent 3) Predefined functions
SAS Programming Introduction to SAS.
Ch 7-8 Arithmetic Logical Operators
Chapter 1: Introduction to SAS
Web Systems Development (CSC-215)
Expressions and Assignment Statements
Using Arrays in C Only fixed-length arrays can be initialized when they are defined. Variable length arrays must be initialized by inputting or assigning.
Lab 1 Introductions to R Sean Potter.
Chapter 7: Macros in SAS Macros provide for more flexible programming in SAS Macros make SAS more “object-oriented”, like R Not a strong suit of text ©
CNG 140 C Programming (Lecture set 8)
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections
CHAPTER THREE Sequences.
Use of Mathematics using Technology (Maltlab)
Review for Final Exam.
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
CSCI N207 Data Analysis Using Spreadsheet
Web DB Programming: PHP
Communication and Coding Theory Lab(CS491)
Basics of R, Ch Functions Help Managing your Objects
Data Management Module: Creating, Adding and Dropping Variables
Review for Final Exam.
Ch 9-10 Subsetting Ordering Array operations Iteration
Data: Lists and Dataframes
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Building Java Programs
R Course 1st Lecture.
Introduction to Matlab
EECE.2160 ECE Application Programming
Creating a dataset in R Instructor: Li, Han
Expressions and Assignment Statements
Introduction to Computer Programming IT-104
Chapter 1: Creating a Program.
Presentation transcript:

Statistics 540 Computing in Statistics © Fall 2004 Don Edwards and the University of South Carolina

Course Goals Syllabus R (=Splus) programming SAS programming (DATA step) Syllabus Read it carefully!

Syllabus Read it carefully

A Typical Class Review previous coding exercise (10-20 min) Coding discussion and demonstration (40 min) Assign coding exercise Part of the time spent on exercises is “built in” to class time

Learning R Don Edward’s notes Supplemental exercises Many other R resources available online

Basics of R, Chapters 1-2.5 Intro to R Objects, Modes, Assignments Getting Help

1. R: An Introduction Shareware version of S (Splus) Version 3.4.1 (I have 2.15.2) for Windows; 3.4.1 (I have 3.2.4) for Mac Steep learning curve (case sensitive, cryptic help and error messages, data import and export) Download R yourself

1. R: An Introduction (cont) Starting and quitting Object oriented Vectors, factors, matrices, data frames, lists, functions R object names are flexible Be careful of built-in R names Don’t let objects accumulate Objects organized by types; types have common attributes and common treatment by functions.

2.1 Vectors Strings of data elements of the same mode Major modes: numeric, character, logical Examples from R data sets

2.1 Vectors (cont) Component extraction Assignments (beware copying over variables!) Object attributes (e.g. names) length(), c(), “:”, seq() functions No shorthand for increments in “:” statement Functions can be nested Component extraction is an odd name for this function. No warning if copying over! Discuss <- , = and _

2.2 Factors Defines groups in data (looks like a character vector, but no quotes) Levels Coercing to a character vector Other coercion functions The similarity to character vectors causes problems if you’re not wary. Factors are very useful in analysis.

2.3 Matrices Two-dimensional array; columns have same mode (usually numeric or logical) Attributes: dim and dimnames Caution about length() Extracting a single element, or an entire row or column

2.4 Data Frames R’s standard “data set” Two-dimensional array, but columns may have different modes Attributes: names, row.names Referencing columns with $ Conversion of character vectors to factor objects by data.frame() A data frame is also a list, to be discussed next.

2.5 Lists Glued-together strings of diverse objects Output of many R functions E.g., attributes of any object Extraction with [[ ]] Extraction with $