LISAM. Statistical software

advertisement
Lecture 2
LISAM. Statistical software.
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
How it looks like when you logon
Introduction to academic studies
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
If the webpage is in Swedish

About meEdit your profile
Introduction to academic studies
Accessing a course

Mina kurser/ My courses
Introduction to academic studies
Course structure
Introduction to academic studies
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
Course menus
Note that each lab/assignment has a deadline
and an end date
Introduction to academic studies
Submit a report
Introduction to academic studies
Statistical and data mining software

Commerical






SAS
Minitab
SPSS
Matlab
Microsoft SQL Server
Free of charge:




R
WinBugs
Python
GGobi
Introduction to academic studies
SAS

SAS




Basic Module
SAS Enterprise Guide
SAS JMP
…
Introduction to academic studies
SAS
proc import datafile=’C:\Customers.xlsx' dbms=xlsx
out=Customers;
sheet='Sheet1';
run;
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
Minitab
Learn:
 Import data
 Look through the menus
 Run regression
 Make a plot
Introduction to academic studies
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
Software: use RStudio


Install R: http://www.r-project.org/
Install RStudio: http://rstudio.org/
Workspace
Program
Plots
Execution
console
Introduction to academic studies
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 console
 Workspace (Observe, Save, Clear)
 Setting current directory (Tools)
 Installing new package (Packages tabs)
Introduction to academic
studies
Call help

Specific function


Help browser


args(function)
Examples of how to use function:


help.search(“expression”)
Quick reminder of function arguments:


help.start()
Search for something in help


help(function)
example(function)
If some method is not installed on the computer:

RSiteSearch(”expression")
Introduction to academic studies
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
Vectors

Create a vector
x<-c(1,3)

See the result
x
print(x)
Introduction to academic studies
Sequence

Either‘: ‘ or seq()
Introduction to academic studies
Matrices
Use matrix()
a<-matrix(values,nrow=m,ncol=n)
Values should be listed columnvise
nrow= and ncol= can be skipped
Introduction to academic studies
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
Data frame
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
Any object in the data frame can be retrieved by
dataframe$object
Introduction to academic
studies
Read data from Excel file
1.
2.
Save as ”comma-separated file”(csv)
Use
Dataframe<-read.csv2(file_name)
Exercise:

Use Excel file Airlines.xls and import it to R
Introduction to academic
studies
Conditioning and loops
If (x==3) {
…
…
} else {
…
}
for (i in 2:99) {
…
}
while(x!=29) {
…
}
Introduction to academic studies
Loops
for (name
{
…
}
in expr1 )
while (condition)
{
…
}
Introduction to academic studies
Writing your own functions


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
Download