lecture 2 lisam. statistical software.. lisam what is lisam? social network for creating personal...

29
Lecture 2 LISAM. Statistical software.

Upload: sabrina-wade

Post on 22-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Lecture 2

LISAM. Statistical software.

Page 2: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

LISAM

What is LISAM? Social network for Creating personal pages Creating courses

Storing course materials (lectures, documents, useful links) Publishing assignments to certain student groups (labs,

project work) Uploading and submitting solutions to assignments

electronically Correcting and grading the solutions

Communication between students and teacher

http://lisam.liu.se

Introduction to academic studies

Page 3: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

How it looks like when you logon

Introduction to academic studies

Page 4: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Panels

Menu Newsfeed: you find comments from people and courses

you have chosen to follow Messages: important information from

teachers/administrators in your courses.

Important menus: About me (edit the profile, set the default language) My courses: See all courses that you registered yourself

for. About LISAM help information

Introduction to academic studies

Page 5: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

If the webpage is in Swedish

About meEdit your profile

Introduction to academic studies

Page 6: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Accessing a course

Mina kurser/ My courses

Introduction to academic studies

Page 7: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Course structure

Introduction to academic studies

Page 8: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Course structure

Syllabus: compressed information about the course, teaching, examination and admission requirements

Course documents: basic course material: lectures, files (uploaded by teacher)

Collaborative workspace: teachers and students can publish files there and make comments

Newsfeed: Teachers and students may start a conversation there

Announcements: information from teacher Timetable: link to schedule in TimeEdit Submissions: Here you may find your labs/assignments and

submit the answer Assessment record: The overview of your grades

Introduction to academic studies

Page 9: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Course menus

Introduction to academic studies

Note that each lab/assignment has a deadline and an end date

Page 10: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Submit a report

Introduction to academic studies

Page 11: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Statistical and data mining software

Commerical SAS Minitab SPSS Matlab Microsoft SQL Server

Free of charge: R WinBugs Python GGobi

Introduction to academic studies

Page 12: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

SAS SAS

Basic Module SAS Enterprise Guide SAS JMP …

Introduction to academic studies

Page 13: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

SAS

Learn: How SAS is started What is Library What's in the Editor, Output, Log What's in the Results How to create a library How to import XLS document to the library Note data material (Column attributes) Write a simple computer program and save the file

proc. gplot data = sashelp.class; plot height * weight; run;

Run the program Sas file upload. Help (contents, index, search, SAS/GRAPH, SAS/STAT)

Introduction to academic studies

proc import datafile=’C:\Customers.xlsx' dbms=xlsx

out=Customers;

sheet='Sheet1';

run;

Page 14: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Minitab

Learn: Import data Look through the menus Run regression Make a plot

Introduction to academic studies

Page 15: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

R

R is a real computer language with full flexibility Constantly increasing amount of packages (new

research) Free of charge Website: http://www.r-project.org/ Code Editor: http://rstudio.org/

Introduction to academic studies

Page 16: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Software: use RStudio

Install R: http://www.r-project.org/ Install RStudio: http://rstudio.org/

Introduction to academic studies

Program

Execution console

Plots

Workspace

Page 17: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Basics in RStudio

Important to know:Create a new file and save it (File menu)Running one line or entire code (Edit menu)Running one line in consoleWorkspace (Observe, Save, Clear)Setting current directory (Tools)Installing new package (Packages tabs)

Introduction to academic studies

Page 18: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Call help

Specific function help(function)

Help browser help.start()

Search for something in help help.search(“expression”)

Quick reminder of function arguments: args(function)

Examples of how to use function: example(function)

If some method is not installed on the computer: RSiteSearch(”expression")

Introduction to academic studies

Page 19: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Introduction

R is case-sensitive (A and a) Each command on a new line Comment:

#R is a very cool language!

Initialize/set the variable

Use-> or <-

a<-3

3->b

Introduction to academic studies

Page 20: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Vectors

Create a vectorx<-c(1,3)

See the resultx

print(x)

Introduction to academic studies

Page 21: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Sequence

Either‘: ‘ or seq()

Introduction to academic studies

Page 22: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Use matrix()

a<-matrix(values,nrow=m,ncol=n)

Values should be listed columnvise

nrow= and ncol= can be skipped

Introduction to academic studies

Matrices

Page 23: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Index

Positive index

x[1,6] x[2:10]

Negative index

x[-(1:5)] all except 1:5

Entire column or row

x[2,] entire column 2

Introduction to academic studies

Page 24: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Vectors and matrices of the row length can be collected into a data frame

• Used to store the data of different types into a single table

Use data.frame(object 1, object 2, … , object k)

Introduction to academic studies

Data frame

Page 25: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Any object in the data frame can be retrieved by

dataframe$object

Introduction to academic studies

Data frame

Page 26: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Read data from Excel file

1. Save as ”comma-separated file”(csv)

2. Use

Dataframe<-read.csv2(file_name)

Exercise: Use Excel file Airlines.xls and import it to R

Introduction to academic studies

Page 27: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Conditioning and loops

If (x==3) {……} else {…}

for (i in 2:99) {…}

while(x!=29) {…}

Introduction to academic studies

Page 28: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

for (name in expr1 )

{

}

while (condition)

{

}

Introduction to academic studies

Loops

Page 29: Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,

Function writing must always end with writing the value which should be returned!

You may also use ”return(value)” to show what value the function should return

Introduction to academic studies

Writing your own functions