couple <- read.table("C:/Rexamples/coupledata.txt", header=T) View(couple) summary(couple) attach(couple) hgtdif <- hushgt - wifehgt summary(hgtdif) boxplot(hgtdif) stem(hgtdif) qqnorm(hgtdif) qqline(hgtdif) shapiro.test(hgtdif) t.test(hgtdif) t.test(hgtdif, mu = 100) t.test(hushgt, wifehgt, paired=TRUE) --------------------- NOTE ------------------------ The first line above which reads the data from the file "coupledata.txt" assumes that this file is in the directory "C:/Rexamples". Obey this convention or modify the command. -------------------------- results ---------------------------------- The boxplot and normal probability plot (qqplot) requested in this program will appear in the plot window of RStudio. They can be saved as pdfs or images. I have not posted them here. These plots are somewhat crude since I did not specify titles, labels, or such. The remainder of this file is copied and pasted from the RStudio command window. -------------------------------------------------------- > couple <- read.table("C:/Rexamples/coupledata.txt", header=T) > View(couple) > summary(couple) couple husbage hushgt wifeage Min. : 1 Min. :20.00 Min. :1559 Min. :18.00 1st Qu.: 43 1st Qu.:33.00 1st Qu.:1691 1st Qu.:32.00 Median : 85 Median :43.00 Median :1725 Median :41.00 Mean : 85 Mean :42.85 Mean :1733 Mean :40.61 3rd Qu.:127 3rd Qu.:53.00 3rd Qu.:1774 3rd Qu.:50.00 Max. :169 Max. :64.00 Max. :1905 Max. :64.00 wifehgt age Min. :1410 Min. :17.00 1st Qu.:1560 1st Qu.:22.00 Median :1600 Median :24.00 Mean :1603 Mean :25.22 3rd Qu.:1650 3rd Qu.:27.00 Max. :1760 Max. :52.00 > attach(couple) The following object is masked _by_ .GlobalEnv: couple > hgtdif <- hushgt - wifehgt > summary(hgtdif) Min. 1st Qu. Median Mean 3rd Qu. Max. -96.0 81.0 130.0 129.8 181.0 303.0 > boxplot(hgtdif) > stem(hgtdif) The decimal point is 1 digit(s) to the right of the | -8 | 6 -6 | 5 -4 | 6 -2 | 7001 -0 | 2 0 | 00193459 2 | 45569 4 | 00569 6 | 0055680011345599 8 | 1344455804456 10 | 033500334589 12 | 0033335555588890003455559 14 | 0114455550155599 16 | 00001145556904558 18 | 01338900134555666 20 | 459059 22 | 58893569 24 | 13460589 26 | 16 28 | 15 30 | 3 > qqnorm(hgtdif) > qqline(hgtdif) > shapiro.test(hgtdif) Shapiro-Wilk normality test data: hgtdif W = 0.9921, p-value = 0.4787 > t.test(hgtdif) One Sample t-test data: hgtdif t = 22.2003, df = 168, p-value < 2.2e-16 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 118.2779 141.3671 sample estimates: mean of x 129.8225 > t.test(hgtdif, mu = 100) One Sample t-test data: hgtdif t = 5.0998, df = 168, p-value = 9.098e-07 alternative hypothesis: true mean is not equal to 100 95 percent confidence interval: 118.2779 141.3671 sample estimates: mean of x 129.8225 > t.test(hushgt, wifehgt, paired=TRUE) Paired t-test data: hushgt and wifehgt t = 22.2003, df = 168, p-value < 2.2e-16 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 118.2779 141.3671 sample estimates: mean of the differences 129.8225 >