Presentation is loading. Please wait.

Presentation is loading. Please wait.

LISAM. Statistical software.

Similar presentations


Presentation on theme: "LISAM. Statistical software."— Presentation transcript:

1 LISAM. Statistical software.
Lecture 2 Course leader: Oleg Sysoev 732A60

2 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 732A60

3 How it looks like when you logon
732A60

4 Panels Menu Newsfeed: you find comments from people and courses you have chosen to follow Important menus: About me (edit the profile, set the default language) Courses and Programmes: See all courses that you registered yourself for. LISAM support help information 732A60

5 If the webpage is in Swedish
About meUpdate profile 732A60

6 Accessing a course My courses 732A60

7 Course structure 732A60

8 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 732A60

9 Course menus Note that each lab/assignment has a deadline and an end date 732A60

10 Submit a report 732A60

11 Statistical, DM and ML software
Commerical SAS Minitab SPSS Matlab Microsoft SQL Server Free of charge: R WinBugs, JAGS Python Apache Spark 732A60

12 SAS SAS SAS Base SAS Enterprise Guide SAS JMP 732A60

13 SAS How SAS is started What is Library
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) 732A60

14 R R is a computer language with full flexibility
Constantly increasing amount of packages (new research) Free of charge Website: Code Editor: 732A60

15 Software: use RStudio Install R: http://www.r-project.org/
Install RStudio: Workspace Program Plots Execution console 732A60

16 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) 732A60

17 Call help Specific function Help browser Search for something in help
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") 732A60

18 Introduction R is case-sensitive (A and a)
Each command on a new line or use ; Comment: #R is a very cool language! Initialize/set the variable Use-> or <- or = a<-3 3->b 732A60

19 Vectors Create a vector x<-c(1,3) See the result x print(x) 732A60

20 Operation with vectors
indexing Element-wise: +-*/^ log exp sin cos length –number of elements sum - sum of all elements max min sort order which.min which.max Logicals: TRUE or FALSE: A=TRUE; > >= < <= != & (and) | (or) 732A60

21 Matrices Use matrix() a<-matrix(values,nrow=m,ncol=n)
Values should be listed columnvise nrow= and ncol= can be skipped Create empty matrix 732A60

22 Matrix operations Usual vector operations can also be applied: 732A60

23 Matrix operations Matrix operators/functions: transpose b=t(a) b = aT
Inverse b = a-1 b=solve(a) Solve d=a-1b d=solve(a,b) 732A60

24 Indexing for matrices Positive index x[1,6] x[2:10,] Negative index
x[2,-(1:5)] row 2 and all columns except 1:5 Entire column or row y=x[2,] entire row 2 Extraction x[x>5] 732A60

25 Replication Replication for vectors Replication for matrices
rep(what, times) Replication for matrices matrix() 732A60

26 Matrix operations Dimension Row/column stististics
dim(mat) Row/column stististics colMeans, rowMeans, colSums,rowSums Apply a function over vector/matrix Sapply() Normally used when function works only element-wise 732A60

27 Vector/matrix operations
Create confusion matrix (classification) table(X,Y) Extract diagonal Diag(X) 732A60

28 Factors Text values 732A60

29 Lists List is a collection of objects 732A60

30 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) 732A60

31 Data frame Any column in the data frame can be retrieved by
dataframe$object Any row in the data frame can be extracted by using matrix notation, for ex: z[1,] 732A60

32 Read data from Excel file
Save as ”comma-separated file”(csv) Change current directory, Session Set Working Directory or setwd() Use Dataframe=read.csv2(file_name) Dataframe=read.csv(file_name) 732A60

33 Conversion between types
Data frame to matrix Matrix to data frame Numeric to factor Factor to numeric List to vector Vector to list 732A60

34 Conditioning and loops
If (x==3) { … } else { } for (i in 2:99) { while(x!=29) { 732A60

35 Loops for (name in expr1 ) { … } while (condition) 732A60
Introductory course "Statistics & Data Mining" 2012

36 Using a function Use ?name_of_function to see function parameters
For ex. ?lm There are some obligatory parameters and optional parameters The optional parameters can be specified in different order X=1:10 Y=1:10+rnorm(10) W=c(rep(1,5), rep(2,5)) mydata=data.frame(X,Y) result=lm(Y~X, weights=W,data=mydata) ?predict.lm Fit=predict(result) plot(X,Y) points(X,Fit, type="l", col="blue") 732A60

37 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 732A60


Download ppt "LISAM. Statistical software."

Similar presentations


Ads by Google