Docsity

Quantitative methods for social sciences module II - Statistics, Appunti di Statistica

Toggle sidebar
bg1
Statistics
Statistics def. Science of designing studies and analyzing the data that those studies
produce.
Goal: translating data into knowledge of the world --> science of learning from data
oStatistical units: entity on which we run our measurements
Interest in a particular characteristic (that I expect to observe with variability)
in a field
oTwo kind of characteristics that generate two type of data
Individual level --> data generated: micro
Aggregate level --> data generated: macro
Going from individual level to aggregate level is possible, the opposite is not
One of the most difficult task in statistics applied in political science is deriving micro
data from macro analysis --> ecological fallacy
Macro data collection is less expensive than micro analysis --> one of the reasons why
used so often
Macro data are usually free to the public (ISTAT, UN...)
First use of statistics as a government level
*Time seen as a proxy of the culture at that moment
oCross-sectional data: data collected only once on a statistical unit
oRepeated measurements: measure same characteristics at different time points
oTimes-series: collect data at macro level at different time points - repeated
measurements
oPanel data: collected data at individual, micro, level at different time
points and at exactly the same units (individuals)
Constraint: missing data --> is not sure an individual will be there
in x years
Repeated cross-section: individuals with precise socio-demographic
characteristics analyzed in a given time, other individuals with same
characteristics (comparable) analyzed in another period of time
pg. 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Anteprima parziale del testo

Scarica Quantitative methods for social sciences module II - Statistics e più Appunti in PDF di Statistica solo su Docsity!

Statistics

Statistics def. Science of designing studies and analyzing the data that those studies produce. Goal: translating data into knowledge of the world --> science of learning from data o Statistical units: entity on which we run our measurements Interest in a particular characteristic (that I expect to observe with variability) in a field o Two kind of characteristics that generate two type of data  Individual level --> data generated: micro  Aggregate level --> data generated: macro Going from individual level to aggregate level is possible, the opposite is not One of the most difficult task in statistics applied in political science is deriving micro data from macro analysis --> ecological fallacy Macro data collection is less expensive than micro analysis --> one of the reasons why used so often Macro data are usually free to the public (ISTAT, UN...) First use of statistics as a government level *Time seen as a proxy of the culture at that moment o Cross-sectional data: data collected only once on a statistical unit o Repeated measurements: measure same characteristics at different time points o Times-series: collect data at macro level at different time points - repeated measurements o Panel data: collected data at individual, micro, level at different time points and at exactly the same units (individuals)  Constraint: missing data --> is not sure an individual will be there in x years  Repeated cross-section: individuals with precise socio-demographic characteristics analyzed in a given time, other individuals with same characteristics (comparable) analyzed in another period of time

Population seen as a physical element: population as the set of all statistical units on which I might run my measurements Sample: subset of population, of size n. Can be drawn

  • According to the analyst's judgment
  • At random --> all units have the same probability to be drawn --> representative Sample to be representative of the population needs to be randominc Random sampling:  Units drawn at random one at time  Each unit --> same probability  Samples of the sample size --> same probability Inferential process: drawing conclusion that concern the entire population from the information provided by a sample drawn it. To draw conclusions:
  • About the entire population
  • Based on a sample analysis

Parameter: numerical summary - average at population level ( almost impossible to

calculate --> population ≈ ∞) (ex. mode)

Statistic: numerical summery - average at sample level --> observed average number of

the sample

Descriptive vs Inferential statistics

Descriptive Statistic: collection of techniques --> describe sample data, using sample statistics Inferential Statistic: collection of techniques --> learn on population parameters, making predictions and decisions about the population, based on sample statistics

Describing data Preamble Youth Participatory Politics Survey, 2012 Aim: investing how in in the USA youth (from various backgrounds) participate in an experience public life online and offline

  • Assess the impact that new media have on the political and civic behavior of young people. Survey administered to a nationally representative sample of more than 2500 respondents aged 15-

Describe variable (on Stata)

Describe variables from Q1 to Q4 on YPPS.do

command: describe Q1_DAYS-Q4_DAYS

All information about variable Q

command: codebook Q3_DAYS

Methods to describe data

Central tendency: categorical, numerical

Location: categorical ordinal, numerical

Dispersion: numerical

1.1 Frequency Distribution Tables

Frequency distribution tables: effective way to describe a single variable  listing of values for a variable with the number of observations for each value  method for summarizing both categorical variable and numerical variables with limited distinct values Frequency distribution: number of observations that falls within each class Relative frequency distribution: percentage representing the proportion of observation falling in a certain category relative to the total number of observations Cumulative frequency distribution: percentage of units on which we observe a variable value smaller than or equal to the considered one (percentage of units fallin in a category up to the considered value) Frequency distribution table of variable PPREG

