57
Computational Social Science MEASUREMENTS & EXPLANATIONS Claudia Wagner

Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Computational Social Science

MEASUREMENTS & EXPLANATIONS

Claudia Wagner

Page 2: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Measurement

•  Measurement is the assignment of a number to a characteristic of an object.

•  Measuring invisible and complex objects/events (e.g. culture, political leaning, happiness) is tricky •  People use every day language which is vague •  We can only measure observable outcomes •  Many factors may impact the observable outcome and

add noise

•  How to ensure the quality of measurements?

Page 3: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Quality of Measurements

Reliability: how consistent and stable is our measurement?

•  Intra-rater reliability •  Inter-rater reliability •  Test-retest reliability

Validity: do we measure what we want to measure? •  Face validity •  Construct validity •  Criterion-based validity

Page 4: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Cultural Relations

Understanding Similarity

Affinity

Page 5: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Wikipedia

Articles about cuisine/music/literature/… of a country in different language editions

Page 6: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Example: Measurements

Measure cultural similarity between countries/languages via Wikipedia

–  Mechanical turk study: which country pair has a more similar cultural? (face validity)

Bosnia / SerbiaEstonia / LithuaniaRussia / Ukraine

England / HungaryBulgaria / EnglandBelgium / Bulgaria

Which countries are culturally more similar? England/Hungary or Bosnia/Serbia

. .

. .

. .

Page 7: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Example: Measurements

–  Check if inferred cultural similarity agrees with ESS (criterion-based validity)

–  Use different sub-samples (all pages about food, music, literature; use a baselines!) (test-retest reliability)

–  Repeat measurements (Wikipedia changes; do our results hold?) (test-retest reliability)

–  Theories about relation between similarity and understanding and affinity (construct-based validity)

Paul Laufer, Claudia Wagner, Fabian Flöck and Markus Strohmaier, Mining cross-cultural relations from Wikipedia - A study of 31 European food cultures, ACM Web Science, Oxford, 2015

Page 8: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

http://photos.jdhancock.com/photo/2011-09-11-232435-relationship.html

Explanations

Page 9: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Problem with Correlations

From http://tylervigen.com/spurious-correlations

Page 10: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Problem with Regressions

Do students from elite colleges earn more later in life? earn ~ b0 + b1 * college + error

–  Do people who went to an elite college earn on average more later in life?

Problem “Omitted Variable”

–  Being accepted in an elite college correlates with many factors that also impact outcome, e.g motivation

Idea: –  Apply to elite college correlates with motivation –  earn ~ b0 +b1*college + b2*motivation +error

Page 11: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Statistical Control

Keep all covariates constant except one What is the average effect of one unit increase in motivation on the earnings of students who went to an elite college? earn ~ (b0 +b1) + b2*motivation +error

Same for students who did not go to an elite college earn ~ b0 + b2*motivation +error

Page 12: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Bivariate Regression Yi = b0 + b1 Xi + εi

12

6 4 2 0

Y

X

0 2 4 6 8

Yi = 2 + 0.5 Xi + εi

Page 13: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Multiple Regression

13

The part of X2 that is independent of X1

Page 14: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Goal: Causality

Basic Idea goes back to John Stuart Mil (1806-1873)

Counterfactual model of Causal Inference (also known as Rubin Causal Model or Potential Outcomes Model of

Causal Inference)

Does going to an elite colleges makes Yi earn more later? If Yi would have chosen a normal college, would Yi have earned

less?

Page 15: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

earn

ings

time college

Did going to an elite college impact future earnings of Yi?

Causal Effect

Yi(T) - Yi(C)

Page 16: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Causal Effect

Page 17: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Experiment

Gold Standard Method for causal inference!

Assignment of subjects to treatment or control group is random and groups are large enough to wash out differences in other covariates.

Manipulation of treatment is under control of researcher

Different levels of treatment should lead to different levels of effect

Page 18: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Limitations of Experiments

•  Expensive

•  Not all treatments are possible and ethical

•  Internal validity is high, but external validity is often limited.

•  Non-interference assumption is often violated in social science field experiments

Page 19: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Matching Methods

Among given “organic” data (e.g. human trace data), can we find a subset that looks like generated by an experiment?

Balance pre-treatment covariates X

matching == pruning

Page 20: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Ho, Daniel, Kosuke Imai, Gary King, and Elizabeth Stuart. 2007. “Matching as Nonparametric Preprocessing for Reducing Model Dependence in Parametric Causal Inference.” Political Analysis 15: 199–236. Copy at http://j.mp/jPupwz

Pos

ition

Cha

nge

education (in years)

Outcome

1-dimensional covariate

Treated with special training

Does Special Training Help Job Promotion?

Page 21: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Linear Regression

posi

tion

cha

nge

(p)

education (e)

Correcting for education, the treated group has higher positions.

