Transcription of ST419 2008/2009 Computational Statistics
1 0. Introductory MaterialST419 2008 / 2009 Computational StatisticsLecturer: Erik Baurdoux1B604 Assistant: Neil BathiaCourse Aims and ObjectiveThis course teaches the fundamental computing skills required by practicing statisticians. Wefocus on analysis of data using a computer and simulation as a tool to improve understandingof statistical models. The software package R is taught throughout. On successful completionof the course you will be a competent R user with skills that adapt readily to other statisticalsoftware packages. A small subset of the things you will be able to do are listed below: generate detailed descriptive analyses of data sets (both numbers and graphics), fit statistical models and interpret the output from model fitting, design and perform simulation experiments to explore the properties of Statistics , write your own R functions to simplify commonly performed tasks or to implement novelstatistical AdministrationPrerequisitesThis is intended primarily for MSc Statistics , MSc Social Research Methods ( Statistics ) and MScOperational Research students.
2 You are required to have a good basic knowledge of Statistics (to the level of ST203 Statistics for Management Sciences). The course makes extensive useof computers in teaching and assessment. Basic familiarity with machines running a Windowsoperating system is this year s course, I have slightly modified the original course notes written by Dr. J. PenzerST419 Computational Statistics1c J Penzer 20060. Introductory MaterialTimetablingYou are required to attend four hours per week for this 1400-1500H102 Weeks 1-10 LectureMondays 1500-1700S169 Weeks 1-10 Computer WorkshopTuesdays 1000-1100 H101 Weeks 1-9 Problem Tuesday of week 10, we will be in H102 from 0900-1200 for students presentations (seeassessment below).AssessmentThis course is assessed by coursework (50%) and by a two hour examination during the summerterm (50%).
3 There are two pieces of coursework:Handed out Due inMarksGroup project20/10/08 Written: 05/12/0810%Presentation: 09/12/08 10%Individual project 17/11/0812/01/0930%Detailed instructions for each of the projects will be given. There will be two practice course has detailed lecture notes. It should not be necessary to buy a book for this texts (new R books are appearing all the time) Venable, W. N. and Ripley, B. D. (2002)Modern Applied Statistics with S, (Fourth Edi-tion), Springer. ( V44) Venables, W. N., Smith, and the R Core Development Team (2001)An Introductionto R, freely available Computational Statistics2c J Penzer 20060. Introductory MaterialCourse contentA rough timetable and outline of course contents are given 1 Data, Session Management and Simple Statistics R objects: vectors, dataframes and model objects; assignment; descriptive analysis; managing objects;importing data;t-tests; simple regression; financial 2 More R Essentials and Graphics R objects: logical vectors, charactersequences, lists; regular sequences; subset selection; descriptive plots: histogram,qq-plot, boxplot; interactive graphics; low level 3 Writing Functions in R R objects: functions, arrays, matrices; function syntax;flow control: conditioning, loops; R code from other sources; project allocated.
4 Individual project instructions 4 Distributions and Simulation statistical concepts: distributions, moments,sample moments, properties of Statistics ; distributions in R: probability density,quantiles; pseudo-random number generation; interpretation of simulation 5 Monday: Written test 1 and Group project : Feedback on written test 6 Linear Models I statistical concepts: multiple regression, model selection,diagnostics; model formulae; interpretation of linear model 7 Linear Models II statistical concepts: factors as explanatory variables, logisticregression; manipulating model project 8 Time Series Analysis statisical concepts: auto-correlation, ARMA models,GARCH models; R time series packages; graphics for exploratory analysis 9 Monday: Written test 2 and Individual project : Feedback on written test 10 Monday: : Student presentations (0900-1200, H102).
5 ST419 Computational Statistics3c J Penzer 20060. Introductory MaterialTeaching methods and materialsLectures and problem classesOn Mondays we will give details of the application of R to new material. On Tuesdays we willgo through the exercises from the previous day - you will be expected to have attempted tocomplete the exercises so that you can contribute to the class. Any common problems with theexercises or in the use of R will be dealt with during these practicalsThe only way to learn a computer language is to actually use it. The computer practicals providetime when you can work on material from the lecture notes and exercises. Using a combinationof the notes, the R help system and experimentation you should be able to work out most of thecommands. The R commands in the text are there to illustrate certain points. You do not haveto follow them rigidly.
6 There is often more than one way to do something and you may be ableto find a better solution than the one given. If you find something interesting or difficult, spendmore time on it; if you get the idea straight away, move on. If you can t work something outby experimenting with it, ask me or don t mindlessly type in commandsfrom the notes without understanding what they notesThe course attempts to convey a large amount of information in a short space of time. Someof the material is of a technical nature and may not be covered explicitly in the lectures are expected to read the lecture notes thoroughly. The syllabus is definedby the contents of the lecture notes with the exception of topics marked with a . Additionalreading is suggested at the end of each weeks notes. Some of the notational conventions adoptedin the notes are described below.
7 Additional non-examinable material for those who are interested.* material that you may want to skip first time font R related quantities and typewriter font things to be replaced with with an appropriate value, iden-tifier or font a new term or Computational Statistics4c J Penzer 20060. Introductory MaterialIf you miss a set of notes, additional copies are available from three sources: Public folder to find copies of the notes in pdf format, openOutlookand go toPublic Folders All Public Folders Departments Statistics ST419 Notes Website I will also put copies of the notes on my website MoodleThe versions on the notes on the public folders and the website will be updated to includecorrections. Despite my best efforts,there will be mistakes in the notes. If you spotsomething that looks wrong please let me issues that arise from the topic under consideration are placedin boxes in the text.
8 These may be hints on using R effectively, quickquestions or suggestions for further Software and dataR software is freely available under the GNU General Public License. The R project You can download the software to install on your own Data files associated with the course can be found intheST419public folder with meBy far the best way to communicate with me is via email. I will respond to sensible emailsrelating to: problems with material in the course, problems with exercises, mistakes in the ST419 projects are unsupervised; I will not provide any direct assistance with Computational Statistics5c J Penzer 2006 Chapter 1 Data, Session Management andSimple Key ObjectsR works onobjects. All objects have the following properties (referred to asintrinsic attributes): mode: tells us what kind of thing the object is possible modes includenumeric,complex,logical,character andlist.
9 Length: is the number of components that make up the the simplest level, an object is a convenient way to store information. In Statistics , we needto store observations of a variable of interest. This is done using a numeric vector. Note thatthere are no scalars in R; a number is just a numeric vector of length 1. Vectors are referred toasatomic structures; all of their components have the same an object stores information, we need to name it so that we can refer to it later (and thusrecover the information that it contains). The term used for the name of an object identifier is something that we choose. Identifiers can be chosen fairly freely in R. The pointsbelow are a few simple rules to bear in mind. In general any combination of letters, digits and the dot character can be used althoughit is obviously sensible to choose names that are reasonably descriptive.
10 You cannot start an identifier with a digit or a dot not. Identifiers are CASE SENSITIVE different It iseasy to get caught out by Data, Session Management and Simple Statistics Some characters are already assigned values. These includec,q,t,C,D,F,IandT. Avoidusing these as we are interested in data sets that consist of several variables. In R, data sets arerepresented by an object known as adata frame. As with all objects, a data frame has theintrinsic attributes mode and length; data frames are of modelistand the length of a dataframe is the number of variables that is contains. In common with many larger objects, a dataframe has other attributes in addition to mode and length. The non-intrinsic attributes of adata frame are: names: these are the names of the variables that make up the data set, : these are the names of the individuals on whom the observations are made, class: this attribute can be thought of as a detailed specification of the kind of thing theobject is; in this case the class is" ".