Introduction to Programming

Benjamin Lind
International Laboratory for Applied Network Research

Disclaimer

The material on the following pages is intended for the HSE Applied Network Research laboratory.

 

The advice that follows stems from personal experience in programming for social science research problems and may violate or misrepresent conventions used in computer science.

Why Program?

  • Flexibility
    • Data
    • Methods
  • Replication
  • Awareness
  • Developing problem-solving skills

Programming Solves Problems

  • Requires defining
    • The problem
      • Smaller problems within it
      • Relationships between problems
    • Required inputs
      • Size and type
    • Desired outputs
      • Size and type
    • Previously created relevant work
  • This process somewhat mirrors the research process

Platforms

R

  • Relative advantages
    • Made for statisticians
    • Network modeling libraries
  • Relative disadvantages
    • Made by statisticians
    • Terrible language, especially for beginners
      • Inconsistent practices
      • Data types and formats less transparent

R

R with minimal C++

  • Relative advantages
    • C/C++ highly influential
    • Requires close attention to problem
    • Fast
  • Relative disadvantages
    • More difficult, not user-friendly
      • Takes longer to write, compile
      • Typos can be very problematic
      • We will avoid advanced topics
    • Requires two languages simultaneously

R with minimal C++

Julia

  • Relative advantages
    • Made with recent data analysis tasks in mind
    • User-friendly language
    • Can call Python, C/C++, MATLAB, Mathematica
    • Fast
  • Relative disadvantages
    • New language
    • Limited network functions
    • Requires careful attention to data types

Julia

Python

  • Relative advantages
    • Widespread usage
    • Good network libraries
    • User-friendly language
    • Can call most languages
  • Relative disadvantages
    • Statistics was not the initial aim
    • No network modeling libraries

Python

Data Types

Data Shapes

Logical Expressions

Functions

Loops

Classes

ANRIntroProgramming

By Benjamin Lind

ANRIntroProgramming

  • 224