Open YPPS file on stata > compute tab PPREG

Observations: Variable measures the respondents region of residence Mid-Atlantic's frequency: 384 respondents Relative frequency: 13.16% of the total number of

Observations grouped into intervals – classes

  1. We want to collapse Q1_DAYS values and create a new variable Q1_recoded that splits the respondents into 3 groups
  • those using a computer up to 3 days a week
  • those using a computer 4 or 5 days a week
  • those using a computer 6 or 7 days a week In this case the (non missing) values are not labeled so in this case we produce three categorical variables (≠ from the previous case in which we only collapsed into 2 groups) we transform numerical intensity into classes, maintaining ordering (but reducing details)

command: generate Q1_recoded=recode(Q1_DAYS, 3, 5, 7)

to check: codebook Q1_recoded

Q1_recoded is unlabeled Values of Q1 are unlabeled

Variable's command: label variable Q1_recoded "Number of Computer days by classes"

Value's commands (2 steps procedure: define and assign):

  • label define Q1_labels 3 "Up to 3 days" 5 "4 or 5 days" 7 "6 or 7 days"
  • label values Q1_recoded Q1_labels

to check: codebook Q1_recoded

Variable transformation - mathematical transformation

Generation of an additive index:

Generate a new variable named digital_access given by the sum of the variables

Q1_DAYS, Q2_DAYS, Q3_DAYS, Q4_DAYS

command: generate digital_access = Q1_DAYS + Q2_DAYS + Q3_DAYS + Q4_DAYS

*exercise: you can redo all the previous steps in the new variable

Charts

Bar chart: variables with few values Histogram: numerical variables taking several distinct values x-axis: distinct values (or levels) - same length y-axis: relative frequencies (%)

command: histogram Q9, discrete percent

If sample is odd: median position is in the middle (n+1)/ If sample is even: median position is anywhere (any value) between the two in the middle

  • for numerical variables: arithmetic average of the two middle obs. is often used as the median From frequency distribution table:
  • Cumulative frequency equal to 0.5 at one value: median can be any value between that value and the next one
  • Cumulative frequency not equal to 0.5 at any value: the first value that exceeds 0.5 is considered the median As a convention: the median is the first value at which the cumulative frequency is equal to or exceeds 0. Mean Mean: arithmetic average of all variable values Suited only for numerical variables x 1 , ..., xn = observed values of a given variable (on the n units of sample - ex. n people on the sample) The difference between each observed value and the mean: deviation
  • Positive --> value above the mean
  • Negative --> value below the mean Consider the following function:

Each term in the sum represents the squared difference of an observation from a

The sum provides the overall measure of how far all the observations are from a

Best a: the one that minimize the most the function --> the mean! (--> effective summary of the data) From frequency distribution table:

  • Sum of values times their absolute frequencies, all divided by the number of observations
  • Weighted average of the distinct values --> weights = percentages (relative frequencies)  sum of values times their relative frequencies Outliers: unusual (strange) values --> observations that falls far above or below the majority of the data

Median vs Mean

Strange values (unexpectedly high or low) have a huge impact on the mean Median --> based on frequencies --> not influenced by such extreme values Median more robust than the mean in the presence of unusual values

1.3 Measures of Location

Measures of location: specify the position of a value relative to all other values

  • Quartile
  • Percentile Suited for ordinal categorical and numerical variables (calculation relies on the ability to rank)

The range Range: difference between the maximum and the minimum value Outliers strongly affect the range The interquartile range The interquartile rage: difference between the 75 th^ percentile and the 25 th^ percentile It measures the spread of the 50% central part of the distribution Variance and standard deviation Variance: average of the squared deviations. Is the overall measure of the distance of each observation from the mean It capture the dispersion (or variability) of a variable It is always positive If all values are the same  they are all equal to the mean  variance = 0 The greater the variance, the more dispersed (the higher the variability is) the values are around the mean

s

2

( x 1 − x )

2

+( x 2 − x )

2

+ …+( x n − x )

2

n − 1

The standard deviation is the square root of the variance  the latter is not expressed in the same unit as the original value, this can be resolved with the standard deviation, that is expressed using the same unit of measurement as the variable.

s =

( x 1 − x )

2

+( x 2 − x )

2

+ …+( x n − x )

2

n − 1

To find: The mean and standard deviation

Command: summarize var_name

The variance and percentile

Command: summarize var_name, d

The coefficient of variation The coefficient variation is computed for variables taking positive values

Standard deviation

Mean

CV =

s

x^ ´

It expresses the standard deviation as percentage of the mean When comparing variability of two variables (particularly if they have different means) comparing their variances or standard deviations directly may not be appropriate Coefficient of variation allows us to compare the variability of two positive variables (regardless of their units of measurements or differences in their means)

