Introduction to Statistics (MAT/SST 115.03 2008S)
Primary: [Front Door] [Syllabus] [Current Outline] [R] - [Academic Honesty] [Instructions]
Groupings: [Applets] [Assignments] [Data] [Examples] [Handouts] [Labs] [Outlines] [Projects] [Readings] [Solutions]
External Links: [R Front Door] [SamR's Front Door]
You can read the data with
MA = read.csv("/home/rebelsky/Stats115/Data/MarriageAges.csv")
This is a one-sided t-test, which we can express with
t.test(MA$HusbandAge,MA$WifeAge,alternative="greater")
You should be able to figure out how tocompute this confidence interval based on The R Notes for Topic 22.
You can produce a similar scatterplot using
plot(MA$WifeAge,MA$HusbandAge)
You can add the “same age” line with
abline(0,1)
We can use a one-sample t-test of the difference between the two columns.
t.test(MA$HusbandAge-MA$WifeAge, mu=0, conf.level=.9)
Once again, we need to tell R that this is a one-sided t-test.
t.test(MA$HusbandAge-MA$WifeAge, mu=0, alternative="greater")
We might want to make a normal probability plot to see if the data are normal. I'm not sure why, but R gives a somewhat different plot than does the answer key.
> qqnorm(MA$HusbandAge-MA$WifeAge, datax=T) > qqline(MA$HusbandAge-MA$WifeAge, datax=T)
Primary: [Front Door] [Syllabus] [Current Outline] [R] - [Academic Honesty] [Instructions]
Groupings: [Applets] [Assignments] [Data] [Examples] [Handouts] [Labs] [Outlines] [Projects] [Readings] [Solutions]
External Links: [R Front Door] [SamR's Front Door]
Copyright (c) 2007-8 Samuel A. Rebelsky.
This work is licensed under a Creative Commons
Attribution-NonCommercial 2.5 License. To view a copy of this
license, visit http://creativecommons.org/licenses/by-nc/2.5/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.