pos = b0 + b1*edu + b2*is_treated

γ = estimated treatment effect

binary variable

Page 22: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Quadratic Regression po

sitio

n c

hang

e (p

)

education (e)

Model Dependence

Reason: Imbalance of covariates

Correcting for education, the treated group has lower positions.

pos = b0 + b1*e + b2*edu2 + γ*is_treated

Page 23: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Regression After Pruning po

sitio

n (p

)

education (e)

1) Preprocessing (matching) 2) Estimation of effects (regression models)

Matching has reduced model dependence!

Page 24: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Matching Approximates Randomized Experiment

Completely randomized: –  Flip a coin for each patient. Heads -> “T”, tails -> “C”. –  Could get unlucky: all men assigned “T”

Fully blocked experiment: –  First pair up similar patients, same gender, age, … –  Then flip a coin for each pair. One gets “T”, one “C”. –  Balances the known covariates.

Both balance unknown covariates.

Fully blocked experiment dominates complete randomization!

Page 25: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Mahalanobis Distance Matching

Approximates fully blocked experiment

Many Variations: Optimal match, greedy match, match 1:1 or 1:many, and so on Prune bad matched with distance > threshold (“caliper”)

age

education

Gary King, "Why Propensity Scores Should Not Be Used for Matching“, Methods Colloquium, 2015, https://www.youtube.com/watch?v=rBv39pK1iEs

Page 26: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Euclidean distance

Euclidean distance doesn’t make sense when different dimensions are on different scales. –  For example: yearly income, age, gender, body weight

Problem: distance is dominated by largest values

Page 27: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Mahalanobis Distance

Conceptual fix: first rescale each dimension to N(0,1)

In practice: could use “expert scaling” and Euclidean distance.

Inverse of variance-covariance matrix

Page 28: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Propensity Score Matching ag

e

education

Approximates complete randomization

Page 29: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Propensity Score Matching ag

e

Education level not balanced ⇒ High education, low

propensity score

Worst case: p(T=1) = 0.5 => random pruning

Approximates complete randomization

education

Page 30: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Summary Matching Methods

•  Matching methods are powerful and help to approximate causality

•  Problems –  Researchers have lots of freedom when decide how to match –  We remove data à we need to specify for which group the causal

effect holds –  Most matching methods have been developed for low number of

covariates –  Worst case: random pruning à increases imbalance à increases

bias and model dependence

•  Compare results from different matching methods, different dimensionality reduction methods, different models

–  Avoid model dependence and method dependence!

Page 31: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Natural Experiment

Like in experiments but…

–  Assignment is only “as-if-random”

–  Researcher does not control the intervention or treatment

Page 32: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

What is the impact of receiving a scholarship on future performance?

scholarship No scholarship

Test score threshold

Min score Max score

Page 33: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Thad Dunning, Natural Experiments in the Social Sciences. A Design-Based Approach, p.126, 2012.

19,6 25,1

Page 34: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Thad Dunning, Natural Experiments in the Social Sciences. A Design-Based Approach, p.126, 2012.

Page 35: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Regression Discontinuity (RD)

Future performance

Coarsend test score

Dummy Var: received schoolarship or not

Page 36: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

RD Robustness Checks

–  Can individuals control if they are above or below the threshold?

–  Jumps at placebo points versus at threshold? –  Do other variables jump at the threshold? –  Are the results robust to the usage of different bin

widths? –  Distinguish between discontinuity and non-lineary

•  Are the results robust against including higher order polynomials?

Page 37: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic
Page 38: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Fuzzy Discontinuity

Threshold can be fuzzy

–  e.g. if individuals above the threshold are much more likely to receive a schoolarship

–  In that case the test score is an instrument for the causal relationship between schoolarship and performance.

Page 39: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Another Type of Natural Experiments: Instrumental Variables

M

P E

Correlated, because “earning potential” is omitted

Beta is biased and inconsistent!

lifetime earnings

earning potential (unobserved)

military service

Page 40: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Instrumental Variable

Instrumental variable should be strongly correlated with the included endogenous regressors (M), but not effect outcome variable directly (E)

M

P E

L L is the draft-lottery (can be 0 or 1) L is an instrument for the causal effect of M on E

Angrist, Joshua D. (1990). "Lifetime Earnings and the Vietnam Draft Lottery: Evidence from Social Security Administrative Records". American Economic Review 80 (3)

lifetime earnings

earning potential

military service draft lottery

Page 41: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

How to estimate the causal effect via instrumental variable L?

“Wald Estimator” if L is binary

Plausibility check: what if L is perfect instrument? Example: winning the lottery => 90% chance of joining military

& 10% joining without invitation & $2,200 per year difference

$2,200 / 0.8 = $2,750 (what if 0.00001?) Angrist found that military service decreases earnings about $2,741 dollar per year

