Emre Ugur

Ph.D.

CMPE140 Introduction to Computing for Economics and Management
2016/2017 Fall


Aim:
CMPE 140 introduces basic concepts of computing with the R programming language. Course topics include an introduction into basic data structures (vector, matrix, lists, data frames, etc.), program control statements (conditional execution, for and while loops, etc.), data visualization and input/output.
Instructor: Emre Ugur (contact)
Teaching Assistants: Nadin Kokciyan, Ufuk Serkan Yildirim (ufukserkan--AT--gmail[dot]com)
Office hours: Tuesday, 16:00-17:00
Mailing-list: Please send email if you are not registered!

Timetable:

Lecture Wednesday 13:00-15:00 New Hall Building, Room NH405
Problem Session Wednesday 15:00-16:00 New Hall Building, Room NH405
Lab for CMPE104.1 Friday 13:00-15:00 CMPE Building, Room B4
  • Lab for CMPE104.2
  • Friday 15:00-17:00 CMPE Building, Room B4


    Schedule:
    ChapterTopicsLecture Material
    Introduction
    • Course objectives and organization,
    • R Intro,
    • R Download and Installation,
    • Simple calculations,
    • R help and documentation,
    • R Programming Environment,
    Lecture slides
    Vectors
    • Variable name conventions
    • Creating data vectors
    • Data vector indexing
    • Data vector filtering
    • Data vector sorting
    • Data vector operations
    • Creating regular sequences
    • Creating repeated values
    Lecture slides
    Problem session | Answers
    Lab | Answers
    HW-1 | HW-2
    Quiz
    Matrices
    • Matrix creation
    • Matrix modification
    • Matrix operations
    • Matrix indexing
    • Matrix filtering
    • Matrix function apply()
    • Programming own functions
    • Higher-dimensional arrays
    Lecture slides
    Problem session | Answers
    Lab | Answers
    HW
    Quiz S1 Quiz S2
    Lists
    • Shortcomings of vectors and matrices
    • Creating lists
    • List indexing
    • Adding/deleting list elements
    • Concatenate lists
    • Vectors as list components
    • Example: word list
    • Accessing list components/values
    • Example: sort word list alphabetically
    • Applying functions to lists
    • Example: sort word list by word frequency
    Lecture slides
    Problem session | Answers
    Lab | Answers
    HW
    Quiz S1 Quiz S2
    Data frames
    • Shortcomings of vectors and matrices
    • Creating data frames
    • Accessing data frames
    • Data frame indexing
    • Data frame modifications
    Lecture slides - data frames Lecture slides - summary
    Problem session
    HW
    Midterm! (October 21)
    Loops
    • Data import from file
    • Data frame summary
    • Scatter plot
    • The for-loop
    • Print variable when iterating
    • Compute length/norm of a vector
    Lecture slides
    Problem session (Zip File)
    Loops continued
    • Square elements of a vector
    • Function findwords
    • Read data from file
    • if-else statement
    • Plotting word frequencies from Wikipedia articles
    Lecture slides
    Problem session (Zip File)
    Quiz
    Loops continued
    • Nested loops
    • While loop
    • Print vector elements when looping
    • Compute length/norm of a vector
    • While vs. for loop
    • Break statement
    • Quiz with the while loop
    • Random numbers with the while loop
    • Repeat loop
    • Next statement
    Lecture slides
    Problem session (Zip File)
    Quiz (Programming)
    Graphics
    • Scatter plot
    • Barplot
    • Scatter plots of data frames
    • Histograms
    • Figure arrays
    • Scatter plot vs. Histogram
    Lecture slides
    Problem session (Zip File)
    Quiz S1 Quiz S2
    Quiz (Programming) (Zip File)
    Graphics Continued
    • Boxplots
    • Stripcharts
    • Pie charts
    • Word frequency
    • Caffeine consumption and marital status
    • Sales data
    Lecture slides
    Problem session (Zip File)
    Quiz (Programming) (Zip File)
    Input and Output
      • Read data with scan
      • Read from the keyboard
      • Read into a matrix
      • Reading text files
      • Accessing files from the Internet
      • The UCI Machine Learning Repository
      • Iris flower data set
      • Word frequencies of ebooks from Project Gutenberg
      • Export graphics
      • Writing to files
    Lecture slides
    Quiz S1 Quiz S2
    Lab (Zip File)
    Data analysis
    Wrap-up
      • Data structures
      • Conversion between data types
      • Correlation and dependence
      • Linear Regression
      • Prediction
    Lecture slides
    Summary for final exam Lecture slides

    Grading:
    • Lab session (quiz) : 30 %
    • Midterm : 25%
    • Final : 45%