





















Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!






















These notes are addressed to students of the course in Quantitative Methods (Module II Statistics ) of the Bachelor in International Politics and Government. They are not meant to exhaust all topics of a first course in Statistics and are no more than a transcript of the class lectures.
The notes follow the course structure and are divided into three parts. The first part introduces students to statistical techniques that make it possible to provide a description of data collected on one characteristic of interest and to study the association between two characteristics. The second part discusses the methods that let make inferences on one single parameter and on the association between two variables. Finally, the third part is devoted to regression analysis, discussing the simple and the multiple linear regression model.
Students are as well introduced to the use of STATA for running descriptive analyses, basic inferential analyses and fitting simple and multiple linear regression models. At the end of each topic, a section reports and describes the STATA commands for implementing the described techniques.
In this course, we introduce students to basic statistical techniques, through a discussion of their theoretical properties and their application to secondary data. Secondary data are data collected by other researchers for the purposes of their analyses. We do not discuss the techniques at the basis of a collection of primary data for lack of time. In particular, we do not discuss the methods for designing a questionnaire design methods and the sampling techniques for the selection of the group of entities to which administering the questionnaire. However, in the following we describe the main steps of the measurement process.
Data are the result of a quantitative measurement process. In social and political sciences, a survey is the main tool used for measuring. Frequently, in political science we need to measure concepts as ideas or mental constructs that we use to represent phenomena in the word. Some concepts are complicated, while others are somewhat simpler. In general, political concepts are vague. We need to transform concepts into concrete terms so to be able to measure them. The first step of any measurement process is then a definition of the concept. A conceptual definition specifies the units of analysis to which the concept applies and describes the properties of the concept that we can measure. Below a template of conceptual definition
The concept of name of the concept is defined as the extent to which unit of analysis exhibits the characteristic of characteristic that varies from one unit to another.
A unit of analysis (referred to as statistical unit) is the entity we want to measure the concept on. Units of analysis can be individual levels or aggregate levels. Individual level units are the lowest possible level for measuring a concept: persons in a survey research, bills in a study on legislation, party platforms when studying political themes. Data collected on individual levels unit are referred to as micro data. Aggregate level units are collection of individual entities: schools, universities, enterprises, cities, countries. Data collected on aggregate levels unit are referred to as macro data.
The identification of a varying characteristic, that helps measuring a concept, is a difficult task. To this aim, it is useful to think of polar opposites. Assume we want to measure political tolerance on individuals. Let think at two people who are polar opposites with respect to the concept of political tolerance. Below an example of the results of a first brainstorming on political tolerance.
analysts were gauging information on “Tolerance towards leftist groups”. There was a systematic measurement error in the adopted strategy.
A measurement strategy is evaluated in terms of its reliability and validity. A measurement strategy is reliable if it gives always the same reading, when used. It is a consistent measure of the concept and free of random measurement error. A measurement strategy is valid if it records the true value of the intended characteristic. It does not measure any unintended characteristics, it is then free of any systematic measurement error. Statistical methods make it possible to assess the reliability and validity of a measurement strategy.
Let continue, in this introduction to the course, to set-up a bit of statistical terminology. We call variable the result of a quantitative measurement of a characteristic of interest. Each survey’s question generates a variable, measuring a characteristic on a given respondent. The measurement strategy determines the degree of precision with which a variable measures a characteristic. According to the level of measurement, we distinguish two kinds of variables: categorical and interval levels or numerical variables.
Categorical variables take on not numerical values, so to describe membership of a group or category. The values taken by a categorical variable are also referred to as levels or factors. We distinguish two kinds of categorical variable: nominal and ordinal. Nominal categorical variables take on values that are not numbers and that we cannot rank. They communicate differences in the units of analysis with respect to the characteristic of interest: for any two units we can only say whether they have the same value of the variable or not. The following questions with closed ended answers generate nominal categorical variables.
Ordinal categorical variables take on values that are not numerical, but can be ranked. They communicate the relative amount of the measured characteristic. The following questions with closed ended answers generate ordinal categorical variables
Interval level or numerical variables take on numerical values, providing a numerical measure of the size or extent to which a unit has a characteristic. We distinguish two kinds of numerical variables: discrete and continuous. A numerical variable is discrete when it takes on a finite number of values or infinite but countable. The following open-ended questions generate discrete numerical.
Numerical continuous variable can take any value between any two numbers. The following open-ended questions generate continuous numerical variables.
Note that the variables’ kind is not an a priori. It depends on the measurement strategy. The same characteristic or concept can be measured in different ways, thus generating different kinds of variables. Assume that we want to measure age. The open-ended question: “Which was your age at the last birthday?” gives rise to a numerical variable.
The closed ended question “Which was your age at the last birthday?” with possible answers, Lower than 25, between 25 and 35, between 36 and 45, between 46 and 55, higher than 55, generates a categorical ordinal variable measuring age as well.
The identification of the kind of a variable is straightforward, but crucial. As we are going to study not all statistical techniques can be applied to all kind of variables. The kind of the variables dictates the kind of statistical techniques that we can use to analyze it.
In the YPP questionnaire, digital social capital is measured by means of closed-ended questions asking the respondent how often he/she has done one of the above online activities in the last year. The possible answers to the questions are never, less than once a month, at least once a month, at least once a week, daily. The generated variables are all categorical ordinal.
Along with the two groups of variables measuring participatory politics and digital social capital, in the YPPS database we find, several other variables. Among others we might mention those measuring institutional access to digital technology and political information, institutional participation in politics, personal traits and socio- demographic characteristics as age, sex, level of education.
Section 1 Describing data through frequency distribution tables
Any analysis starts from the description of the sample data. In the following, we introduce the techniques that let describe the behavior at the level of the sample of one variable and the joint behavior of any two variables. In this second case, the aim is to assess if any relationship exists between them at the level of the sample.
Frequency distribution tables provide the best description of one variable, whenever it takes few values. They are the first choice for describing categorical variables and interval level variables taking few distinct values. Three columns make up a frequency distribution table. The first one displays the observed distinct values of the variable, the second column the absolute frequencies or counts as the number of units on which each value is observed and the last column delivers the relative frequencies or percentages as the percentage of units on which each distinct value is observed out of the total number of valid cases.
Below the frequency distribution table of the variable PPREG
Table 1: Frequency distribution of PPREG
The variable measures the respondents region of residence. There are 134 respondents living in New England, this forming 4.59% of the total number of respondents. As we can see from the table, by default STATA provides along with absolute and relative frequencies also cumulative frequencies for each distinct value. For each value the cumulative percentage is the percentage of units on which we observe a variable value smaller than or equal to the considered one. For each value the cumulative percentage is the percentage of units falling in a category up to the considered value. Cumulative percentages provide useful information only in the case of variables taking values that we can rank. In the considered case, we cannot comment on the last column of the table.
Below the frequency distribution of the variable Q63 generated by the question “How many days in the last week did you get news and information about political or social issues from the a portal website like GoogleNews or Yahoo home page that gathers news from different sources?”.
Table 2 Frequency distribution of Q
64.79% of the respondents answer they got news from a portal website a number of days smaller than or equal to 2.
Section 2 Measures of central tendency
A frequency distribution table delivers a complete description of a variable taking a manageable number of distinct values. However, usually, we rely also on synthetic measures for describing the sample behavior of a variable. Such synthetic measures can be seen as a typical variable level in the case of a categorical variable, a typical or average number in the case of a numerical variable. For this reason they are called measures of central tendency. How to measure the central tendency of a variable depends on the variable type. There are three measures of central tendency: the mode, the median and the mean.
The mode is the level or value of a variable observed with the highest frequency. It is a typical value in the sense of being the value most observed in the sample. Since worked out based on the frequencies we use it to describe the behavior of any variable for which it is worth deriving a frequency distribution. It is the unique measure of central tendency for nominal variables.
Below the frequency distribution table of the variable Q9, generated by the question “Thinking about your major interests, how often do you typically look online for news, information or media related to your interests?”.
Since each term (𝑥𝑥𝑖𝑖 − 𝑎𝑎)^2 can be seen as a measure of distance of the observation from a , their sum provides an overall measure of distance of all observations from a. It can be show that the mean is the value at which the function reaches its minimum. The mean is the value that has the smallest distance from the observations, in this sense it provides a good summary of the data.
The mean of Q63 is 1.7, on average the respondents get news from a website portal 2.04 days a week.
Since the mean is computed using all values, strange values as unexpected high or low values affect the mean value. Since the median is computed based on the frequencies, strange values (having therefore low frequencies) do not affect the median value. The median is said to be more robust than the mean against strange values called outliers. We call outlier an observation that falls well above or well below the bulk of data.
Section 3 Measures of location
Along with measures of central tendency, we can describe the sample behavior of a variable by means of measures of location, specifying the position of a value with respect to all other values. Measures of location are quartiles and percentiles. They can be computed for ordinal categorical and interval level variables, since their computation is based on the possibility of ranking the values.
Quartiles divide the set of observations in four quarters. The first quartile, Q 1 is the value such that approximately a quarter of the observations is smaller. It is also referred to as lower quartile. The second quartile Q 2 is the median. The third quartile Q 3 is the value such that approximately three quarters of the observations are smaller. It is also referred to as upper quartile.
The p th^ percentile is the value such that approximately p% of cases fall below. The 25th^ percentile is the value such that approximately 25% (a quarter) of cases fall below. It is the first quartile. The 75 th^ percentile is the value such that approximately 75% (three quarter) of the observations fall below. It is the third quartile. Percentiles are worked out as the median from the cumulative percentages. The p th^ percentile is the value at which the cumulative percentage is equal to p% or the first value at which the cumulative percentage goes above p%.
Going back again to Table 2, we have that the lower quartile or 25 th^ percentile of Q63 is 0, while the upper quartile or 75 th^ percentile is 4. Round 75% of the respondents report they get news from a website portal at most 4 days.
Section 4 Measures of variability
The measures of central tendency provide a summary through a unique value of the entire frequency distribution of a variable. However, when describing the sample behavior of a variable we cannot stop at measuring the measures of central tendency We need to describe also the variability or dispersion of the variable as an additional distinctive feature of the variable’s behavior, giving an answer to questions as
In the case of a categorical variable the only way for assessing variability is to inspect the frequency distribution. Synthetic measures of dispersion can be worked out only for interval level variables.
In the case of categorical variables, the assessment of dispersion or variability is done through an inspection of the frequency distribution. We need to assess how the frequencies (percentages better) are distributed across the variable
values. We can identify two extreme situations and use them as benchmarks. All units fall only on one category: only one value is observed, with frequency 100%, the variable has no dispersion. The values are observed with exactly the same frequency, the variable has the highest dispersion.
Below the frequency distribution table of the variables Q8, generated by the question “How often would you say you interact with family and friends using a mobile phone?” and Q12 generated by the question “Thinking about your major interests, how often do you give help, advice or suggestions to others
related to your interests?”.
Variable Q8 shows a lower variability, with more than 80% of the respondents answering at least once a week or daily.
We consider four synthetic measures for describing variability of an interval level variable: the range, the interquartile range, the variance and the standard deviation. The range is the difference between the maximum and the minimum value. Referring again to Table 2, the range of variable Q58 is given by 7-0=7. Outliers strongly affect the range, that uses only the maximum and the minimum value to measure variability.
The interquartile range is the difference between the 75 th^ percentile (third or upper quartile ) and the 25th^ percentile (first or lower quartile). The interquartile range measures the spread of the 50% central part of the distribution. Since the lower quartile or 25 th^ percentile of Q58 is 0, while the upper quartile or 75 th^ percentile is 4, the interquartile range is 4.
The variance of a variable is defined as follows
𝑠𝑠 2 =
(𝑥𝑥 1 − 𝑥𝑥̅)^2 + (𝑥𝑥 2 − 𝑥𝑥̅)^2 + ⋯ + (𝑥𝑥𝑛𝑛 − 𝑥𝑥̅)^2 𝑛𝑛 − 1
The variance is an average of the squared deviations. It can be seen as an overall measure of the distance of each observations from the mean. The variance measures the dispersion or variability of a variable as the spread around its mean. It is always positive. If all values are equal, they are equal to the mean and the variance is equal to 0. The higher the variance, the higher the spread or dispersion of a variable around its mean.
The variance does not have the same unit of measurement of the variable values, but its square. The standard deviation is the square root of the variance and therefore expressed in the same unit of measurement of the variable.
𝑠𝑠 = �
(𝑥𝑥 1 − 𝑥𝑥̅)^2 + (𝑥𝑥 2 − 𝑥𝑥̅)^2 + ⋯ + (𝑥𝑥𝑛𝑛 − 𝑥𝑥̅)^2 𝑛𝑛 − 1
The variance of variable Q63 is 6.105 and the standard deviation 2.471.
Below the boxplot of the variable digital_access is reported. As we can see there is only one outlier.
Section 6 Shape of a distribution
In the case of a numerical variable, a third feature of the variable’s frequency distribution that we have to describe is its shape. We can assess the shape of a variable by plotting a histogram or a boxplot.
Let begin by reading the information that the histogram provides. When the histogram is such that the side below the central value is a mirror of the side above (observations are symmetrically distributed around the centre) the distribution is said to be symmetric. When the histogram shows a tail on the right, the distribution is said to be asymmetric on the right, skewed-right or positively skewed. When the histogram shows a tail on the left, the variable is said to be asymmetric on the left, skewed-left or negative skewed.
Below the histogram and the boxplot of a bell-shaped distribution, typical symmetric distribution.
0
10
20
30
digital_access
Outside values, outliers
Upper Adjacent Value (1.5 x interquartile range)
75 thpercentile, upper quartile median
25 thpercentile, lower quartile
Lower Adjacent Value (-1.5* interquartile range) Outside value, outlier
box
upper whisker
lower whisker
In the case of a bell-shaped distribution, the difference between the first quartile and the minimum is equal to the difference between the second quartile and maximum. As well, the difference between the median and the first quartile is equal to the difference between the third quartile and the medium. Finally, the difference between the median and the first quartile is smaller than the difference between the first quartile and the minimum, and the difference between the third quartile and the median is smaller than the difference between the maximum and the median.
Below and the boxplot of a right-skewed distribution.
The median is closer to the first quartile rather than the third quartile, the lower whisker is shorter than the upper whisker.
Below the histogram and the boxplot of a left-skewed distribution.
Let open the dataset YPPS.dta, by clicking on the corresponding toolbar icon or though File/Open. The dataset can be inspected by clicking on the widening lent icon of the toolbar or through Data/Data Editor/Data Editor (browse). The dataset is stored as a spreadsheet of data, with variables on the column and units on the row. We are going to run the analysis by entering the commands in the command window. We enter any command through the command name followed by the variable or the variables name and options are entered after a comma.
STATA scripts as files with a list of commands are named do files after the file extension. The editor window can be
opened by clicking on the corresponding toolbar icon. Each command is written on a separate line. To run a command (or a selection of commands), click on the row (or rows) so to select the command(s) where the command
is written or highlight everything and click on the icon. The results appear on the result window, but are not
stored. To store all the results of a work session, a log file can be created, by clicking on the corresponding icon. In this way a text file is created, storing all what appears in the result window.
The command describe and codebook return general information on the dataset and stored variables. describe provides a description of the dataset including the number of observations, the number of variables, the size, the date the dataset was created. For each variable it provides a description in terms of storage type, format and variable label. codebook provides more detailed information on each variable, in terms of type, range of values, number of missing values, value labels and counts for each value.
The command label makes it possible to create a label as a legend for the numerical values of a variable and as well for the variable. Labelling values is a two-steps process.
Let consider the variable Q11_nolabels. Let attach the labels to the numerical values
label define Q11_labels 1 “Never” 2 “Less than Once/Month” 3 “At least Once/Month” 4 “At least Once/Week” 5 “Daily”
The command recode transforms a variable so to create a new variable by combining the values of the original variable into a smaller number of useful categories (levels/values). The syntax is
recode old_var (old_code(s) = new_code “value label”), gen(new_var)
As an example let recode variable Q11. Q11 takes on 5 levels, and therefore it divides the respondents into 5 groups, according to how often they post link to or forward information or media related to their interest. Let create a new variable named Q11_recoded that collapses Q11 levels in two values, rarely (values 1-2) and often (values 3-5). Let code by 1 those who post link to or forward information or media related to their interest at least once a month or at least once a week or daily. Let code by 0 all other respondents. Q11_recoded is binary and takes values 0 or 1.
recode Q11 (1/2=0 “rarely”) (3/5=1 “often”) (.=.),gen(Q11_recoded)
The general syntax for adding a label to a variable is
label variable var_name “variable label”
Let add a label to the variable Q11_recoded.
label variable Q11_recoded “interest driven online activity”
recode can be used to collapse an interval level variable. However the generate command with recode is a powerful alternative. The general syntax is
generate var_new=recode(var_old, max1, max2, max3)
where max1, max2... are the upper bounds of the values interval to collapse.
Let 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 up to 4 or 5 days a week, those using a computer up to 6 or 7 days a week. The new variable Q1_recoded is categorical ordinal.
generate Q1_recoded=recode(Q1_DAYS,3,5,7)
By default, the new variable values are the upper bounds of the original value intervals, so that labels need to be added.
The generate command has to be used whenever we need to generate new variables by applying a mathematical function to one or more variables in the dataset. The general syntax is
generate var_new= function(var1, var2,…)
Let generate the variable digital_access given by the sum of the variables Q1_DAYS, Q2_DAYS, Q3_DAYS, Q4_DAYS and measuring respondents access to digital technology.
generate digital_access=Q1_DAYS+ Q2_DAYS+ Q3_DAYS + Q4_DAYS
The tabulate command (with abbreviation tab) delivers the frequency distribution table of a variable. The syntax is
tabulate varname
The mean is worked out in STATA through the commands mean and summarize. The syntax is
Let go back to the YPP survey. In the YPPS Executive Summary we read “Interest-driven online activities appear to lay a foundation for engagement in participatory politics”. The report claims that engagement in participatory politics can be explained by participation in interest-driven online activities. The explanation is translated into the following hypothesis: “there is association between participation in interest-driven online activities and engagement in participatory politics”. In order to empirically validate the hypothesis, we have to inspect the association between two variables one measuring participation in interest-driven online activities and the other participation in participatory politics
Let begin by measuring engagement in participatory politics by means of the variable Q40 and participation in interest-driven online activity by Q11. Indeed, Q40 is generated by the question: During the past 12 months, please tell me whether you have commented on a news story or blog you read online about a political campaign, candidate or issue. Q11 is generated by the question: How often you typically post, link to or forward information or media related to your interests?
We have to assess whether there is association between the two variables. Variable Q40 is the dependent variable and Q11 is the independent variable. Both variables are categorical. Q11 takes five levels, never, less than once a month, at least once a month, at least once a week, daily, splitting in this way the sample into five groups. The variable Q40 takes two levels yes and no. We assess the association between the two variables by comparing the behavior of Q40 in the five groups of respondents identified by Q11. Since the dependent variable is categorical as well, its behavior within each group is described by means of a frequency distribution. We investigate on the association between the two variables by inspecting and comparing the frequency distributions of Q40 in the groups determined by Q11.
Below the table with the distributions of Q40 in the five groups determined by Q11.
Table 1 Frequency distributions of Q40 for each level of Q
Each column of Table 4 is labelled after a value of the independent variable and reports the distribution of dependent variable in the group of respondent on which the value is observed.
In the group of those who never post, link to or forward interest’s related information or media 6% answer they commented on a news story or blog they read online about a political campaign. In the group of those who daily post, link to or forward interest’s related information or media 32.82% answer they commented on a news story or blog they read online about a political campaign. The two groups determined by the levels Never and Daily of Q11, behave differently with respect to variable Q40.
The same kind of conclusion can be drawn by considering the percentages of YES answer in the groups determined by the other levels of Q11. The behavior of Q40 is not the same across the groups determined by Q11. There is an association between the two variables at the level of the sample.
Let work out a numerical index of engagement in participatory politics activities that count the number of participatory political acts typically performed by a respondent. Let start by recoding the variables Q36 to Q41 and from Q43 to Q45 in such a way to take value 1 in the case of a YES answer and 0 in the case of a NO answer. In this way we generate 9 dummy variables. The index that we call participatory_index is then obtained as the sum of such dummy variables.
Below the frequency distribution table of participatory_index, the bar chart and synthetic measures are reported.
The distribution is skewed-right, 0 is the lower quartile and the median, 2 is the upper quartile. The sample mean is 1.169.
Let now assess whether there is association between participatory_index and the same variable Q11, measuring participation in interest-driven online activities. The dependent variable is now numerical and its behaviour in the groups of respondents specified by the levels of the categorical independent variable can be summarize by the mean. The association between the two variables can be assessed by comparing the means of participatory_index in the five groups corresponding to the five levels of Q11. Below the means and the standard deviations of participatory_index in the five groups.
Total 2,787 100.
9 11 0.39 100.
8 18 0.65 99.
7 23 0.83 98.
6 52 1.87 98.
5 92 3.30 96.
4 129 4.63 92.
3 194 6.96 88.
2 283 10.15 81.
1 417 14.96 71.
0 1,568 56.26 56.
ry_index Freq. Percent Cum.
participato
. tab participatory_index
0
20
40
60
Percent
(^0 2) participatory_index (^4 6 8 10) 99%95% 85 99 KurtosisSkewness 1.7871695.
90% 4 9 Variance 3. 75% 2 9 Largest Std. Dev. 1.
50% 0 Mean 1.
25% 0 0 Sum of Wgt. 2, 10% 0 0 Obs 2, 5% 0 0
1% 0 0 Percentiles Smallest
participatory_index
. summarize participatory_index,d