Instrumental Variable

E[E|L=1] – E[E|L=0]

E[M|L=1] – E[M|L=0]

Page 42: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Instrumental Variable

δ is a consistent (= asymptotically unbiased) estimator and estimates the causal effect of M on E

Page 43: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

User’s expression

Friends’ expression

No manipulation of user experience!

Example: Emotional Contagion

External variable

User’s expression

Friends’ expression

•  Social influence? Homophily? Common exposure?

•  Use meteorological data as an instrument

Page 44: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Emotion on Facebook

•  Classify semantic content of status updates using LIWC •  Emotion: fraction of posts with positive/negative words

[Coviello et al., Proc. of the IEEE 2014, PLoS ONE 2014]

Slides provided by Lorenzo Coviello. Thanks! Later partially modified.

Page 45: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

yjt = user j’s happiness at time t, fraction of posts with positive/negative words j = user whose emotion we’re predicting i = a friend of user j t = time window of interest Θt = time-related fixed effect (there are “happy times”) fj = user-related fixed effect (there are “happy users”) 𝛿jt = degree of user j at time t (friends come and go) aijt = strength of relationship at time t between i and j

Cumulative effect of a user on their friends

Individual-Level Model

Computationally demanding. One observation per (user, time) pair

Page 46: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

g = city whose aggregate emotion we’re predicting Θt = time-related fixed effect (there are “happy times”) fg = city-related fixed effect (there are “happy cities”) ng = number of users in city g

average emotion in city g at time t

average strength of relationship between i and an individual in city g

City-Level Model

Ygt = average emotional influence on an individual in city g

Page 47: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Instrument z should not affect when is held constant

Ygtygt

Friends’ rain z Friends’ emotion

Users’ emotion

Ygt ygt

Break correlation between friends’ rain and user’s rain

–  Restrict data to (city,day) WITHOUT rain

–  Restrict data to (city,day) WITH rain

Exclusion Restriction

But weather in g and in friends’ cities could be correlated. => Weather directly influences emotions in g!

Page 48: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Explanatory variable (social contagion)

Instrumental variable zgt

Friends’ rain zgt Friends’ emotion

Users’ emotion

Ygt ygt

Two-stage regression

•  RAIN: 1 if it rained, 0 otherwise

Ygt =X

i

yit1

ng

X

j2Sg

1

�jtaijt

zgt =X

i

RAINit1

ng

X

j2Sg

1

�jtaijt

Rainfall as Instrumental Variable

Page 49: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Results rain decreases positive posts by 1% a positive post leads to another 1.7

Page 50: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Results

They found evidence for emotional contagion But does rain really impact happiness? What are we measuring?

–  People complain about rain on Twitter, ok. Does that make them unhappy?

Just conversational dynamics? –  User A: All the rain is making me depressed. –  User B: Poor guys who have to suffer in the rain.

Page 51: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Natural Experiments Summary

Natural experiments can be powerful alternatives to experiments

Watch out for cutoffs that cannot be directly

manipulated by individuals (e.g. size- or age-based thresholds, eligibility criteria, location, …)

Find variables that are highly correlated with your

regressor but not with your outcome

Page 52: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Difference in Differences

•  Control and treatment groups are not randomly assigned and start at different “levels” before treatment

•  Sometimes control and treatment group outcomes can be assumed to move in parallel

Page 53: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Difference in Differences

"Illustration of Difference in Differences" by Danni Ruthvan - Own work. Licensed under CC BY-SA 3.0 via Wikimedia Commons

•  P: treatment group •  S: control group

Start from different levels Not randomized experiment

•  Difference between P2 (observed outcome of treatment group) and Q (expected outcome of treatment group) is the treatment effect

Treatment effect

after treatment

(P2 – S2) – (P1 – S1)

before treatment

Page 54: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Twitter for Migration Studies

•  Use streaming API filter for geo-tagged tweets from OECD countries

•  Pick 3,000 users per country, get their tweets •  Estimate out-migration and oversample “static”

countries •  Get data for ~500K users •  After activity thresholding left with ~15K

E. Zagheni, K. Garimella, I. Weber, B. State: Inferring International and Internal Migration Patterns from Twitter Data. WWW’14

Page 55: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Estimated Out-Migration Rates

Page 56: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Difference-in-Differences

Out-migration rates clearly an overestimate Main reason: Non-representative user set Selection bias is changing over time in unknown manner Assumption: changing “in lockstep” for different countries Focus on between-country differences

= the out-migration rate from country c to all other countries … = # users identified as migrants from c / # users in c

Page 57: Computational Social Sciencewwsss16.webscience.org/sites/wwsss16.webscience.org/... · 2019-10-24 · Measurement • Measurement is the assignment of a number to a characteristic

Results

Relative changes 2011 -> 2012 Limited by data sparsity: migration is a rare event