1073
Comment:
|
13456
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
Variables in statistics are a lot like variables in algebra or calculus, except that they are typically thought of as having a '''distribution''' of values. For instance, a variable might describe someone's reaction time to a stimulus, but this variable it will be different each time it is measured. So a variable like ''reaction time'' |
= Experimental Design Basics = == Random Variables == Random variables in statistics are a lot like variables in algebra or calculus, except that they represent things that take on random values when sampled from the world. For instance, a variable might describe someone's reaction time to a stimulus, but the value of this variable will be different each time it is measured. A random variable like ''reaction time'' |
Line 9: | Line 12: |
Variables in experiments can be '''continuous''' or '''discrete'''. In | === Continuous vs. Discrete === Random variables in experiments can be '''continuous''' or '''discrete'''. In |
Line 11: | Line 15: |
numbers (e.g. people's height, reaction time). Discrete variables are ones that do not vary continuously. Typical examples in psychology |
numbers (e.g. people's height, reaction time). For continuous variables, the number of possible values it can have between any two given values is infinite; thus, one cannot enumerate their values in order. Discrete variables are variables whose values can be enumerated. Two important types of discrete variable are ordinal variables, often represented by integer values (like number of children in a family) and categorical variables, whose values represent category membership (like type of car or employment status). Most discrete variables used in psychology |
Line 15: | Line 21: |
correct/incorrect. However, it is possible that discrete variables give a potentially infinite number of values, as in counts of how neuron spikes occur in a given amount of time. |
correct/incorrect. However, it is possible that discrete variables have a potentially infinite number of values, as in the number of quanta of light emitted by a light source in a given period of time. == Representing probabilities == === Probability distributions === A discrete random variable X is characterized by a probability distribution, P(X=x). For each possible value x, P(X=x) specifies the probability that the value x will occur or be observed. A simple way to think of this is that observations of X are equivalent to random draws from a hat containing balls labeled with the different possible values of X (the population of X). For any given value x, P(X=x) represents the proportion of balls that have the label x. The sum of P(X=x) over all possible values x is 1. To compute the probability that an observation of X will lie in any particular range (e.g. P(X > 1) or P(-10 < X < 0)), one needs merely sum up the values of P(X=x) for all values x within the specified range. === Probability density functions === A continuous random variable X is characterized by a probability density function, p(x). Technically, p(x) does not represent the probability of X being equal to a particular value x (hence it is not written as p(X=x). This is because the probability of a continuous random variable having any specific value x is actually 0. For continuous variables one can only specify the probability that it will be within a specified range of values; for example, the probability that X > 1 or that -1 < X < 0. p(x) is a function that allows us to calculate these probabilities, specifically, by calculating the area under p(x) for the range of values specified. For example, the probability that any particular observation of X is greater than 1, P(X > 1), is the area under p(x) between 1 and infinity. The probability that X is between -1 and 0, P( -1 < X < 0), is the area under p(x) between -1 and 1. A more intuitive way to think of p(x) is that it specifies the probability that X has a value within a small neighborhood of x. == Populations and Samples == A '''population''' contains all possible instances of a random variable, with the number of occurrences of each instance of the random variable proportional to its probability of occurring. If a random variable X represents the weights of American males, the population of X contains the weights of all American males. One can think of the population of X as the hat from which random observations of X are drawn. A '''sample''' is a collection of particular observations of X. Experimental samples are always sets containing a finite number of samples of X. In an experiment designed to estimate the average reading score of 2nd graders in American public schools, one might sample the scores of 16 randomly chosen 2nd grade students from American public schools. If we let X represent reading scores of 2nd grade students in American public schools, the 16 measured scores would be a sample of X. The population of X would be the reading scores of all 2nd grade students in American public schools. == Summary statistics == Summary statistics provide a way to capture the basic trends in a population or in a sample of data in a concise, informative way. Probably the most common summary statistic is a '''mean''': the mean of a set of numbers gives the ''average'' (intuitively, the typical value) of the sample. Another common measure is the '''variance''', which computes the variability in the sample. So the mean of the heights of everyone in New York would capture the typical value of New Yorker's height and the variance of heights would tell you how much variability there is between New Yorkers. '''Population statistics''' represent the trends in an entire population, while '''sample statistics''' represent the trends in a sample. == Estimators == We can view sample statistics like the mean and variance of a sample as '''estimators''' of the true, unknown population statistics you care about. So the mean computed on the sample ''estimates'' (or approximates) the true mean of the population. Since we usually want to make statements about the true state of the world (men are taller than women) rather than our sample (our sample of men is taller than our sample of women), it's useful to think about using our sample to estimate some true property of the world. Estimates can be '''biased''' or '''unbiased'''. Biased estimators are ones which, intuitively, are expected to give a (perhaps slightly) wrong answer. Unbiased estimators are expected to give the correct answer. As an example, suppose you collected a sample of heights and for some reason threw out the shortest 10 people before computing the mean. The mean you compute will be a biased estimator of the true mean since it will tend to overestimate people's typical height. But, as you get more and more people, the shortest 10 will matter less and less and so the amount of bias will decrease as your sample size increases. For computing variance (or standard deviation), you should remember to use the unbiased estimator of variance, which uses ''N-1'' instead of ''N'' in the denominator. == Dependent vs. Independent Variables == The terms '''dependent variable''' and '''independent variable''' are used to distinguish between two types of quantifiable factors being considered in an experiment. In simple terms, the independent variable is typically the variable being manipulated or changed, and the dependent variable is the observed result of that manipulation. In simple experiments, you manipulate one variable and measure another (hopefully while holding everything else constant). For instance, you might measure people's performance on a test (i) when classical music is playing versus (ii) when no music is playing. Here, the '''independent variable''' (the thing you manipulate) is whether or not music is played (i/ii) and the '''dependent variable''' (the thing you measure) is performance on the test. == Within vs. Across Subjects Experimental Designs== It's important to realize that independent variables can be either ''within'' subjects or ''across'' subjects. When an independent variable is within subjects, it means that each subject is measured within each level of the independent variable (i.e., each subject takes the test with and without music). An across subjects design would have a separate group of subjects for each condition (i.e., one group takes the test with music while a separate group of subjects takes the test without music). In general, within subject designs are more likely to find effects because they control for additional noise---in this case, each subject's typical ability to answer questions on the test. Here is another example of why within designs are more powerful: suppose you were trying to determine if 4th graders were taller than 3rd graders. If you took a sample of a typical 4th grade and a typical 3rd grade class, you would see a highly overlapping distribution of heights. That is, each classes' heights would be highly variable and there would not be much difference in the mean heights, so it would take a lot of samples to find a difference. But suppose you performed the within subjects experiment. You could take 3rd graders and measure their heights, and then wait a year until they were 4th graders, and measured their heights again. Everyone would have grown and you could very easily find a significant result by comparing each child's heights in 3rd and 4th grade. This is a within subjects design because each subject is measured twice, once in each condition (3rd vs. 4th grade), and is clearly much more likely to find an effect that is real. = Choose the Right Statistical Test = In statistical inferences, the "true" populations that you care about are usually assumed to be distributed in a particular way. The most common assumption is that data items in the populations are distributed according to a normal distribution (i.e. the bell curve, also referred to as a Gaussian distribution). Nearly all statistical tests taught in an undergrad statistics class require this assumption to hold. When this assumption does not hold (for example, when your data are not interval variables, you need to think twice about which test to use), another set of tests, which are referred to as non-parametric tests, should be used. Although in most BCS lab courses it is rare to encounter a situation where the normality assumption does not hold, keep in mind that the t-test, for instance, does not apply everywhere. The following table may be helpful in ensuring you choose the correct statistical test for your experimental data. || ||||||'''Data Type'''|| ||'''Goal'''||Measurement (from Gaussian Population)||Rank, Score, or Measurement (from Non-Gaussian Population)||Binomial/Binary (Two Possible Outcomes)|| ||Describe One Group||''Mean'', ''SD''||''Median'', ''interquartile range''||''Proportion''|| ||Compare One Group to Hypothetical Value||''[[OneSampleOneVariable#t-test|One-sample t-test]]''||''Wilcoxon test''||''Chi-square test'' or ''Binomial est''|| ||Compare Two Unpaired Groups||''[[TwoSamplesOneVariable#unpaired-t|Unpaired t-test]]''||''Mann-Whitney test''||''Fisher's test'' (Chi-square for large samples)|| ||Compare Two Paired Groups||''[[TwoSamplesOneVariable#paired-t|Paired t-test]]''||''Wilcoxon test''||''McNemar's test''|| ||Compare Three or More Unmatched Groups||''[[MultipleSamplesOneVariable#example|One-way ANOVA]]''||''Kruskal-Wallis test''||''Chi-square test''|| ||Compare Three or More Matched Groups||''[[MultipleSamplesOneVariable#example-cor|Repeated-measures ANOVA]]''||''Friedman test''||''Cochrane Q''|| ||Quantify Association Between Two Variables||''[[TwoVariables#pearson-r|Pearson correlation]]''||''Spearman correlation''||''Contingency coefficients''|| ||Predict Value from Another Measured Variable||''[[TwoVariables#simple-regression|Linear regression]]'' or ''Nonlinear regression''||''Nonparametric regression''||''Logistic regression''|| ||Compare Three or More Unmatched Groups with two variables||[[MoreThanTwoVariables#Two-Way ANOVA|Two-way ANOVA]]|| || || ||Predict Value from Several Measured or Binomial Variables||[[MoreThanTwoVariables#Multiple Regression|Multiple regression]]|| ||''Multiple logistic regression''|| = Interpret a Significant Result = Statistical significance means something very specific in experimental work: an effect is significant if the test statistic you find is very unlikely to have occurred under the null hypothesis. For instance, if you run a t-test and find a t-value of 5.8, this is extremely unlikely to occur when the null hypothesis (no difference in means) is true. The interpretation of this is that the null hypothesis is unlikely to be correct. The p-value measures what proportion of the time the null hypothesis will generate a test statistic at least as large as the one you see. So if the p-value is 0.05, it means that 5% of the time---1 in 20 times---the null hypothesis will generate a test statistic at least as large as the one you see. So in that sense, the p-value provides an intuitive measure for how unlikely the null hypothesis is to have generated data like the data you observe. But be careful--it is possible that the null hypothesis is actually true; it is just statistically unlikely. The term '''statistically significant''' does not mean that the result is significant in the sense of being important. A result can be statistically significant (the test statistic is unlikely under the null) but really not be that important. For instance, people's attractiveness might have a statistically significant effect on income, but this effect might not be that important if income is primarily determined by other factors like job type and education level. [[FrontPage|Go back to the Homepage]] |
Experimental Design Basics
Random Variables
Random variables in statistics are a lot like variables in algebra or calculus, except that they represent things that take on random values when sampled from the world. For instance, a variable might describe someone's reaction time to a stimulus, but the value of this variable will be different each time it is measured. A random variable like reaction time can be understood as a distribution---a collection of all possible reaction times and how likely each is---rather than a single value.
Continuous vs. Discrete
Random variables in experiments can be continuous or discrete. In psychology experiments, continuous variables are almost always real numbers (e.g. people's height, reaction time). For continuous variables, the number of possible values it can have between any two given values is infinite; thus, one cannot enumerate their values in order. Discrete variables are variables whose values can be enumerated. Two important types of discrete variable are ordinal variables, often represented by integer values (like number of children in a family) and categorical variables, whose values represent category membership (like type of car or employment status). Most discrete variables used in psychology experiments take on only a finite number of values, for instance in measures like level of education, number of children, or correct/incorrect. However, it is possible that discrete variables have a potentially infinite number of values, as in the number of quanta of light emitted by a light source in a given period of time.
Representing probabilities
Probability distributions
A discrete random variable X is characterized by a probability distribution, P(X=x). For each possible value x, P(X=x) specifies the probability that the value x will occur or be observed. A simple way to think of this is that observations of X are equivalent to random draws from a hat containing balls labeled with the different possible values of X (the population of X). For any given value x, P(X=x) represents the proportion of balls that have the label x. The sum of P(X=x) over all possible values x is 1. To compute the probability that an observation of X will lie in any particular range (e.g. P(X > 1) or P(-10 < X < 0)), one needs merely sum up the values of P(X=x) for all values x within the specified range.
Probability density functions
A continuous random variable X is characterized by a probability density function, p(x). Technically, p(x) does not represent the probability of X being equal to a particular value x (hence it is not written as p(X=x). This is because the probability of a continuous random variable having any specific value x is actually 0. For continuous variables one can only specify the probability that it will be within a specified range of values; for example, the probability that X > 1 or that -1 < X < 0. p(x) is a function that allows us to calculate these probabilities, specifically, by calculating the area under p(x) for the range of values specified. For example, the probability that any particular observation of X is greater than 1, P(X > 1), is the area under p(x) between 1 and infinity. The probability that X is between -1 and 0, P( -1 < X < 0), is the area under p(x) between -1 and 1. A more intuitive way to think of p(x) is that it specifies the probability that X has a value within a small neighborhood of x.
Populations and Samples
A population contains all possible instances of a random variable, with the number of occurrences of each instance of the random variable proportional to its probability of occurring. If a random variable X represents the weights of American males, the population of X contains the weights of all American males. One can think of the population of X as the hat from which random observations of X are drawn. A sample is a collection of particular observations of X. Experimental samples are always sets containing a finite number of samples of X. In an experiment designed to estimate the average reading score of 2nd graders in American public schools, one might sample the scores of 16 randomly chosen 2nd grade students from American public schools. If we let X represent reading scores of 2nd grade students in American public schools, the 16 measured scores would be a sample of X. The population of X would be the reading scores of all 2nd grade students in American public schools.
Summary statistics
Summary statistics provide a way to capture the basic trends in a population or in a sample of data in a concise, informative way. Probably the most common summary statistic is a mean: the mean of a set of numbers gives the average (intuitively, the typical value) of the sample. Another common measure is the variance, which computes the variability in the sample. So the mean of the heights of everyone in New York would capture the typical value of New Yorker's height and the variance of heights would tell you how much variability there is between New Yorkers. Population statistics represent the trends in an entire population, while sample statistics represent the trends in a sample.
Estimators
We can view sample statistics like the mean and variance of a sample as estimators of the true, unknown population statistics you care about. So the mean computed on the sample estimates (or approximates) the true mean of the population. Since we usually want to make statements about the true state of the world (men are taller than women) rather than our sample (our sample of men is taller than our sample of women), it's useful to think about using our sample to estimate some true property of the world.
Estimates can be biased or unbiased. Biased estimators are ones which, intuitively, are expected to give a (perhaps slightly) wrong answer. Unbiased estimators are expected to give the correct answer. As an example, suppose you collected a sample of heights and for some reason threw out the shortest 10 people before computing the mean. The mean you compute will be a biased estimator of the true mean since it will tend to overestimate people's typical height. But, as you get more and more people, the shortest 10 will matter less and less and so the amount of bias will decrease as your sample size increases.
For computing variance (or standard deviation), you should remember to use the unbiased estimator of variance, which uses N-1 instead of N in the denominator.
Dependent vs. Independent Variables
The terms dependent variable and independent variable are used to distinguish between two types of quantifiable factors being considered in an experiment. In simple terms, the independent variable is typically the variable being manipulated or changed, and the dependent variable is the observed result of that manipulation.
In simple experiments, you manipulate one variable and measure another (hopefully while holding everything else constant). For instance, you might measure people's performance on a test (i) when classical music is playing versus (ii) when no music is playing. Here, the independent variable (the thing you manipulate) is whether or not music is played (i/ii) and the dependent variable (the thing you measure) is performance on the test.
== Within vs. Across Subjects Experimental Designs==
It's important to realize that independent variables can be either within subjects or across subjects. When an independent variable is within subjects, it means that each subject is measured within each level of the independent variable (i.e., each subject takes the test with and without music). An across subjects design would have a separate group of subjects for each condition (i.e., one group takes the test with music while a separate group of subjects takes the test without music).
In general, within subject designs are more likely to find effects because they control for additional noise---in this case, each subject's typical ability to answer questions on the test. Here is another example of why within designs are more powerful: suppose you were trying to determine if 4th graders were taller than 3rd graders. If you took a sample of a typical 4th grade and a typical 3rd grade class, you would see a highly overlapping distribution of heights. That is, each classes' heights would be highly variable and there would not be much difference in the mean heights, so it would take a lot of samples to find a difference. But suppose you performed the within subjects experiment. You could take 3rd graders and measure their heights, and then wait a year until they were 4th graders, and measured their heights again. Everyone would have grown and you could very easily find a significant result by comparing each child's heights in 3rd and 4th grade. This is a within subjects design because each subject is measured twice, once in each condition (3rd vs. 4th grade), and is clearly much more likely to find an effect that is real.
Choose the Right Statistical Test
In statistical inferences, the "true" populations that you care about are usually assumed to be distributed in a particular way. The most common assumption is that data items in the populations are distributed according to a normal distribution (i.e. the bell curve, also referred to as a Gaussian distribution). Nearly all statistical tests taught in an undergrad statistics class require this assumption to hold. When this assumption does not hold (for example, when your data are not interval variables, you need to think twice about which test to use), another set of tests, which are referred to as non-parametric tests, should be used. Although in most BCS lab courses it is rare to encounter a situation where the normality assumption does not hold, keep in mind that the t-test, for instance, does not apply everywhere. The following table may be helpful in ensuring you choose the correct statistical test for your experimental data.
|
Data Type |
||
Goal |
Measurement (from Gaussian Population) |
Rank, Score, or Measurement (from Non-Gaussian Population) |
Binomial/Binary (Two Possible Outcomes) |
Describe One Group |
Mean, SD |
Median, interquartile range |
Proportion |
Compare One Group to Hypothetical Value |
Wilcoxon test |
Chi-square test or Binomial est |
|
Compare Two Unpaired Groups |
Mann-Whitney test |
Fisher's test (Chi-square for large samples) |
|
Compare Two Paired Groups |
Wilcoxon test |
McNemar's test |
|
Compare Three or More Unmatched Groups |
Kruskal-Wallis test |
Chi-square test |
|
Compare Three or More Matched Groups |
Friedman test |
Cochrane Q |
|
Quantify Association Between Two Variables |
Spearman correlation |
Contingency coefficients |
|
Predict Value from Another Measured Variable |
Linear regression or Nonlinear regression |
Nonparametric regression |
Logistic regression |
Compare Three or More Unmatched Groups with two variables |
|
|
|
Predict Value from Several Measured or Binomial Variables |
|
Multiple logistic regression |
Interpret a Significant Result
Statistical significance means something very specific in experimental work: an effect is significant if the test statistic you find is very unlikely to have occurred under the null hypothesis. For instance, if you run a t-test and find a t-value of 5.8, this is extremely unlikely to occur when the null hypothesis (no difference in means) is true. The interpretation of this is that the null hypothesis is unlikely to be correct. The p-value measures what proportion of the time the null hypothesis will generate a test statistic at least as large as the one you see. So if the p-value is 0.05, it means that 5% of the time---1 in 20 times---the null hypothesis will generate a test statistic at least as large as the one you see. So in that sense, the p-value provides an intuitive measure for how unlikely the null hypothesis is to have generated data like the data you observe. But be careful--it is possible that the null hypothesis is actually true; it is just statistically unlikely.
The term statistically significant does not mean that the result is significant in the sense of being important. A result can be statistically significant (the test statistic is unlikely under the null) but really not be that important. For instance, people's attractiveness might have a statistically significant effect on income, but this effect might not be that important if income is primarily determined by other factors like job type and education level.