Stats1 Definitions and Variables
Total Page:16
File Type:pdf, Size:1020Kb
Stats1 Definitions and Variables Evan Misshula 2020-01-31 Evan Misshula Stats1 Definitions and Variables 2020-01-31 1 / 73 Outline 1 Data Management and Descriptive Statistics 2 Two graphs Evan Misshula Stats1 Definitions and Variables 2020-01-31 2 / 73 Topics Topics for masters statisics 1 Frequency Distribution Presentation, & Central Tendency I 2 Measures of Dispersion 3 Data Distribution and Variance 4 Hypothesis Testing Unit of Analysis 5 Basic Probability, Inference 6 Significance Tests Evan Misshula Stats1 Definitions and Variables 2020-01-31 3 / 73 Topics Continued Topics for masters statisics II 1 Chi Square, Expected values & Mean Testing Continued 2 Analysis of Variance (ANOVA) 3 Associations Nominal and Ordinal Data, Bivariate Correlation, 4 Pearson’s r and Spearman’s Rho 5 Bivariate Regression 6 Multiple Regression Evan Misshula Stats1 Definitions and Variables 2020-01-31 4 / 73 Variables Definition (Variables) Variables are characteristics that change from person to person or object to object in a population of interest Variables can take different values or levels They are called variables because they vary between cases Each variable has a level of measurement. Evan Misshula Stats1 Definitions and Variables 2020-01-31 5 / 73 The four levels are: Nominal Ordinal Interval Ratio There are four levels of measurement Measurement Levels of Measurement Each variable has a level of measurement. The level of measurement is important because it determines the type of analysis. Evan Misshula Stats1 Definitions and Variables 2020-01-31 6 / 73 The four levels are: Nominal Ordinal Interval Ratio Measurement Levels of Measurement Each variable has a level of measurement. The level of measurement is important because it determines the type of analysis. There are four levels of measurement Evan Misshula Stats1 Definitions and Variables 2020-01-31 6 / 73 Nominal Ordinal Interval Ratio Measurement Levels of Measurement Each variable has a level of measurement. The four levels are: The level of measurement is important because it determines the type of analysis. There are four levels of measurement Evan Misshula Stats1 Definitions and Variables 2020-01-31 6 / 73 Measurement Levels of Measurement Each variable has a level of measurement. The four levels are: The level of measurement is Nominal important because it Ordinal determines the type of Interval analysis. Ratio There are four levels of measurement Evan Misshula Stats1 Definitions and Variables 2020-01-31 6 / 73 Hierarchy of measurement Evan Misshula Stats1 Definitions and Variables 2020-01-31 7 / 73 Nominal Variable Categorical, Nominal or Qualitative data The word nominal means names A nominal variable ONLY describes something The only fuction is to label and categorize NO INHERENT NUMERIC QUANTITY, NO Ranking of levels or ordering scheme Numbers can be nominal level if there is no quantity associated with them. Categories should be distinct, mututally exclusive, and completely exhaustive Evan Misshula Stats1 Definitions and Variables 2020-01-31 8 / 73 Nominal Variable Examples Examples Sex Religious Affiliation Race Zip code State Evan Misshula Stats1 Definitions and Variables 2020-01-31 9 / 73 Ordinal Variables Definition (Ordinal Variables) Ordinal variables have a ranking The root of Ordinal is “Ord” for order The exact amount of difference is unknown rank in most wanted Evan Misshula Stats1 Definitions and Variables 2020-01-31 10 / 73 Ordinal Variable Examples Examples rating at a restaurant rank in the police department letter grade Service ratings 1=Poor 2=Fair 3=Good 4=Excellent Evan Misshula Stats1 Definitions and Variables 2020-01-31 11 / 73 Interval variables Definition (Interval variable) Interval Variables have inherently numeric values We can talk about the difference between two items Evan Misshula Stats1 Definitions and Variables 2020-01-31 12 / 73 Interval Variable Gotcha Interval Variable Gotcha Temperature has difference ’0’ is arbitrary Does not indicate that there is no temperature Evan Misshula Stats1 Definitions and Variables 2020-01-31 13 / 73 Ratio Variables Ratio Variables the same as interval but with a true 0 Number of children Age Prior Arrests Commute time Evan Misshula Stats1 Definitions and Variables 2020-01-31 14 / 73 Variable Type Dependent and Independent Dependent Variable is what you are trying to predict Independent is what you are using There are many names for each Evan Misshula Stats1 Definitions and Variables 2020-01-31 15 / 73 Other names for dependent variables Synonyms for Dependent outcome response Evan Misshula Stats1 Definitions and Variables 2020-01-31 16 / 73 Other names for independent variables Synonyms for Independent feature explanatory causal control Evan Misshula Stats1 Definitions and Variables 2020-01-31 17 / 73 Validity and Reliability Definition (Validity) Validity: Addresses the question of whether the variable used actually reflects the concept or theory you seek to examine. Reliability: A measure is reliable if it is consistent and stable. stable is if it remains the same when measured in the same group reliable is if the same person in different groups will score similarly Evan Misshula Stats1 Definitions and Variables 2020-01-31 18 / 73 Univariate Descriptive Statistics Univariate descriptive statistics describes one variable Univariate statistics is composed of: Central Tendency Measures of Dispersion Form of the distribution Evan Misshula Stats1 Definitions and Variables 2020-01-31 19 / 73 a batting average a shooting percentage an average length of stay for pretrial detention a median income for a zip code Definition of a statistic Example (Example statistics) Definition (What is a statistic?) A statistic is one number that summarizes many numbers Evan Misshula Stats1 Definitions and Variables 2020-01-31 20 / 73 a shooting percentage an average length of stay for pretrial detention a median income for a zip code Definition of a statistic Example (Example statistics) a batting average Definition (What is a statistic?) A statistic is one number that summarizes many numbers Evan Misshula Stats1 Definitions and Variables 2020-01-31 20 / 73 an average length of stay for pretrial detention a median income for a zip code Definition of a statistic Example (Example statistics) a batting average Definition (What is a statistic?) a shooting percentage A statistic is one number that summarizes many numbers Evan Misshula Stats1 Definitions and Variables 2020-01-31 20 / 73 a median income for a zip code Definition of a statistic Example (Example statistics) a batting average Definition (What is a statistic?) a shooting percentage A statistic is one number that summarizes many numbers an average length of stay for pretrial detention Evan Misshula Stats1 Definitions and Variables 2020-01-31 20 / 73 Definition of a statistic Example (Example statistics) a batting average Definition (What is a statistic?) a shooting percentage A statistic is one number that summarizes many numbers an average length of stay for pretrial detention a median income for a zip code Evan Misshula Stats1 Definitions and Variables 2020-01-31 20 / 73 The measure of central tendency you choose depends on the level of measurement of the variable Measures of Central Tendency (MCT) Goal of Central Tendency We want the single best number that describes typical case Evan Misshula Stats1 Definitions and Variables 2020-01-31 21 / 73 Measures of Central Tendency (MCT) Goal of Central Tendency We want the single best number that describes typical case The measure of central tendency you choose depends on the level of measurement of the variable Evan Misshula Stats1 Definitions and Variables 2020-01-31 21 / 73 Three measures Mean, Median and Mode Definition (Mode) The mode is the most frequently occurring value It is the only MCT appropriate for Nominal Data Evan Misshula Stats1 Definitions and Variables 2020-01-31 22 / 73 Median Definition (Median) The median is the value in where half the values are greater and half are less Evan Misshula Stats1 Definitions and Variables 2020-01-31 23 / 73 Mean Definition (Mean) The mean is the sum of the values divided by the number of values Evan Misshula Stats1 Definitions and Variables 2020-01-31 24 / 73 Calculate the Mode Calculation example rdata <- c() rdata <- c(2, 3, 3, 4, 5, 5, 5, 6, 6, 6, 7, 7) rdata <- c(rdata,7, 7, 8, 8, 8, 9, 9, 10) table(rdata) table(rdata)[order(table(rdata),decreasing=TRUE)] rdata 2 3 4 5 6 7 8 9 10 1 2 1 3 3 4 3 2 1 rdata 7 5 6 8 3 9 2 4 10 4 3 3 3 2 2 1 1 1 Evan Misshula Stats1 Definitions and Variables 2020-01-31 25 / 73 Median Median is the value that splits the distribution into two equal parts often used with distributions that are skewed or have outliers myMedian <- function(x) { x1 <- x[order(x,decreasing = F)] l <- length(x) if(l %% 2 == 0) { return( .5*(x1[.5*l]+x1[.5*l+1])) } else { return( x1[(l+1)/2]) } } Evan Misshula Stats1 Definitions and Variables 2020-01-31 26 / 73 Testing the median function Do we get the same result for our own median function as the one built into R median(rdata) myMedian(rdata) [1] 6.5 [1] 6.5 Evan Misshula Stats1 Definitions and Variables 2020-01-31 27 / 73 Mean Mean is also known as the average Only for Interval or Ratio level data Assumes order and equality of intervals Very sensitive to outliers and skew P X X = n myMean <- function(x) { myMean <- sum(x)/length(x) return(myMean) } mean(rdata) myMean(rdata) [1] 6.25 [1] 6.25 Evan Misshula Stats1 Definitions and Variables 2020-01-31 28 / 73 You need to understand what you are describing/modeling textbook answer use the median in presence of skew and outliers