{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

205-problemset-1-solutions

# 205-problemset-1-solutions - Psychology 205 Spring 2010...

This preview shows pages 1–4. Sign up to view the full content.

Psychology 205: Spring, 2010 Problem Set 1 - Solutions William Revelle Contents 1 Introduction to using R for statistics 1 2 Comparing two groups 2 2.1 A sample problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.2 Review of variability of distributions of samples . . . . . . . . . . . . . . . . . . . . . 2 2.3 The t-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.4 Using R to do t-tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.4.1 ANOVA as a generalized t-test . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4.2 Linear regression as a generalized ANOVA . . . . . . . . . . . . . . . . . . . . 7 3 Linear regression and correlation 10 4 Two way Analysis of Variance 12 5 Chi Square tests of independence 14 6 Correlated and uncorrelated t-tests 15 6.1 Uncorrelated t-tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.2 Correlated t-tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 7 Using the normal distribution 17 8 The binomial distribution 17 1 Introduction to using R for statistics Problem set 1 asked for a variety of analyses. Here I show the direct answers, but also do the analyses in a variety of ways. I use the statistical program R . For help on R , go to the short tutorial on using R for research methods http://personality-project.org/r/r.205.tutorial.html . In the following, I assume that you have downloaded R and installed the psych package. 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Comparing two groups 2.1 A sample problem An investigator believes that caffeine facilitates performance on a simple spelling test. Two groups of subjects are given either 200 mg of caffeine or a placebo. Although there are several ways of testing if these two groups differ, the most conventional would be a t-test. Apply a t-test to the data in Table 1: Table 1: The effect of caffeine on spelling performance placebo caffeine 24 24 25 29 27 26 26 23 26 25 22 28 21 27 22 24 23 27 25 28 25 27 25 26 2.2 Review of variability of distributions of samples Many statistical tests may be thought of as comparing a statistic to the error of the statistic. One of the most used tests, the t-test (developed by Gossett but published under the name of Student), compares the difference between two means to the expected error of the difference between the means. As we know, the standard error (se) of a single group with mean, ¯ X with standard deviation, s , and variance, s 2 s 2 = n i =1 ( X i - ¯ X ) 2 n - 1 (1) is just s.e. = r s 2 n = s n . (2) The standard error of a mean is just the standard deviation of the mean and depends upon the standard deviation of the individual measures as well as the number of observations that went into the mean. As the sample size grows larger, the standard error tends to be distributed as a normal distribution, but for small samples, the standard error follows a t distribution . How best can we understand the notion of a standard error? One way is to draw repeated samples from a known population and examine their variability. Although this was the procedure 2
used by Gossett, it is also possible to simulate this using random samples drawn by computer from a known or unknown distribution. Using R it is easy to simulate distributions, either the normal or resampled from our data. Consider 20 samples from a normal distribution of size 12 (Figure 1.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}