1.5 Shape of a distribution

(In case of numerical variable) We can assess the shape of a variable by plotting a histogram or a boxplot If the histogram shows:  Data below the central value is a mirror image of the data above it: symmetric

Left-skewed o Median – Q1 > Q3 – median o Q1 – minimum > maximum – Q Frequency is low for low value, high for high value Mean pulled downward by low value, median unaffected Mean < median Introduction to STATA and its use for describing data on one variable Commands:

o Describe : provides a description of the dataset including the number of

observations, number of variables , size, date the dataset was created For each variable it provides a description in terms of storage type, format and variable lable

o Codebook : more detailed information on each variable, in terms of type, range of

values, number of missing values, value labels and counts for each value

o Label : create label as a legend for numerical values of a variable and for the

variable itself.

o Labeling variable: label variable variable_name "new_variable_name"

o Labeling values is a two-step process:

  1. Define a label and give it a nickname:

label define label_name numeric_code1 “label11” numeric_code2 “label12”

2. Assign the defined label to the variable: label values variable_name

label_name

Example: o label variable Q1_recoded "Number of Computer Days by Classes" o label define Q1_labels 3 "Up to 3 days" 5 "4 or 5 days" 7 "6 or 7 days"

label values Q1_recoded Q1_labels

o Recode : transforms a variable to another by combining the values of the original

variable into smaller categories: recode old_variable (old_code1=new_code1 “value

label1”) (old_code2=new_code2 “value label2”), gen(new_variable)

Example: o recode Q11 (1/2=0 “rarely”) (3/5=1 “often”) (.=.), generate(Q11_recoded)

o Generate : alternative to recode: generate variable_name=recode(variable_old,

max1, max2, max3)

Example: o generate Q1 recoded=recode(Q1_DAYS,3,5,7) o Generate is useful when you need to generate new variable by applying a mathematical function to one or more variables in the dataset:

generate variable_new=function(var1,var2,…)

Example: o generate digital_access=Q1_DAYS + Q2_DAYS + Q3_DAYS + Q4_DAYS

o tabulate : delivers the frequency distribution table of variable: tabulate var_name

o Mean : you can use two commands

o mean var_name

o summarize var_name

o Summarize, d : summarize with the detail option delivers percentiles, variance

and standard deviation: summarize var_name, detail

o Histocram, d percent : this option delivers a bar chart histogram var_name, d

percent

o Histogram, percent : this option delivers an histogram. The option bin can be

added to specify the number of intervals histogram var_name, percent

bin(number)

o Graph box : this option delivers a box plot: graph box var_name

Bivariate Descriptive Analysis

2.1 Describing association between two variables

Statistical techniques used to assess the association between two variables within a sample. We approach this evaluation from an asymmetric perspective Dependent variable: variable measuring the concept we aim to explain Independent (explanatory) variable: variable measuring the concept identified as a potential determinant of variation in the dependent variable Two scenarios:

  1. Dependent and independent variable are both categorical
  2. Dependent variable is numerical and independent variable is categorical Independent variable always categorical  it divides the sample into groups based on its observed levels. We assess association by comparison
  • If association: comparing behavior of the dependent variable across these groups reveals differences Methods of comparison depends on the type of dependent variable:
  • Dependent variable is categorical  compare frequency distribution across groups
  • Dependent variable is numerical  compare means across groups YPP survey: report claims that engagement in participatory politics can be explained by participation in interest-driven online activities We have to examine the association between the two variables one measuring participation in interest-driven online activities (Q11) and the other participation in participatory politics (Q40) Goal: assess whether there is association between the two variables Q40  dependent (categorical) Q11  independent (categorical)

Q40 2 levels: yes, no Q11 5 levels: never, less than once a month, at least once a week, daily We assess association by comparing the behavior of Q40 (dependent) in the 5 groups of Q Since the dependent is categorical  behavior within each group is described by a frequency distribution Create the table with the distribution of Q40 in the five groups determined by Q Command:

tab dependent_var_name independent_var_name, col

tab Q40 Q11, col Each column is labelled after a value of the independent variable and reports the distribution of the dependent variable in the group of respondents on which the value is observed In the group of those who never post (…) 6% answer they commented on a news story about political campaign. In the group of those who daily post (…) 32.82% answer they commented. These two groups of Q11 exhibit different behavior with respect to variable Q There is an association between the two variables at the sample level! Let’s create a numerical index to measure engagement in participatory politics activities This index will count the number of participatory political acts typically performed by a respondent. We need to record the variables Q36 to Q41 and from Q43 to Q45 in such a way to take value 1 in case of a “yes” and 0 in case of a “no” (these variables are different political acts). In this case we generate 9 dummy variables