R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("BSDA-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('BSDA') Loading required package: e1071 Loading required package: class Attaching package: 'BSDA' The following object(s) are masked from package:datasets : Orange > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "Abbey" > > ### * Abbey > > flush(stderr()); flush(stdout()) > > ### Name: Abbey > ### Title: Daily price returns (in pence) of Abbey National shares between > ### 7/31/91 and 10/8/91 > ### Aliases: Abbey > ### Keywords: datasets > > ### ** Examples > > attach(Abbey) > EDA(C1) [1] "C1" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 50.000 0.000 287.000 295.000 299.960 300.500 300.109 304.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 309.000 5.606 31.427 0.793 9.000 22.000 -0.855 -0.235 SW p-val 0.153 > t.test(C1,mu=300) One Sample t-test data: C1 t = -0.0505, df = 49, p-value = 0.96 alternative hypothesis: true mean is not equal to 300 95 percent confidence interval: 298.3668 301.5532 sample estimates: mean of x 299.96 > detach(Abbey) > > > > cleanEx(); ..nameEx <- "Abc" > > ### * Abc > > flush(stderr()); flush(stdout()) > > ### Name: Abc > ### Title: Three samples to illustrate analysis of variance > ### Aliases: Abc > ### Keywords: datasets > > ### ** Examples > > attach(Abc) > STACKED <-stack(Abc) > STACKED[1:5,] values ind 1 10 GroupA 2 12 GroupA 3 14 GroupA 4 23 GroupA 5 25 GroupA > boxplot(values~ind,col=c("red","blue","green"),data=STACKED) > anova(lm(values~ind,data=STACKED)) Analysis of Variance Table Response: values Df Sum Sq Mean Sq F value Pr(>F) ind 2 1068.6 534.3 2.9606 0.06132 . Residuals 48 8662.4 180.5 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > remove(STACKED) > detach(Abc) > > > > cleanEx(); ..nameEx <- "Abilene" > > ### * Abilene > > flush(stderr()); flush(stdout()) > > ### Name: Abilene > ### Title: Crimes reported in Abilene, Texas > ### Aliases: Abilene > ### Keywords: datasets > > ### ** Examples > > str(Abilene) `data.frame': 8 obs. of 5 variables: $ Crime : Factor w/ 8 levels "Aggravated assault",..: 6 4 7 1 3 5 8 2 $ X1992 : int 4 89 136 630 1439 2946 166 30 $ X92percent: num 0.0735 1.6360 2.5000 11.5809 26.4522 ... $ X1999 : int 12 36 123 324 1023 3207 255 17 $ X99percent: num 0.24 0.72 2.46 6.48 20.47 ... > attach(Abilene) > par(mfrow=c(2,1)) > barplot(X1992,names.arg=c("Murder","Rape","Robbery","Assault","Burglary", + "Larceny","V.Theft","Arson"),col="blue",main="Crime 1992") > barplot(X1999,names.arg=c("Murder","Rape","Robbery","Assault","Burglary", + "Larceny","V.Theft","Arson"),col="red",main="Crime 1999") > par(mfrow=c(1,1)) > detach(Abilene) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Ability" > > ### * Ability > > flush(stderr()); flush(stdout()) > > ### Name: Ability > ### Title: Perceived math ability for 13-year olds by gender > ### Aliases: Ability > ### Keywords: datasets > > ### ** Examples > > X <- as.matrix(Ability[1:2,2:6]) > chisq.test(X) Pearson's Chi-squared test data: X X-squared = 19.8691, df = 4, p-value = 0.00053 > > > > cleanEx(); ..nameEx <- "Abortion" > > ### * Abortion > > flush(stderr()); flush(stdout()) > > ### Name: Abortion > ### Title: Abortion rate by region of country > ### Aliases: Abortion > ### Keywords: datasets > > ### ** Examples > > attach(Abortion) > AbortionRate <- cut(X96rate,breaks=c(0,20,10000) ) > levels(AbortionRate) <- c("Low","High") > table(region,AbortionRate) AbortionRate region Low High midwest 10 2 northeast 4 7 south 10 5 west 7 6 > chisq.test(table(region,AbortionRate)) Warning in chisq.test(table(region, AbortionRate)) : Chi-squared approximation may be incorrect Pearson's Chi-squared test data: table(region, AbortionRate) X-squared = 5.792, df = 3, p-value = 0.1222 > detach(Abortion) > > > > cleanEx(); ..nameEx <- "Absent" > > ### * Absent > > flush(stderr()); flush(stdout()) > > ### Name: Absent > ### Title: Number of absent days for 20 employees > ### Aliases: Absent > ### Keywords: datasets > > ### ** Examples > > str(Absent) `data.frame': 20 obs. of 4 variables: $ days : int 1 0 4 3 2 0 0 2 0 2 ... $ days_1 : int 0 1 2 3 4 5 10 NA NA NA ... $ Count : int 7 2 5 2 2 1 1 NA NA NA ... $ Percent: int 35 10 25 10 10 5 5 NA NA NA ... > attach(Absent) > table(days) days 0 1 2 3 4 5 10 7 2 5 2 2 1 1 > barplot(table(days),col="pink") > detach(Absent) > > > > cleanEx(); ..nameEx <- "Achieve" > > ### * Achieve > > flush(stderr()); flush(stdout()) > > ### Name: Achieve > ### Title: Math achievement test scores by gender for 25 high school > ### students > ### Aliases: Achieve > ### Keywords: datasets > > ### ** Examples > > str(Achieve) `data.frame': 25 obs. of 4 variables: $ Score : int 87 68 87 91 67 78 81 72 95 74 ... $ Gender: int 1 2 2 1 2 1 1 1 1 2 ... $ Female: int 87 91 78 81 72 95 89 93 83 74 ... $ Male : int 68 87 67 74 81 93 60 78 74 92 ... > attach(Achieve) > anova(lm(Score~Gender)) Analysis of Variance Table Response: Score Df Sum Sq Mean Sq F value Pr(>F) Gender 1 403.85 403.85 4.4271 0.04651 * Residuals 23 2098.15 91.22 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > t.test(Female,Male,var.equal=TRUE) Two Sample t-test data: Female and Male t = 2.1041, df = 23, p-value = 0.04651 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.1353468 15.9543968 sample estimates: mean of x mean of y 84.46154 76.41667 > detach(Achieve) > > > > cleanEx(); ..nameEx <- "Adsales" > > ### * Adsales > > flush(stderr()); flush(stdout()) > > ### Name: Adsales > ### Title: Number of ads versus number of sales for a retailer of satellite > ### dishes > ### Aliases: Adsales > ### Keywords: datasets > > ### ** Examples > > attach(Adsales) > plot(ads,sales) > linmod <- lm(sales~ads) > abline(linmod) > summary(linmod) Call: lm(formula = sales ~ ads) Residuals: 1 2 3 4 5 6 0.32517 -1.35635 1.18931 0.50780 0.05345 -0.71938 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.6748 0.8018 5.831 0.004311 ** ads 1.2272 0.1176 10.437 0.000476 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.017 on 4 degrees of freedom Multiple R-Squared: 0.9646, Adjusted R-squared: 0.9557 F-statistic: 108.9 on 1 and 4 DF, p-value: 0.0004761 > detach(Adsales) > > > > cleanEx(); ..nameEx <- "Aggress" > > ### * Aggress > > flush(stderr()); flush(stdout()) > > ### Name: Aggress > ### Title: Agressive tendency scores for a group of teenage members of a > ### street gang > ### Aliases: Aggress > ### Keywords: datasets > > ### ** Examples > > str(Aggress) `data.frame': 28 obs. of 1 variable: $ aggres: int 38 27 44 39 41 26 35 45 39 28 ... > attach(Aggress) > EDA(aggres) [1] "aggres" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 28.000 0.000 11.000 28.250 33.357 34.500 33.731 39.750 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 46.000 8.731 76.238 1.650 11.500 35.000 -0.076 -0.722 SW p-val 0.214 > # OR > IQR(aggres) [1] 10.5 > diff(range(aggres)) [1] 35 > detach(Aggress) > > > > cleanEx(); ..nameEx <- "Aid" > > ### * Aid > > flush(stderr()); flush(stdout()) > > ### Name: Aid > ### Title: Monthly payments per person for families in the AFDC federal > ### program > ### Aliases: Aid > ### Keywords: datasets > > ### ** Examples > > str(Aid) `data.frame': 51 obs. of 2 variables: $ State : Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ payment: num 57.2 253.5 114.2 68.2 199.6 ... > attach(Aid) > hist(payment) > boxplot(payment) > library(lattice) > dotplot(State~payment) > detach(Aid) > > > > cleanEx(); ..nameEx <- "Aids" > > ### * Aids > > flush(stderr()); flush(stdout()) > > ### Name: Aids > ### Title: Incubation times for 295 patients thought to be infected with > ### HIV by a blood transfusion > ### Aliases: Aids > ### Keywords: datasets > > ### ** Examples > > str(Aids) `data.frame': 295 obs. of 11 variables: $ duration: int 27 14 15 18 28 10 34 10 34 17 ... $ age : int 4 2 56 65 57 1 20 1 46 46 ... $ group : int 1 1 2 3 2 1 2 1 2 2 ... $ duratio1: int 27 14 10 10 23 13 12 37 6 4 ... $ children: int 4 2 1 1 2 2 2 4 2 1 ... $ duratio2: int 15 28 34 34 17 29 17 29 29 38 ... $ adults : int 56 57 20 46 46 53 39 54 34 56 ... $ duratio3: int 18 15 29 21 25 24 0 48 21 37 ... $ elderly : int 65 63 62 67 61 68 63 61 70 62 ... $ SRES1 : num -1.358 -0.374 0.493 0.493 1.003 ... $ FITS1 : num 35.68 16.44 6.82 6.82 16.44 ... > attach(Aids) > EDA(duration) [1] "duration" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 295.000 0.000 0.000 18.000 31.908 29.000 31.154 42.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 89.000 17.943 321.968 1.045 24.000 89.000 -0.232 0.633 SW p-val 0.000 > t.test(duration,mu=30,alternative="greater") One Sample t-test data: duration t = 1.8268, df = 294, p-value = 0.03437 alternative hypothesis: true mean is greater than 30 95 percent confidence interval: 30.18465 Inf sample estimates: mean of x 31.90847 > sign.test(duration,md=24,alternative="greater") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: duration s = 174, p-value = 0.0002434 alternative hypothesis: true median is greater than 24 95 percent confidence interval: 27 Inf sample estimates: median of x 29 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9486 27 Inf Interpolated CI 0.9500 27 Inf Upper Achieved CI 0.9597 27 Inf > detach(Aids) > > > > cleanEx(); ..nameEx <- "Airdisasters" > > ### * Airdisasters > > flush(stderr()); flush(stdout()) > > ### Name: Airdisasters > ### Title: Aircraft disasters in five different decades > ### Aliases: Airdisasters > ### Keywords: datasets > > ### ** Examples > > attach(Airdisasters) > STA <- stack(Airdisasters[,3:7]) > library(lattice) > dotplot(ind~values,data=STA) > stripchart(x=list(X1950,X1960,X1970,X1980,X1990),method="stack",main="",pch=1, + col="red",group.names=c("1950","1960","1970","1980","1990"), + xlab="Number of Fatalities") > title(main="Aircraft Disasters 1950-1990") > detach(Airdisasters) > > > > cleanEx(); ..nameEx <- "Airline" > > ### * Airline > > flush(stderr()); flush(stdout()) > > ### Name: Airline > ### Title: Percentage of on-time arrivals and number of complaints for 11 > ### airlines > ### Aliases: Airline > ### Keywords: datasets > > ### ** Examples > > str(Airline) `data.frame': 11 obs. of 3 variables: $ airline: Factor w/ 11 levels "Alaska","Amer West",..: 1 2 3 4 5 6 7 8 9 11 ... $ ontime : num 91.1 90.8 85.8 87.2 85.7 91.1 88.3 93.5 88.4 87.3 ... $ complnt: num 5.4 4 3.6 4.6 4.6 4.3 4.6 3.6 5.4 4.4 ... > attach(Airline) > barplot(complnt,names.arg=airline,col="lightblue") > plot(ontime,complnt) > detach(Airline) > > > > cleanEx(); ..nameEx <- "Alcohol" > > ### * Alcohol > > flush(stderr()); flush(stdout()) > > ### Name: Alcohol > ### Title: Ages at which 14 female alcoholics began drinking > ### Aliases: Alcohol > ### Keywords: datasets > > ### ** Examples > > attach(Alcohol) > qqnorm(age) > qqline(age) > sign.test(age,md=20,conf.level=0.99) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: age s = 6, p-value = 1 alternative hypothesis: true median is not equal to 20 99 percent confidence interval: 15.73538 25.05846 sample estimates: median of x 19.5 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9871 16.0000 24.0000 Interpolated CI 0.9900 15.7354 25.0585 Upper Achieved CI 0.9982 15.0000 28.0000 > detach(Alcohol) > > > > cleanEx(); ..nameEx <- "Allergy" > > ### * Allergy > > flush(stderr()); flush(stdout()) > > ### Name: Allergy > ### Title: Allergy medicines by adverse events > ### Aliases: Allergy > ### Keywords: datasets > > ### ** Examples > > attach(Allergy) > X <- as.matrix(Allergy[1:3,2:4]) > chisq.test(X) Pearson's Chi-squared test data: X X-squared = 37.8325, df = 4, p-value = 1.213e-07 > Xr <- as.matrix(Allergy[2:3,2:4]) > chisq.test(Xr) Pearson's Chi-squared test data: Xr X-squared = 2.1544, df = 2, p-value = 0.3406 > detach(Allergy) > > > > cleanEx(); ..nameEx <- "Anesthet" > > ### * Anesthet > > flush(stderr()); flush(stdout()) > > ### Name: Anesthet > ### Title: Recovery times for anesthetized patients > ### Aliases: Anesthet > ### Keywords: datasets > > ### ** Examples > > attach(Anesthet) > str(Anesthet) `data.frame': 10 obs. of 1 variable: $ recover: num 2.6 3 2.8 3.1 3.5 2.9 3.1 2.7 2.9 3.3 > qqnorm(recover) > qqline(recover) > t.test(recover,conf.level=0.90)$conf [1] 2.831955 3.148045 attr(,"conf.level") [1] 0.9 > detach(Anesthet) > > > > cleanEx(); ..nameEx <- "Anxiety" > > ### * Anxiety > > flush(stderr()); flush(stdout()) > > ### Name: Anxiety > ### Title: Math test scores versus anxiety scores before the test > ### Aliases: Anxiety > ### Keywords: datasets > > ### ** Examples > > attach(Anxiety) > plot(anxiety,math) > cor(anxiety,math) [1] -0.8641968 > linmod <- lm(math~anxiety) > abline(linmod) > summary(linmod) Call: lm(formula = math ~ anxiety) Residuals: Min 1Q Median 3Q Max -13.4415 -3.6487 0.8147 3.0895 18.8994 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 103.3919 4.6445 22.261 1.50e-14 *** anxiety -2.1219 0.2912 -7.287 9.02e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 8.06 on 18 degrees of freedom Multiple R-Squared: 0.7468, Adjusted R-squared: 0.7328 F-statistic: 53.1 on 1 and 18 DF, p-value: 9.02e-07 > detach(Anxiety) > > > > cleanEx(); ..nameEx <- "Apolipop" > > ### * Apolipop > > flush(stderr()); flush(stdout()) > > ### Name: Apolipop > ### Title: Level of apolipoprotein B and number of cups of coffee consumed > ### per day for 15 adult males > ### Aliases: Apolipop > ### Keywords: datasets > > ### ** Examples > > attach(Apolipop) > str(Apolipop) `data.frame': 15 obs. of 4 variables: $ coffee : int 1 1 1 2 2 2 3 3 3 4 ... $ apolipB: int 23 19 13 21 18 25 26 32 28 35 ... $ SRES1 : num 1.599 0.302 -1.642 -0.499 -1.415 ... $ FITS1 : num 18.1 18.1 18.1 22.6 22.6 ... > plot(coffee,apolipB) > linmod <- lm(apolipB~coffee) > summary(linmod) Call: lm(formula = apolipB ~ coffee) Residuals: Min 1Q Median 3Q Max -5.067 -2.483 0.800 2.017 4.933 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 13.500 2.089 6.461 2.13e-05 *** coffee 4.567 0.630 7.249 6.46e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.45 on 13 degrees of freedom Multiple R-Squared: 0.8017, Adjusted R-squared: 0.7864 F-statistic: 52.55 on 1 and 13 DF, p-value: 6.465e-06 > # plot(linmod) > detach(Apolipop) > > > > cleanEx(); ..nameEx <- "Append" > > ### * Append > > flush(stderr()); flush(stdout()) > > ### Name: Append > ### Title: Median costs of an appendectomy at 20 hospitals in North > ### Carolina > ### Aliases: Append > ### Keywords: datasets > > ### ** Examples > > str(Append) `data.frame': 20 obs. of 1 variable: $ fee: int 3821 3981 3931 5498 5582 6046 4257 4591 4775 6163 ... > attach(Append) > ll <- mean(fee)-2*sd(fee) > ul <- mean(fee)+2*sd(fee) > limits <-c(ll,ul) > limits [1] 2701.732 6764.768 > fee[feeul] [1] 2478 > detach(Append) > > > > cleanEx(); ..nameEx <- "Appendec" > > ### * Appendec > > flush(stderr()); flush(stdout()) > > ### Name: Appendec > ### Title: Median costs of appendectomies at three different types of North > ### Carolina hospitals > ### Aliases: Appendec > ### Keywords: datasets > > ### ** Examples > > str(Appendec) `data.frame': 59 obs. of 5 variables: $ Cost : int 3821 3981 3931 5498 5582 6046 4257 4591 4775 6163 ... $ Region : int 1 1 1 2 1 2 3 1 2 3 ... $ Rural : int 3821 3981 3931 5582 4591 3840 4053 5104 4673 3935 ... $ Regional: int 5498 6046 4775 4844 4026 4347 6389 2659 4072 3441 ... $ Metropol: int 4257 6163 6266 2478 2251 5143 4532 4212 3556 3362 ... > attach(Appendec) > boxplot(Cost~Region) > anova(lm(Cost~as.factor(Region))) Analysis of Variance Table Response: Cost Df Sum Sq Mean Sq F value Pr(>F) as.factor(Region) 2 545154 272577 0.2327 0.7931 Residuals 56 65593438 1171311 > detach(Appendec) > > > > cleanEx(); ..nameEx <- "Aptitude" > > ### * Aptitude > > flush(stderr()); flush(stdout()) > > ### Name: Aptitude > ### Title: Aptitude test scores versus productivity in a factory > ### Aliases: Aptitude > ### Keywords: datasets > > ### ** Examples > > str(Aptitude) `data.frame': 8 obs. of 4 variables: $ aptitude: int 9 17 13 19 20 23 12 15 $ product : int 23 35 29 33 40 38 25 31 $ SRES1 : num -0.180 0.963 0.423 -1.153 1.716 ... $ FITS1 : num 23.3 33.0 28.1 35.4 36.6 ... > attach(Aptitude) > plot(aptitude,product,main="Exercise 2.1") > model1 <- lm(product~aptitude) > model1 Call: lm(formula = product ~ aptitude) Coefficients: (Intercept) aptitude 12.443 1.207 > abline(model1,col="red",lwd=3) > resid(model1) 1 2 3 4 5 6 7 -0.3033333 2.0433333 0.8700000 -2.3700000 3.4233333 -2.1966667 -1.9233333 8 0.4566667 > fitted(model1) 1 2 3 4 5 6 7 8 23.30333 32.95667 28.13000 35.37000 36.57667 40.19667 26.92333 30.54333 > cor(product,aptitude) [1] 0.935616 > detach(Aptitude) > > > > cleanEx(); ..nameEx <- "Archaeo" > > ### * Archaeo > > flush(stderr()); flush(stdout()) > > ### Name: Archaeo > ### Title: Radiocarbon ages of observations taken from an archaeological > ### site > ### Aliases: Archaeo > ### Keywords: datasets > > ### ** Examples > > str(Archaeo) `data.frame': 60 obs. of 6 variables: $ phase1: int 2530 2420 2160 2770 2370 2440 2330 2300 2460 2210 ... $ phase2: int 2290 2330 2340 2270 2140 2300 2120 2580 2180 NA ... $ phase3: int 2230 2060 2210 2120 2380 2220 2210 2090 2210 2470 ... $ phase4: int 2140 2030 2100 2110 2060 1990 2170 2040 2160 2200 ... $ age : int 2530 2420 2160 2770 2370 2440 2330 2300 2460 2210 ... $ phase : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Archaeo) > boxplot(age~phase,col="yellow",main="Example 1.16",xlab="Phase",ylab="Age") > anova(lm(age~as.factor(phase))) Analysis of Variance Table Response: age Df Sum Sq Mean Sq F value Pr(>F) as.factor(phase) 3 661865 220622 13.005 1.479e-06 *** Residuals 56 950028 16965 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Archaeo) > > > > cleanEx(); ..nameEx <- "Arthriti" > > ### * Arthriti > > flush(stderr()); flush(stdout()) > > ### Name: Arthriti > ### Title: Time of relief for three treatments of arthritis > ### Aliases: Arthriti > ### Keywords: datasets > > ### ** Examples > > str(Arthriti) `data.frame': 51 obs. of 5 variables: $ TreatA : int 40 35 47 52 31 61 92 46 50 49 ... $ TreatB : int 73 32 47 52 34 60 77 42 20 81 ... $ TreatC : int 50 75 34 47 87 45 38 25 86 39 ... $ Time : int 40 35 47 52 31 61 92 46 50 49 ... $ Treatmnt: int 1 1 1 1 1 1 1 1 1 1 ... > attach(Arthriti) > boxplot(Time~Treatmnt) > anova(lm(Time~as.factor(Treatmnt))) Analysis of Variance Table Response: Time Df Sum Sq Mean Sq F value Pr(>F) as.factor(Treatmnt) 2 610.0 305.0 0.606 0.5497 Residuals 48 24161.9 503.4 > detach(Arthriti) > > > > cleanEx(); ..nameEx <- "Artifici" > > ### * Artifici > > flush(stderr()); flush(stdout()) > > ### Name: Artifici > ### Title: Durations of operation for 15 artificial heart transplants > ### Aliases: Artifici > ### Keywords: datasets > > ### ** Examples > > str(Artifici) `data.frame': 15 obs. of 1 variable: $ duration: num 7 6.5 3.5 3.8 3.1 2.8 2.5 2.6 2.4 2.1 ... > attach(Artifici) > stem(duration) The decimal point is at the | 0 | 8 2 | 134556801158 4 | 6 | 50 > summary(duration) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.800 2.450 2.800 3.267 3.300 7.000 > values <- duration[duration<6.5] > values [1] 3.5 3.8 3.1 2.8 2.5 2.6 2.4 2.1 1.8 2.3 3.1 3.0 2.5 > summary(values) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.800 2.400 2.600 2.731 3.100 3.800 > detach(Artifici) > remove(values) > > > > cleanEx(); ..nameEx <- "Asprin" > > ### * Asprin > > flush(stderr()); flush(stdout()) > > ### Name: Asprin > ### Title: Dissolving time versus level of impurities in aspirin tablets > ### Aliases: Asprin > ### Keywords: datasets > > ### ** Examples > > str(Asprin) `data.frame': 5 obs. of 3 variables: $ X1. : num 2 1.8 1.7 1.9 2.1 $ X5. : num 1.9 2.3 2.2 1.9 2.2 $ X10.: num 2.3 2.3 2.2 2.1 2.6 > attach(Asprin) > STACKED <-stack(Asprin) > STACKED[1:5,] values ind 1 2.0 X1. 2 1.8 X1. 3 1.7 X1. 4 1.9 X1. 5 2.1 X1. > boxplot(values~ind,col=c("red","blue","green"),data=STACKED) > anova(lm(values~ind,data=STACKED)) Analysis of Variance Table Response: values Df Sum Sq Mean Sq F value Pr(>F) ind 2 0.40000 0.20000 6.3158 0.01337 * Residuals 12 0.38000 0.03167 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > remove(STACKED) > detach(Asprin) > > > > cleanEx(); ..nameEx <- "Asthmati" > > ### * Asthmati > > flush(stderr()); flush(stdout()) > > ### Name: Asthmati > ### Title: Asthmatic relief index on 9 subjects given a drug and a placebo > ### Aliases: Asthmati > ### Keywords: datasets > > ### ** Examples > > str(Asthmati) `data.frame': 9 obs. of 3 variables: $ Drug : int 28 31 17 22 12 32 24 18 25 $ Placebo: int 32 33 19 26 17 30 26 19 25 $ differ : int 4 2 2 4 5 -2 2 1 0 > attach(Asthmati) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.9512, p-value = 0.7037 > t.test(Placebo,Drug,paired=TRUE,mu=0,alternative="greater") Paired t-test data: Placebo and Drug t = 2.753, df = 8, p-value = 0.01247 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 0.6490697 Inf sample estimates: mean of the differences 2 > detach(Asthmati) > > > > cleanEx(); ..nameEx <- "Attorney" > > ### * Attorney > > flush(stderr()); flush(stdout()) > > ### Name: Attorney > ### Title: Number of convictions reported by U.S. attorney's offices > ### Aliases: Attorney > ### Keywords: datasets > > ### ** Examples > > str(Attorney) `data.frame': 88 obs. of 3 variables: $ Staff : int 17 16 26 7 14 12 15 13 15 12 ... $ Convict : int 378 234 255 332 157 87 67 313 156 82 ... $ District: Factor w/ 88 levels "Albuquerque",..: 1 2 3 4 5 6 7 8 9 10 ... > attach(Attorney) > par(mfrow=c(1,2)) > plot(Staff,Convict,main="With Washington, D.C.") > plot(Staff[-86],Convict[-86],main="Without Washington, D.C.") > par(mfrow=c(1,1)) > detach(Attorney) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Autogear" > > ### * Autogear > > flush(stderr()); flush(stdout()) > > ### Name: Autogear > ### Title: Number of defective auto gears produced by two manufacturers > ### Aliases: Autogear > ### Keywords: datasets > > ### ** Examples > > str(Autogear) `data.frame': 20 obs. of 2 variables: $ A: int 16 25 15 26 21 22 17 26 23 20 ... $ B: int 28 24 28 42 17 31 26 33 26 24 ... > attach(Autogear) > t.test(A,B) Welch Two Sample t-test data: A and B t = -2.2465, df = 37.587, p-value = 0.03063 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -9.4122347 -0.4877653 sample estimates: mean of x mean of y 23.80 28.75 > wilcox.test(A,B) Warning in wilcox.test.default(A, B) : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: A and B W = 114.5, p-value = 0.02115 alternative hypothesis: true mu is not equal to 0 > t.test(A,B,var.equal=TRUE) Two Sample t-test data: A and B t = -2.2465, df = 38, p-value = 0.03056 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -9.4106236 -0.4893764 sample estimates: mean of x mean of y 23.80 28.75 > detach(Autogear) > > > > cleanEx(); ..nameEx <- "Backtoback" > > ### * Backtoback > > flush(stderr()); flush(stdout()) > > ### Name: Backtoback > ### Title: Illustrates inferences based on pooled t-test versus Wilcoxon > ### rank sum test > ### Aliases: Backtoback > ### Keywords: datasets > > ### ** Examples > > str(Backtoback) `data.frame': 24 obs. of 3 variables: $ score: int 140 165 184 188 193 195 198 200 202 217 ... $ group: int 1 1 1 1 1 1 1 1 1 1 ... $ ranks: num 1 3 6 8 10 11 12.5 14 16 20 ... > attach(Backtoback) > wilcox.test(score~group) Warning in wilcox.test.default(x = c(140, 165, 184, 188, 193, 195, 198, : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: score by group W = 70, p-value = 0.931 alternative hypothesis: true mu is not equal to 0 > detach(Backtoback) > > > > cleanEx(); ..nameEx <- "Bbsalaries" > > ### * Bbsalaries > > flush(stderr()); flush(stdout()) > > ### Name: Bbsalaries > ### Title: Baseball salaries for members of five major league teams > ### Aliases: Bbsalaries > ### Keywords: datasets > > ### ** Examples > > str(Bbsalaries) `data.frame': 33 obs. of 5 variables: $ ANGLES : int 7166667 5800000 5500000 5450000 4600000 3550000 3125000 2100000 1600000 1575000 ... $ ORIOLES : int 11949794 6523143 6300000 6079931 5674897 5250000 4920840 4053092 3605516 3600000 ... $ REDSOXS : num 11000000 6350000 4750000 4000000 3750000 ... $ WHITESOXS: num 7000000 5000000 3400000 1900000 1100000 ... $ INDIANS : num 8175000 7500000 7000000 6560461 6000000 ... > attach(Bbsalaries) > stripchart(x=list(INDIANS,WHITESOXS,REDSOXS,ORIOLES,ANGLES),xlab="Salary", + method="stack",main="",pch=1,col="blue", group.names=c("Indians","White Sox", + "Red Sox", "Orioles","Angels")) > title(main="Major League Salaries") > detach(Bbsalaries) > > > > cleanEx(); ..nameEx <- "Bigten" > > ### * Bigten > > flush(stderr()); flush(stdout()) > > ### Name: Bigten > ### Title: Graduation rates for student athletes and nonathletes in the Big > ### Ten Conf. > ### Aliases: Bigten > ### Keywords: datasets > > ### ** Examples > > str(Bigten) `data.frame': 11 obs. of 5 variables: $ School : Factor w/ 11 levels "Illinois","Indiana",..: 1 2 3 4 5 6 7 8 9 10 ... $ X1984.85students: int 78 53 62 81 66 34 87 51 73 68 ... $ X1984.85athletes: int 67 58 64 66 64 44 81 55 63 60 ... $ X1993.94students: int 75 68 62 82 64 51 92 56 80 64 ... $ X1993.94athletes: int 65 66 71 68 56 65 93 50 78 72 ... > attach(Bigten) > boxplot(X1993.94students,X1993.94athletes,names=c("Students","Athletes"), + ylab="1993-1994 Graduation Rates") > plot(X1993.94students,X1993.94athletes,xlab="1993-1994 students", + ylab="1993-1994 athletes") > detach(Bigten) > > > > cleanEx(); ..nameEx <- "Biology" > > ### * Biology > > flush(stderr()); flush(stdout()) > > ### Name: Biology > ### Title: Test scores on first exam in biology class > ### Aliases: Biology > ### Keywords: datasets > > ### ** Examples > > str(Biology) `data.frame': 30 obs. of 1 variable: $ score: int 87 79 94 60 75 94 77 83 68 74 ... > attach(Biology) > hist(score,breaks="scott",col="brown",prob=TRUE,main="Problem 1.49") > lines(density(score),lwd=3) > detach(Biology) > > > > cleanEx(); ..nameEx <- "Birth" > > ### * Birth > > flush(stderr()); flush(stdout()) > > ### Name: Birth > ### Title: Live birth rates in 1990 and 1998 for all states > ### Aliases: Birth > ### Keywords: datasets > > ### ** Examples > > str(Birth) `data.frame': 51 obs. of 3 variables: $ State : Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ X1990rate: num 16.2 21.8 18.9 14.7 20.7 16 16.1 17.1 36.8 15.3 ... $ X1998rate: num 14.3 16.2 16.8 14.5 16 15 13.4 14.2 14.7 13.1 ... > attach(Birth) > stem(X1998rate) The decimal point is at the | 10 | 015 12 | 2234790012466888999 14 | 0001222334567788023678 16 | 002483 18 | 20 | 5 > hist(X1998rate,breaks=seq(10.9,21.9,1.0),xlab="1998 Birth Rate", + main="Figure 1.14 in BSDA",col="pink") > hist(X1998rate,breaks=seq(10.9,21.9,1.0),xlab="1998 Birth Rate", + main="Figure 1.14 in BSDA",col="pink",prob=TRUE) > lines(density(X1998rate),col="red",lwd=2) > detach(Birth) > > > > cleanEx(); ..nameEx <- "Blackedu" > > ### * Blackedu > > flush(stderr()); flush(stdout()) > > ### Name: Blackedu > ### Title: Education level of blacks by gender > ### Aliases: Blackedu > ### Keywords: datasets > > ### ** Examples > > str(Blackedu) `data.frame': 5 obs. of 3 variables: $ education: Factor w/ 5 levels "bachelor deg",..: 3 4 5 1 2 $ female : int 486 659 691 208 96 $ male : int 496 530 435 134 65 > attach(Blackedu) > Blackedu education female male 1 high sch dropout 486 496 2 high sch graduate 659 530 3 some college 691 435 4 bachelor deg 208 134 5 graduate deg 96 65 > chisq.test(Blackedu[,2:3]) Pearson's Chi-squared test data: Blackedu[, 2:3] X-squared = 34.1948, df = 4, p-value = 6.797e-07 > detach(Blackedu) > > > > cleanEx(); ..nameEx <- "Blood" > > ### * Blood > > flush(stderr()); flush(stdout()) > > ### Name: Blood > ### Title: Blood pressure of 15 adult males taken by machine and by an > ### expert > ### Aliases: Blood > ### Keywords: datasets > > ### ** Examples > > str(Blood) `data.frame': 15 obs. of 2 variables: $ Machine: int 68 82 94 106 92 80 76 74 110 93 ... $ Expert : int 72 84 89 100 97 88 84 70 103 84 ... > attach(Blood) > DIF <- Machine - Expert > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9261, p-value = 0.2383 > t.test(Machine,Expert,paired=TRUE) Paired t-test data: Machine and Expert t = 0.6816, df = 14, p-value = 0.5066 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -2.146615 4.146615 sample estimates: mean of the differences 1 > detach(Blood) > remove(DIF) > > > > cleanEx(); ..nameEx <- "Board" > > ### * Board > > flush(stderr()); flush(stdout()) > > ### Name: Board > ### Title: Incomes of board members from three different universities > ### Aliases: Board > ### Keywords: datasets > > ### ** Examples > > str(Board) `data.frame': 7 obs. of 3 variables: $ UnivA: int 70 120 85 200 60 310 90 $ UnivB: int 30 90 80 250 70 55 180 $ UnivC: int 100 900 300 90 1200 260 60 > attach(Board) > STACKED <-stack(Board) > STACKED[1:5,] values ind 1 70 UnivA 2 120 UnivA 3 85 UnivA 4 200 UnivA 5 60 UnivA > boxplot(values~ind,col=c("red","blue","green"),data=STACKED) > remove(STACKED) > detach(Board) > > > > cleanEx(); ..nameEx <- "Bones" > > ### * Bones > > flush(stderr()); flush(stdout()) > > ### Name: Bones > ### Title: Bone density measurements of 35 physically active and 35 > ### non-active women > ### Aliases: Bones > ### Keywords: datasets > > ### ** Examples > > str(Bones) `data.frame': 70 obs. of 5 variables: $ Active : int 213 227 211 208 155 204 216 219 224 202 ... $ Nonactive: int 201 205 187 208 203 265 201 210 219 205 ... $ Density : int 213 227 211 208 155 204 216 219 224 202 ... $ group : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks : num 45 62 40.5 31.5 1 22.5 51.5 57 60 17 ... > attach(Bones) > t.test(Active,Nonactive,alternative="greater") Welch Two Sample t-test data: Active and Nonactive t = 0.8373, df = 66.806, p-value = 0.2027 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: -3.99656 Inf sample estimates: mean of x mean of y 211.6286 207.6000 > wilcox.test(Active,Nonactive,alternative="greater") Warning in wilcox.test.default(Active, Nonactive, alternative = "greater") : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: Active and Nonactive W = 793.5, p-value = 0.01695 alternative hypothesis: true mu is greater than 0 > detach(Bones) > > > > cleanEx(); ..nameEx <- "Books" > > ### * Books > > flush(stderr()); flush(stdout()) > > ### Name: Books > ### Title: Number of books read and final spelling scores for 17 third > ### graders > ### Aliases: Books > ### Keywords: datasets > > ### ** Examples > > str(Books) `data.frame': 17 obs. of 2 variables: $ book : int 27 11 32 5 17 0 8 15 24 6 ... $ spelling: int 85 81 98 61 92 36 59 84 90 70 ... > attach(Books) > plot(book, spelling) > model <- lm(spelling~book) > abline(model) > summary(model) Call: lm(formula = spelling ~ book) Residuals: Min 1Q Median 3Q Max -23.519 -4.684 3.083 7.122 11.520 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 59.5186 3.8758 15.356 1.39e-10 *** book 1.2330 0.2081 5.926 2.78e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 9.542 on 15 degrees of freedom Multiple R-Squared: 0.7007, Adjusted R-squared: 0.6807 F-statistic: 35.11 on 1 and 15 DF, p-value: 2.784e-05 > detach(Books) > rm(model) > > > > cleanEx(); ..nameEx <- "Bookstor" > > ### * Bookstor > > flush(stderr()); flush(stdout()) > > ### Name: Bookstor > ### Title: Prices paid for used books at three different bookstores > ### Aliases: Bookstor > ### Keywords: datasets > > ### ** Examples > > str(Bookstor) `data.frame': 72 obs. of 6 variables: $ StoreA : int 23 27 31 35 36 36 38 39 40 41 ... $ StoreB : int 16 24 34 35 36 39 40 41 41 43 ... $ StoreC : int 10 17 26 28 30 30 31 32 33 33 ... $ Dollars: int 23 27 31 35 36 36 38 39 40 41 ... $ Store : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks : num 4 7 11.5 19 22.5 22.5 27 29 32 36 ... > attach(Bookstor) > boxplot(Dollars~Store) > kruskal.test(Dollars~as.factor(Store)) Kruskal-Wallis rank sum test data: Dollars by as.factor(Store) Kruskal-Wallis chi-squared = 6.6476, df = 2, p-value = 0.03602 > detach(Bookstor) > > > > cleanEx(); ..nameEx <- "Brain" > > ### * Brain > > flush(stderr()); flush(stdout()) > > ### Name: Brain > ### Title: Brain weight versus body weight of 28 animals > ### Aliases: Brain > ### Keywords: datasets > > ### ** Examples > > str(Brain) `data.frame': 28 obs. of 5 variables: $ Species : Factor w/ 28 levels "Africian elephant",..: 21 6 12 10 13 7 2 8 15 23 ... $ body.wt : num 1.35 465.00 36.33 27.66 1.04 ... $ brain.wt: num 8.1 423.0 119.5 115.0 5.5 ... $ logbody : num 0.1303 2.6675 1.5603 1.4419 0.0170 ... $ logbrain: num 0.908 2.626 2.077 2.061 0.740 ... > attach(Brain) > plot(logbody,logbrain,pch=19,col="blue",main="Example 2.3") > model <- lm(logbrain~logbody) > abline(model) > detach(Brain) > > > > cleanEx(); ..nameEx <- "Bumpers" > > ### * Bumpers > > flush(stderr()); flush(stdout()) > > ### Name: Bumpers > ### Title: Repair costs of vehicles crashed into a barrier at 5 miles per > ### hour > ### Aliases: Bumpers > ### Keywords: datasets > > ### ** Examples > > str(Bumpers) `data.frame': 23 obs. of 2 variables: $ Car : Factor w/ 23 levels "Buick Century",..: 10 3 23 21 13 7 17 4 20 15 ... $ repair: int 618 795 1304 1308 1340 1456 1500 1600 1969 1999 ... > attach(Bumpers) > EDA(repair) [1] "repair" Size (n) Missing Minimum 1st Qu Mean Median TrMean 23.000 0.000 618.000 1456.000 2122.478 2129.000 2138.143 3rd Qu Max. Stdev. Var. SE Mean I.Q.R. Range 3002.000 3298.000 798.457 637534.170 166.490 1546.000 2680.000 Kurtosis Skewness SW p-val -1.140 -0.080 0.287 > sum(repair>(mean(repair)-sd(repair)) & + repair < (mean(repair)+sd(repair)))/length(repair) [1] 0.5652174 > stripchart(repair,method="stack") > library(lattice) > dotplot(Car~repair) > detach(Bumpers) > > > > cleanEx(); ..nameEx <- "Bus" > > ### * Bus > > flush(stderr()); flush(stdout()) > > ### Name: Bus > ### Title: Attendance of bus drivers versus attendance > ### Aliases: Bus > ### Keywords: datasets > > ### ** Examples > > str(Bus) `data.frame': 2 obs. of 6 variables: $ Attend: Factor w/ 2 levels "Absent","Present": 1 2 $ AM : int 454 5806 $ Noon : int 208 2112 $ PM : int 491 3989 $ Swing : int 160 3790 $ Split : int 1599 10754 > attach(Bus) > Bus Attend AM Noon PM Swing Split 1 Absent 454 208 491 160 1599 2 Present 5806 2112 3989 3790 10754 > chisq.test(Bus[,2:6]) Pearson's Chi-squared test data: Bus[, 2:6] X-squared = 336.4321, df = 4, p-value < 2.2e-16 > detach(Bus) > > > > cleanEx(); ..nameEx <- "Bypass" > > ### * Bypass > > flush(stderr()); flush(stdout()) > > ### Name: Bypass > ### Title: Median charges for coronary bypass at 17 hospitals in North > ### Carolina > ### Aliases: Bypass > ### Keywords: datasets > > ### ** Examples > > str(Bypass) `data.frame': 17 obs. of 2 variables: $ hospital: Factor w/ 17 levels "Carolinas Med Ct",..: 1 2 3 4 5 6 7 8 9 12 ... $ charge : int 38578 31935 34465 24810 35144 29245 29473 34376 32428 35831 ... > attach(Bypass) > EDA(charge) [1] "charge" Size (n) Missing Minimum 1st Qu Mean Median 17.000 0.000 24810.000 29359.000 32406.294 32428.000 TrMean 3rd Qu Max. Stdev. Var. SE Mean 32406.294 34919.500 38578.000 3590.560 12892118.346 870.839 I.Q.R. Range Kurtosis Skewness SW p-val 5560.500 13768.000 -0.774 -0.311 0.936 > t.test(charge,conf.level=.90)$conf [1] 30885.91 33926.68 attr(,"conf.level") [1] 0.9 > t.test(charge,mu=35000) One Sample t-test data: charge t = -2.9784, df = 16, p-value = 0.00887 alternative hypothesis: true mean is not equal to 35000 95 percent confidence interval: 30560.20 34252.39 sample estimates: mean of x 32406.29 > detach(Bypass) > > > > cleanEx(); ..nameEx <- "CIsim" > > ### * CIsim > > flush(stderr()); flush(stdout()) > > ### Name: CIsim > ### Title: Confidence Interval Simulation Program > ### Aliases: CIsim > ### Keywords: distribution > > ### ** Examples > > CIsim(samples=100, n=30, parameter=100, sigma=10) 4 % of the random confidence intervals do not contain Mu = 100 . > # Simulates 100 samples of size 30 from > # a normal distribution with mean 100 > # and standard deviation 10. From the > # 100 simulated samples, 95 > # intervals for the Mean are constructed > # and depicted in the graph. > > CIsim(samples=100, n=30, parameter=100, sigma=10, type="Var") 5 % of the random confidence intervals do not contain Var = 100 . > # Simulates 100 samples of size 30 from > # a normal distribution with mean 100 > # and standard deviation 10. From the > # 100 simulated samples, 95 > # intervals for the variance are constructed > # and depicted in the graph. > > CIsim(samples=100, n=50, parameter=.5, type="Pi", conf.level=.90) 10 % of the random confidence intervals do not contain Pi = 0.5 . > # Simulates 100 samples of size 50 from > # a binomial distribution where the population > # proportion of successes is 0.5. From the > # 100 simulated samples, 90 > # intervals for Pi are constructed > # and depicted in the graph. > > > > cleanEx(); ..nameEx <- "Cabinets" > > ### * Cabinets > > flush(stderr()); flush(stdout()) > > ### Name: Cabinets > ### Title: Estimates of costs of kitchen cabinets by two suppliers on 20 > ### prospective homes > ### Aliases: Cabinets > ### Keywords: datasets > > ### ** Examples > > str(Cabinets) `data.frame': 20 obs. of 3 variables: $ Home : int 1 2 3 4 5 6 7 8 9 10 ... $ SupplA: int 380 560 425 389 568 651 595 455 540 520 ... $ SupplB: int 325 470 420 375 574 595 570 475 560 500 ... > attach(Cabinets) > DIF <- SupplA - SupplB > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9433, p-value = 0.2767 > t.test(SupplA,SupplB,paired=TRUE) Paired t-test data: SupplA and SupplB t = 2.7159, df = 19, p-value = 0.01371 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 3.967879 30.632121 sample estimates: mean of the differences 17.3 > wilcox.test(SupplA,SupplB,paired=TRUE) Warning in wilcox.test.default(SupplA, SupplB, paired = TRUE) : cannot compute exact p-value with ties Wilcoxon signed rank test with continuity correction data: SupplA and SupplB V = 168, p-value = 0.01953 alternative hypothesis: true mu is not equal to 0 > detach(Cabinets) > remove(DIF) > > > > cleanEx(); ..nameEx <- "Cancer" > > ### * Cancer > > flush(stderr()); flush(stdout()) > > ### Name: Cancer > ### Title: Survival times of terminal cancer patients treated with vitamin > ### C > ### Aliases: Cancer > ### Keywords: datasets > > ### ** Examples > > str(Cancer) `data.frame': 17 obs. of 5 variables: $ stomach : int 124 42 25 45 412 51 1112 46 103 876 ... $ bronchus: int 81 461 20 450 246 166 63 64 155 859 ... $ colon : int 248 377 189 1843 180 537 519 455 406 365 ... $ ovary : int 1234 89 201 356 2970 456 NA NA NA NA ... $ breast : int 1235 24 1581 1166 40 727 3808 791 1804 3460 ... > attach(Cancer) > EDA(stomach) [1] "stomach" Size (n) Missing Minimum 1st Qu Mean Median TrMean 13.000 4.000 25.000 45.500 286.000 124.000 286.000 3rd Qu Max. Stdev. Var. SE Mean I.Q.R. Range 404.000 1112.000 346.310 119930.333 96.049 358.500 1087.000 Kurtosis Skewness SW p-val 0.247 1.271 0.002 > sign.test(stomach,md=100,alternative="greater") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: stomach s = 8, p-value = 0.2905 alternative hypothesis: true median is greater than 100 95 percent confidence interval: 46.22098 Inf sample estimates: median of x 124 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.8666 51.000 Inf Interpolated CI 0.9500 46.221 Inf Upper Achieved CI 0.9539 46.000 Inf > detach(Cancer) > > > > cleanEx(); ..nameEx <- "Carbon" > > ### * Carbon > > flush(stderr()); flush(stdout()) > > ### Name: Carbon > ### Title: Carbon monoxide level measured at three industrial sites > ### Aliases: Carbon > ### Keywords: datasets > > ### ** Examples > > str(Carbon) `data.frame': 24 obs. of 6 variables: $ SiteA : num 0.106 0.127 0.132 0.105 0.117 ... $ SiteB : num 0.122 0.119 0.115 0.120 0.117 ... $ SiteC : num 0.119 0.110 0.106 0.108 0.105 ... $ monoxide: num 0.106 0.127 0.132 0.105 0.117 ... $ Site : int 1 1 1 1 1 1 1 1 2 2 ... $ Ranks : num 3.5 20 21 1.5 12.5 8 5 8 19 15.5 ... > attach(Carbon) > boxplot(monoxide~Site) > kruskal.test(monoxide~as.factor(Site)) Kruskal-Wallis rank sum test data: monoxide by as.factor(Site) Kruskal-Wallis chi-squared = 4.9083, df = 2, p-value = 0.08594 > detach(Carbon) > > > > cleanEx(); ..nameEx <- "Cat" > > ### * Cat > > flush(stderr()); flush(stdout()) > > ### Name: Cat > ### Title: Reading scores on the California achievement test for a group of > ### 3rd graders > ### Aliases: Cat > ### Keywords: datasets > > ### ** Examples > > str(Cat) `data.frame': 17 obs. of 1 variable: $ score: int 48 54 52 73 66 45 70 73 62 58 ... > attach(Cat) > stem(score) The decimal point is 1 digit(s) to the right of the | 4 | 589 5 | 0244489 6 | 1268 7 | 033 > fivenum(score) [1] 45 52 58 66 73 > boxplot(score,main="Problem 1.116",col="green") > detach(Cat) > > > > cleanEx(); ..nameEx <- "Censored" > > ### * Censored > > flush(stderr()); flush(stdout()) > > ### Name: Censored > ### Title: Entry age and survival time of patients with small cell lung > ### cancer under two different treatments > ### Aliases: Censored > ### Keywords: datasets > > ### ** Examples > > str(Censored) `data.frame': 121 obs. of 8 variables: $ survivA : int 730 1980 260 1883 1194 1624 967 1779 643 1645 ... $ ageA : int 56 70 56 54 74 65 60 66 74 63 ... $ censorA : int 0 1 0 1 0 1 0 1 0 1 ... $ survivB : int 1225 556 170 174 219 241 394 731 395 687 ... $ ageB : int 72 55 68 60 58 62 72 64 72 58 ... $ censorB : int 0 0 0 0 0 0 0 0 0 0 ... $ survival: int 730 1980 260 1883 1194 1624 967 1779 643 1645 ... $ group : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Censored) > boxplot(survival~group) > detach(Censored) > > > > cleanEx(); ..nameEx <- "Challeng" > > ### * Challeng > > flush(stderr()); flush(stdout()) > > ### Name: Challeng > ### Title: Temperatures and O-ring failures for the launches of the space > ### shuttle Challenger > ### Aliases: Challeng > ### Keywords: datasets > > ### ** Examples > > str(Challeng) `data.frame': 25 obs. of 4 variables: $ flight : Factor w/ 25 levels "1","2","3","4",..: 1 2 3 4 9 18 23 24 25 5 ... $ date : Factor w/ 25 levels "1/12/86","1/24/85",..: 14 8 13 21 7 17 20 24 10 12 ... $ temp : int 66 70 69 80 68 67 72 73 70 57 ... $ Failures: int 0 1 0 NA 0 0 0 0 0 1 ... > attach(Challeng) > stem(temp) The decimal point is 1 digit(s) to the right of the | 2 | 1 4 | 378 6 | 3677789000023556689 8 | 01 > summary(temp) Min. 1st Qu. Median Mean 3rd Qu. Max. 31.00 67.00 70.00 68.44 75.00 81.00 > IQR(temp) [1] 8 > quantile(temp) 0% 25% 50% 75% 100% 31 67 70 75 81 > fivenum(temp) [1] 31 67 70 75 81 > stem(sort(temp)[-1]) The decimal point is 1 digit(s) to the right of the | 5 | 378 6 | 3677789 7 | 000023556689 8 | 01 > summary(sort(temp)[-1]) Min. 1st Qu. Median Mean 3rd Qu. Max. 53.00 67.00 70.00 70.00 75.25 81.00 > IQR(sort(temp)[-1]) [1] 8.25 > quantile(sort(temp)[-1]) 0% 25% 50% 75% 100% 53.00 67.00 70.00 75.25 81.00 > fivenum(sort(temp)[-1]) [1] 53.0 67.0 70.0 75.5 81.0 > par(mfrow=c(1,2)) > qqnorm(temp) > qqline(temp) > qqnorm(sort(temp)[-1]) > qqline(sort(temp)[-1]) > par(mfrow=c(1,1)) > detach(Challeng) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Chemist" > > ### * Chemist > > flush(stderr()); flush(stdout()) > > ### Name: Chemist > ### Title: Starting salaries of 50 chemistry majors > ### Aliases: Chemist > ### Keywords: datasets > > ### ** Examples > > str(Chemist) `data.frame': 50 obs. of 1 variable: $ salary: int 39400 39720 37600 39500 40520 40230 38100 40400 33200 39950 ... > attach(Chemist) > EDA(salary) [1] "salary" Size (n) Missing Minimum 1st Qu Mean Median 50.000 0.000 33200.000 38122.500 39808.000 39945.000 TrMean 3rd Qu Max. Stdev. Var. SE Mean 39840.217 41335.000 46250.000 2427.066 5890648.980 343.239 I.Q.R. Range Kurtosis Skewness SW p-val 3212.500 13050.000 0.646 -0.180 0.652 > detach(Chemist) > > > > cleanEx(); ..nameEx <- "Chesapea" > > ### * Chesapea > > flush(stderr()); flush(stdout()) > > ### Name: Chesapea > ### Title: Surface salinity measurements taken offshore from Annapolis, > ### Maryland in 1927 > ### Aliases: Chesapea > ### Keywords: datasets > > ### ** Examples > > str(Chesapea) `data.frame': 16 obs. of 1 variable: $ salinity: num 6.97 6.20 5.93 6.32 6.36 ... > attach(Chesapea) > qqnorm(salinity) > qqline(salinity) > shapiro.test(salinity) Shapiro-Wilk normality test data: salinity W = 0.9505, p-value = 0.4973 > t.test(salinity,mu=7) One Sample t-test data: salinity t = -1.444, df = 15, p-value = 0.1693 alternative hypothesis: true mean is not equal to 7 95 percent confidence interval: 6.588356 7.079144 sample estimates: mean of x 6.83375 > detach(Chesapea) > > > > cleanEx(); ..nameEx <- "Chevy" > > ### * Chevy > > flush(stderr()); flush(stdout()) > > ### Name: Chevy > ### Title: Insurance injury ratings of Chevrolet vehicles for 1990 and 1993 > ### models > ### Aliases: Chevy > ### Keywords: datasets > > ### ** Examples > > str(Chevy) `data.frame': 2 obs. of 6 variables: $ year: Factor w/ 2 levels "88-90","91-93": 1 2 $ A : int 16 12 $ B : int 5 2 $ C : int 5 12 $ D : int 3 2 $ F : int 4 6 > attach(Chevy) > Chevy year A B C D F 1 88-90 16 5 5 3 4 2 91-93 12 2 12 2 6 > chisq.test(Chevy[,2:6]) Warning in chisq.test(Chevy[, 2:6]) : Chi-squared approximation may be incorrect Pearson's Chi-squared test data: Chevy[, 2:6] X-squared = 5.3258, df = 4, p-value = 0.2555 > detach(Chevy) > > > > cleanEx(); ..nameEx <- "Chicken" > > ### * Chicken > > flush(stderr()); flush(stdout()) > > ### Name: Chicken > ### Title: Weight gain of chickens fed three different rations > ### Aliases: Chicken > ### Keywords: datasets > > ### ** Examples > > str(Chicken) `data.frame': 13 obs. of 3 variables: $ Ration1: int 4 4 7 3 2 5 4 5 2 3 ... $ Ration2: int 3 4 5 4 6 4 5 6 7 6 ... $ Ration3: int 6 7 7 7 6 8 5 6 7 6 ... > attach(Chicken) > STACKED <-stack(Chicken) > STACKED[1:5,] values ind 1 4 Ration1 2 4 Ration1 3 7 Ration1 4 3 Ration1 5 2 Ration1 > boxplot(values~ind,col=c("red","blue","green"),data=STACKED) > anova(lm(values~ind,data=STACKED)) Analysis of Variance Table Response: values Df Sum Sq Mean Sq F value Pr(>F) ind 2 32.974 16.487 12.170 9.172e-05 *** Residuals 36 48.769 1.355 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > remove(STACKED) > detach(Chicken) > > > > cleanEx(); ..nameEx <- "Chipavg" > > ### * Chipavg > > flush(stderr()); flush(stdout()) > > ### Name: Chipavg > ### Title: Measurements of the thickness of the oxide layer of manufactured > ### integrated circuits > ### Aliases: Chipavg > ### Keywords: datasets > > ### ** Examples > > str(Chipavg) `data.frame': 30 obs. of 3 variables: $ wafer1 : num 940 1042 942 1008 985 ... $ wafer2 : num 985 1052 990 990 918 ... $ thickness: num 962 1048 966 999 951 ... > attach(Chipavg) > EDA(thickness) [1] "thickness" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 30.000 0.000 865.000 981.562 1016.333 1028.125 1018.705 1054.062 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 1101.250 52.954 2804.088 9.668 72.500 236.250 0.308 -0.653 SW p-val 0.339 > t.test(thickness,mu=1000) One Sample t-test data: thickness t = 1.6894, df = 29, p-value = 0.1019 alternative hypothesis: true mean is not equal to 1000 95 percent confidence interval: 996.5601 1036.1065 sample estimates: mean of x 1016.333 > boxplot(wafer1,wafer2,name=c("Wafer 1","Wafer 2")) > shapiro.test(wafer1) Shapiro-Wilk normality test data: wafer1 W = 0.9545, p-value = 0.2228 > shapiro.test(wafer2) Shapiro-Wilk normality test data: wafer2 W = 0.9643, p-value = 0.3959 > t.test(wafer1,wafer2,var.equal=TRUE) Two Sample t-test data: wafer1 and wafer2 t = -0.556, df = 58, p-value = 0.5803 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -39.10005 22.10005 sample estimates: mean of x mean of y 1012.083 1020.583 > detach(Chipavg) > > > > cleanEx(); ..nameEx <- "Chips" > > ### * Chips > > flush(stderr()); flush(stdout()) > > ### Name: Chips > ### Title: Four measurements on a first wafer and four measurements on a > ### second wafer selected from 30 lots > ### Aliases: Chips > ### Keywords: datasets > > ### ** Examples > > str(Chips) `data.frame': 30 obs. of 8 variables: $ wafer11: int 950 1050 940 990 980 900 1050 1100 1070 1000 ... $ wafer12: int 930 1050 960 1020 980 940 1070 1060 1030 950 ... $ wafer13: int 950 1030 940 1020 980 930 1100 1070 1070 1010 ... $ wafer14: int 930 1040 930 1000 1000 930 1070 1050 1020 970 ... $ wafer21: int 1010 1050 1000 980 900 930 1110 1070 1020 1020 ... $ wafer22: int 980 1050 980 990 920 930 1130 1090 1070 980 ... $ wafer23: int 970 1050 960 1000 910 960 1100 1110 1090 990 ... $ wafer24: int 980 1060 1020 990 940 900 1140 1060 1050 1020 ... > attach(Chips) > boxplot(wafer11,wafer12,wafer13,wafer14,wafer21,wafer22,wafer23,wafer24) > detach(Chips) > > > > cleanEx(); ..nameEx <- "Cigar" > > ### * Cigar > > flush(stderr()); flush(stdout()) > > ### Name: Cigar > ### Title: Milligrams of tar in 25 cigarettes selected randomly from 4 > ### different brands > ### Aliases: Cigar > ### Keywords: datasets > > ### ** Examples > > str(Cigar) `data.frame': 100 obs. of 6 variables: $ brandA: num 0.41 0.48 0.44 0.37 0.31 ... $ brandB: num 0.43 0.49 0.52 0.65 0.63 ... $ brandC: num 0.52 0.48 0.67 0.49 0.38 ... $ brandD: num 0.43 0.55 0.71 0.65 0.47 ... $ tar : num 0.41 0.48 0.44 0.37 0.31 ... $ brand : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Cigar) > boxplot(tar~brand) > anova(lm(tar~as.factor(brand))) Analysis of Variance Table Response: tar Df Sum Sq Mean Sq F value Pr(>F) as.factor(brand) 3 0.09260 0.03087 3.7193 0.01403 * Residuals 96 0.79670 0.00830 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Cigar) > > > > cleanEx(); ..nameEx <- "Cigarett" > > ### * Cigarett > > flush(stderr()); flush(stdout()) > > ### Name: Cigarett > ### Title: Effect of mother's smoking on birth weight of newborn > ### Aliases: Cigarett > ### Keywords: datasets > > ### ** Examples > > str(Cigarett) `data.frame': 16 obs. of 2 variables: $ cigarett: int 22 16 4 19 42 8 12 30 14 16 ... $ weight : num 6.4 7.2 8.1 6.9 6.1 8.4 7.6 6.5 8.4 8.1 ... > attach(Cigarett) > plot(cigarett,weight) > model <- lm(weight~cigarett) > abline(model) > cor(weight,cigarett) [1] -0.884236 > detach(Cigarett) > > > > cleanEx(); ..nameEx <- "Citrus" > > ### * Citrus > > flush(stderr()); flush(stdout()) > > ### Name: Citrus > ### Title: Percent of peak bone density of different aged children > ### Aliases: Citrus > ### Keywords: datasets > > ### ** Examples > > str(Citrus) `data.frame': 9 obs. of 2 variables: $ age : int 2 4 6 8 10 12 14 16 18 $ percent: int 43 49 51 56 63 71 82 91 95 > attach(Citrus) > model <- lm(percent~age) > summary(model) Call: lm(formula = percent ~ age) Residuals: Min 1Q Median 3Q Max -3.9278 -2.6278 0.8222 2.7722 3.6722 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 32.5278 2.4283 13.40 3.03e-06 *** age 3.4250 0.2158 15.87 9.55e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.342 on 7 degrees of freedom Multiple R-Squared: 0.973, Adjusted R-squared: 0.9691 F-statistic: 252 on 1 and 7 DF, p-value: 9.547e-07 > anova(model) Analysis of Variance Table Response: percent Df Sum Sq Mean Sq F value Pr(>F) age 1 2815.35 2815.35 252.00 9.547e-07 *** Residuals 7 78.21 11.17 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Citrus) > remove(model) > > > > cleanEx(); ..nameEx <- "Clean" > > ### * Clean > > flush(stderr()); flush(stdout()) > > ### Name: Clean > ### Title: Residual contaminant following the use of three different > ### cleansing agents > ### Aliases: Clean > ### Keywords: datasets > > ### ** Examples > > str(Clean) `data.frame': 45 obs. of 5 variables: $ A : int 2 4 3 3 2 4 5 3 2 4 ... $ B : int 6 7 9 8 6 6 8 6 7 8 ... $ C : int 5 6 5 4 7 5 6 5 4 6 ... $ clean: int 2 4 3 3 2 4 5 3 2 4 ... $ agent: int 1 1 1 1 1 1 1 1 1 1 ... > attach(Clean) > boxplot(clean~agent,col=c("red","blue","green")) > anova(lm(clean~as.factor(agent))) Analysis of Variance Table Response: clean Df Sum Sq Mean Sq F value Pr(>F) as.factor(agent) 2 108.133 54.067 47.44 1.679e-11 *** Residuals 42 47.867 1.140 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Clean) > > > > cleanEx(); ..nameEx <- "Coaxial" > > ### * Coaxial > > flush(stderr()); flush(stdout()) > > ### Name: Coaxial > ### Title: Signal loss from three types of coxial cable > ### Aliases: Coaxial > ### Keywords: datasets > > ### ** Examples > > str(Coaxial) `data.frame': 45 obs. of 5 variables: $ Type.A: int 35 42 43 44 45 46 46 47 48 50 ... $ Type.B: int 35 36 39 40 41 43 44 46 47 48 ... $ Type.C: int 35 36 37 39 40 41 42 42 44 45 ... $ Signal: int 35 42 43 44 45 46 46 47 48 50 ... $ Cable : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Coaxial) > boxplot(Signal~Cable) > kruskal.test(Signal~as.factor(Cable)) Kruskal-Wallis rank sum test data: Signal by as.factor(Cable) Kruskal-Wallis chi-squared = 3.138, df = 2, p-value = 0.2083 > detach(Coaxial) > > > > cleanEx(); ..nameEx <- "Coffee" > > ### * Coffee > > flush(stderr()); flush(stdout()) > > ### Name: Coffee > ### Title: Productivity of workers with and without a coffee break > ### Aliases: Coffee > ### Keywords: datasets > > ### ** Examples > > str(Coffee) `data.frame': 9 obs. of 4 variables: $ Without: int 23 35 29 33 43 32 41 38 40 $ With : int 28 38 29 37 42 30 43 37 39 $ differ : int 5 3 0 4 -1 -2 2 -1 -1 $ sgnrnks: num 9 7 0 8 -3 -5.5 5.5 -3 -3 > attach(Coffee) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.8945, p-value = 0.2217 > t.test(With,Without,paired=TRUE,alternative="greater") Paired t-test data: With and Without t = 1.1767, df = 8, p-value = 0.1366 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: -0.580312 Inf sample estimates: mean of the differences 1 > wilcox.test(With,Without,paired=TRUE,alternative="greater") Warning in wilcox.test.default(With, Without, paired = TRUE, alternative = "greater") : cannot compute exact p-value with ties Warning in wilcox.test.default(With, Without, paired = TRUE, alternative = "greater") : cannot compute exact p-value with zeroes Wilcoxon signed rank test with continuity correction data: With and Without V = 25.5, p-value = 0.162 alternative hypothesis: true mu is greater than 0 > detach(Coffee) > > > > cleanEx(); ..nameEx <- "Coins" > > ### * Coins > > flush(stderr()); flush(stdout()) > > ### Name: Coins > ### Title: Yearly returns on 12 investments > ### Aliases: Coins > ### Keywords: datasets > > ### ** Examples > > str(Coins) `data.frame': 12 obs. of 1 variable: $ coins: num 12.6 9.8 13.2 11.6 12.1 10.7 14.6 10.4 18.4 11.2 ... > attach(Coins) > qqnorm(coins) > qqline(coins) > EDA(coins) [1] "coins" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 12.000 0.000 9.800 10.700 13.525 11.850 13.525 14.250 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 27.000 4.845 23.473 1.399 3.550 17.200 2.142 1.768 SW p-val 0.001 > detach(Coins) > > > > cleanEx(); ..nameEx <- "Combinations" > > ### * Combinations > > flush(stderr()); flush(stdout()) > > ### Name: Combinations > ### Title: Combinations > ### Aliases: Combinations > ### Keywords: distribution > > ### ** Examples > > Combinations(5,2) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] 1 1 2 1 2 3 1 2 3 4 N 2 3 3 4 4 4 5 5 5 5 > # The columns in the matrix list the values of the 10 possible > # combinations of 5 things taken 2 at a time. > > > > cleanEx(); ..nameEx <- "Commute" > > ### * Commute > > flush(stderr()); flush(stdout()) > > ### Name: Commute > ### Title: Commuting times for selected cities in 1980 and 1990 > ### Aliases: Commute > ### Keywords: datasets > > ### ** Examples > > str(Commute) `data.frame': 39 obs. of 3 variables: $ City : Factor w/ 39 levels "Atlanta","Baltimore",..: 22 39 14 6 17 1 2 35 21 36 ... $ X1980: num 33.7 27.2 25.9 26.3 23.6 24.9 25.3 23.9 24.5 22.8 ... $ X1990: num 31.1 29.5 29.5 28.1 26.4 26 26 25.6 24.4 24.3 ... > attach(Commute) > stripchart(x=list(X1980,X1990),method="stack",pch=1,cex=2,col=c("red","blue"), + group.names=c("1980","1990"),main="",xlab="minutes") > title(main="Commute Time") > boxplot(X1980,X1990,col=c("red","blue"),names=c("1980","1990"),horizontal=TRUE,las=1) > library(lattice) > commute <- stack(Commute) > commute[1:5,] values ind 1 33.7 X1980 2 27.2 X1980 3 25.9 X1980 4 26.3 X1980 5 23.6 X1980 > attach(commute) > stripplot(ind~values,jitter=TRUE) > dotplot(ind~values) > bwplot(ind~values) > remove(commute) > detach(Commute) > > > > cleanEx(); ..nameEx <- "Concept" > > ### * Concept > > flush(stderr()); flush(stdout()) > > ### Name: Concept > ### Title: Tennessee self concept scale scores for a group of teenage boys > ### Aliases: Concept > ### Keywords: datasets > > ### ** Examples > > str(Concept) `data.frame': 28 obs. of 1 variable: $ self: int 26 19 23 27 24 33 25 29 14 30 ... > attach(Concept) > summary(self) Min. 1st Qu. Median Mean 3rd Qu. Max. 3.00 20.00 25.00 24.64 29.25 45.00 > sd(self) [1] 9.70763 > diff(range(self)) [1] 42 > IQR(self) [1] 9.25 > summary(self/10) Min. 1st Qu. Median Mean 3rd Qu. Max. 0.300 2.000 2.500 2.464 2.925 4.500 > IQR(self/10) [1] 0.925 > sd(self/10) [1] 0.970763 > diff(range(self/10)) [1] 4.2 > detach(Concept) > > > > cleanEx(); ..nameEx <- "Concrete" > > ### * Concrete > > flush(stderr()); flush(stdout()) > > ### Name: Concrete > ### Title: Compressive strength of concrete blocks made by two different > ### methods > ### Aliases: Concrete > ### Keywords: datasets > > ### ** Examples > > str(Concrete) `data.frame': 20 obs. of 3 variables: $ Strength: int 152 147 134 146 138 156 145 137 157 160 ... $ Method : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks : num 17 15 5 13.5 9.5 18 12 7 19 20 ... > attach(Concrete) > wilcox.test(Strength~Method,alternative="greater") Warning in wilcox.test.default(x = c(152, 147, 134, 146, 138, 156, 145, : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: Strength by Method W = 81, p-value = 0.01040 alternative hypothesis: true mu is greater than 0 > detach(Concrete) > > > > cleanEx(); ..nameEx <- "Corn" > > ### * Corn > > flush(stderr()); flush(stdout()) > > ### Name: Corn > ### Title: Comparison of the yields of a new variety and a standard variety > ### of corn planted on 12 plots of land > ### Aliases: Corn > ### Keywords: datasets > > ### ** Examples > > str(Corn) `data.frame': 12 obs. of 3 variables: $ New : int 110 103 95 94 87 119 102 93 87 98 ... $ Standard: int 102 86 88 75 89 102 105 88 83 89 ... $ differ : int 8 17 7 19 -2 17 -3 5 4 9 ... > attach(Corn) > boxplot(differ) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.9225, p-value = 0.3072 > t.test(New,Standard,paired=TRUE,alternative="greater") Paired t-test data: New and Standard t = 3.8308, df = 11, p-value = 0.001395 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 4.116803 Inf sample estimates: mean of the differences 7.75 > detach(Corn) > > > > cleanEx(); ..nameEx <- "Correlat" > > ### * Correlat > > flush(stderr()); flush(stdout()) > > ### Name: Correlat > ### Title: Exercise to illustrate correlation > ### Aliases: Correlat > ### Keywords: datasets > > ### ** Examples > > str(Correlat) `data.frame': 13 obs. of 2 variables: $ X: int 42 61 12 71 52 48 74 65 53 63 ... $ Y: int 75 49 95 64 83 84 38 58 81 47 ... > attach(Correlat) > plot(X,Y) > model <- lm(Y~X) > abline(model) > detach(Correlat) > > > > cleanEx(); ..nameEx <- "Counsel" > > ### * Counsel > > flush(stderr()); flush(stdout()) > > ### Name: Counsel > ### Title: Scores of 18 volunteers who participated in a counseling process > ### Aliases: Counsel > ### Keywords: datasets > > ### ** Examples > > str(Counsel) `data.frame': 18 obs. of 1 variable: $ score: int 68 71 75 65 61 70 70 64 71 73 ... > attach(Counsel) > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 18.000 0.000 61.000 66.500 69.500 70.000 69.500 72.250 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 78.000 4.579 20.971 1.079 5.750 17.000 -0.742 -0.111 SW p-val 0.907 > t.test(score,mu=70) One Sample t-test data: score t = -0.4632, df = 17, p-value = 0.6491 alternative hypothesis: true mean is not equal to 70 95 percent confidence interval: 67.22274 71.77726 sample estimates: mean of x 69.5 > detach(Counsel) > > > > cleanEx(); ..nameEx <- "Cpi" > > ### * Cpi > > flush(stderr()); flush(stdout()) > > ### Name: Cpi > ### Title: Consumer price index from 1979 to 1998 > ### Aliases: Cpi > ### Keywords: datasets > > ### ** Examples > > str(Cpi) `data.frame': 20 obs. of 2 variables: $ Year: int 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 ... $ CPI : num 13.3 12.5 8.9 3.8 3.8 3.9 3.8 1.1 4.4 4.4 ... > attach(Cpi) > plot(Year,CPI,type="l",lty=2,lwd=2,col="red") > names(CPI) <- Year > barplot(CPI,col="pink",las=2,main="Problem 1.34") > detach(Cpi) > > > > cleanEx(); ..nameEx <- "Crime" > > ### * Crime > > flush(stderr()); flush(stdout()) > > ### Name: Crime > ### Title: Violent crime rates for the states in 1983 and 1993 > ### Aliases: Crime > ### Keywords: datasets > > ### ** Examples > > str(Crime) `data.frame': 51 obs. of 3 variables: $ State: Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 9 8 10 ... $ X1983: num 416 614 494 298 773 ... $ X1993: num 872 660 671 576 1120 ... > attach(Crime) > boxplot(X1983,X1993,names=c("1983","1993"),xlab="Year", + ylab="Crime Rate per 100,000 Inhabitants",main="Problem 1.90") > plot(X1983,X1993) > detach(Crime) > > > > cleanEx(); ..nameEx <- "Darwin" > > ### * Darwin > > flush(stderr()); flush(stdout()) > > ### Name: Darwin > ### Title: Charles Darwin's study of cross-fertilized and self-fertilized > ### plants > ### Aliases: Darwin > ### Keywords: datasets > > ### ** Examples > > str(Darwin) `data.frame': 30 obs. of 7 variables: $ pot : int 1 1 1 2 2 2 3 3 3 3 ... $ cross : num 23.5 12.0 21.0 22.0 19.1 ... $ self : num 17.4 20.4 20.0 20.0 18.4 ... $ height : num 23.5 12.0 21.0 22.0 19.1 ... $ method : int 1 1 1 1 1 1 1 1 1 1 ... $ differ : num 6.12 -8.38 1.00 2.00 0.75 ... $ sgnrnks: int 11 -14 2 4 1 5 7 9 3 8 ... > attach(Darwin) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.9008, p-value = 0.09785 > wilcox.test(cross,self,paired=TRUE) Wilcoxon signed rank test data: cross and self V = 96, p-value = 0.04126 alternative hypothesis: true mu is not equal to 0 > detach(Darwin) > > > > cleanEx(); ..nameEx <- "Dealers" > > ### * Dealers > > flush(stderr()); flush(stdout()) > > ### Name: Dealers > ### Title: Automobile dealers classified according to type dealership and > ### service rendered to customers > ### Aliases: Dealers > ### Keywords: datasets > > ### ** Examples > > str(Dealers) `data.frame': 6 obs. of 2 variables: $ Replace: int 19 4 8 11 12 3 $ Recomnd: int 2 15 13 10 9 16 > attach(Dealers) > Deal <- as.matrix(Dealers) > rownames(Deal) <- c("Honda","Toyota","Mazda","Ford","Dodge","Saturn") > Dealers Replace Recomnd 1 19 2 2 4 15 3 8 13 4 11 10 5 12 9 6 3 16 > barplot(t(Deal),beside=TRUE,legend=TRUE) > detach(Dealers) > remove(Deal) > > > > cleanEx(); ..nameEx <- "Defectiv" > > ### * Defectiv > > flush(stderr()); flush(stdout()) > > ### Name: Defectiv > ### Title: Number of defective items produced by 20 employees > ### Aliases: Defectiv > ### Keywords: datasets > > ### ** Examples > > str(Defectiv) `data.frame': 20 obs. of 4 variables: $ C1 : int 7 6 10 9 8 7 7 6 8 8 ... $ number : int 6 7 8 9 10 NA NA NA NA NA ... $ Count : int 3 4 6 4 3 NA NA NA NA NA ... $ Percent: int 15 20 30 20 15 NA NA NA NA NA ... > attach(Defectiv) > table(C1) C1 6 7 8 9 10 3 4 6 4 3 > barplot(table(C1),col="pink",ylab="Frequency", + xlab="Defective Items Produced by Employees",main="Problem 1.27") > detach(Defectiv) > > > > cleanEx(); ..nameEx <- "Degree" > > ### * Degree > > flush(stderr()); flush(stdout()) > > ### Name: Degree > ### Title: Percent of bachelor's degrees awarded women in 1970 versus 1990 > ### Aliases: Degree > ### Keywords: datasets > > ### ** Examples > > str(Degree) `data.frame': 11 obs. of 3 variables: $ Field: Factor w/ 11 levels "All fields","Business",..: 7 3 6 10 5 8 2 11 9 4 ... $ X1970: num 78 75 73.4 43.3 57.3 27.8 8.7 37.1 13.6 0.7 ... $ X1990: num 84.3 78.1 73.4 71.5 67.5 50.7 46.7 44.2 31.2 13.8 ... > attach(Degree) > Dmat <- as.matrix(Degree[,2:3]) > rownames(Dmat) <- Field > colnames(Dmat) <- c("1970","1990") > Dmat 1970 1990 Health 78.0 84.3 Education 75.0 78.1 Foreign Lng 73.4 73.4 Psychology 43.3 71.5 Fine Arts 57.3 67.5 Life Sciences 27.8 50.7 Business 8.7 46.7 Social Science 37.1 44.2 Physical Sci 13.6 31.2 Engineering 0.7 13.8 All fields 43.1 53.2 > barplot(t(Dmat),beside=TRUE,legend=TRUE,cex.names=.5) > detach(Degree) > remove(Dmat) > > > > cleanEx(); ..nameEx <- "Delay" > > ### * Delay > > flush(stderr()); flush(stdout()) > > ### Name: Delay > ### Title: Delay times on 20 flights from four major air carriers > ### Aliases: Delay > ### Keywords: datasets > > ### ** Examples > > str(Delay) `data.frame': 80 obs. of 6 variables: $ CarrierA: int 20 14 12 20 17 30 19 7 22 18 ... $ CarrierB: int 15 17 10 36 18 20 5 16 20 13 ... $ CarrierC: int 20 27 22 35 26 24 15 17 10 25 ... $ CarrierD: int 25 17 10 5 22 35 19 24 3 20 ... $ delay : int 20 14 12 20 17 30 19 7 22 18 ... $ Carrier : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Delay) > boxplot(delay~Carrier) > kruskal.test(delay~as.factor(Carrier)) Kruskal-Wallis rank sum test data: delay by as.factor(Carrier) Kruskal-Wallis chi-squared = 3.7529, df = 3, p-value = 0.2894 > detach(Delay) > > > > cleanEx(); ..nameEx <- "Depend" > > ### * Depend > > flush(stderr()); flush(stdout()) > > ### Name: Depend > ### Title: Number of dependent children for 50 families > ### Aliases: Depend > ### Keywords: datasets > > ### ** Examples > > str(Depend) `data.frame': 50 obs. of 4 variables: $ C1 : int 3 2 2 4 1 1 2 3 4 1 ... $ number : int 0 1 2 3 4 5 6 NA NA NA ... $ Count : int 9 13 13 7 4 3 1 NA NA NA ... $ Percent: int 18 26 26 14 8 6 2 NA NA NA ... > attach(Depend) > table(C1) C1 0 1 2 3 4 5 6 9 13 13 7 4 3 1 > barplot(table(C1),col="lightblue",main="Problem 1.26", + xlab="Number of Dependent Children",ylab="Frequency") > detach(Depend) > > > > cleanEx(); ..nameEx <- "Detroit" > > ### * Detroit > > flush(stderr()); flush(stdout()) > > ### Name: Detroit > ### Title: Educational levels of a sample of 40 auto workers in Detroit > ### Aliases: Detroit > ### Keywords: datasets > > ### ** Examples > > str(Detroit) `data.frame': 40 obs. of 1 variable: $ educ: int 22 16 11 11 8 12 21 8 12 12 ... > attach(Detroit) > EDA(educ) [1] "educ" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 40.000 0.000 1.000 10.000 11.400 12.000 11.306 12.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 22.000 3.699 13.682 0.585 2.000 21.000 2.014 0.331 SW p-val 0.004 > detach(Detroit) > > > > cleanEx(); ..nameEx <- "Develop" > > ### * Develop > > flush(stderr()); flush(stdout()) > > ### Name: Develop > ### Title: Demographic characteristics of developmental students at 2-year > ### colleges and 4-year colleges > ### Aliases: Develop > ### Keywords: datasets > > ### ** Examples > > Develop Two.year Four.year African American 545 986 American Indian 24 66 Asian 71 66 Latino 142 230 White 1587 1939 > chisq.test(Develop) Pearson's Chi-squared test data: Develop X-squared = 55.2269, df = 4, p-value = 2.912e-11 > > > > cleanEx(); ..nameEx <- "Devmath" > > ### * Devmath > > flush(stderr()); flush(stdout()) > > ### Name: Devmath > ### Title: Test scores for students who failed developmental mathematics in > ### the fall semester 1995 > ### Aliases: Devmath > ### Keywords: datasets > > ### ** Examples > > str(Devmath) `data.frame': 40 obs. of 1 variable: $ score: int 84 88 96 87 65 98 41 92 78 70 ... > attach(Devmath) > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 40.000 0.000 39.000 65.500 74.400 76.500 74.917 87.750 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 100.000 16.495 272.092 2.608 22.250 61.000 -0.521 -0.503 SW p-val 0.095 > t.test(score,mu=80,alternative="less") One Sample t-test data: score t = -2.1471, df = 39, p-value = 0.01903 alternative hypothesis: true mean is less than 80 95 percent confidence interval: -Inf 78.79436 sample estimates: mean of x 74.4 > detach(Devmath) > > > > cleanEx(); ..nameEx <- "Dice" > > ### * Dice > > flush(stderr()); flush(stdout()) > > ### Name: Dice > ### Title: Outcomes and probabilities of the roll of a pair of fair dice > ### Aliases: Dice > ### Keywords: datasets > > ### ** Examples > > str(Dice) `data.frame': 11 obs. of 2 variables: $ x : int 2 3 4 5 6 7 8 9 10 11 ... $ P.x.: num 0.0278 0.0556 0.0833 0.1111 0.1389 ... > attach(Dice) > roll1 <- sample(1:6,2000,replace=TRUE) > roll2 <- sample(1:6,2000,replace=TRUE) > outcome <- roll1+roll2 > table(outcome)/length(outcome) outcome 2 3 4 5 6 7 8 9 10 11 12 0.0330 0.0525 0.0855 0.1205 0.1475 0.1545 0.1305 0.1170 0.0720 0.0550 0.0320 > detach(Dice) > remove(roll1,roll2,outcome) > > > > cleanEx(); ..nameEx <- "Diesel" > > ### * Diesel > > flush(stderr()); flush(stdout()) > > ### Name: Diesel > ### Title: Diesel fuel prices in 1999-2000 in nine regions of the country > ### Aliases: Diesel > ### Keywords: datasets > > ### ** Examples > > str(Diesel) `data.frame': 65 obs. of 11 variables: $ Date : Factor w/ 65 levels "1/03/2000","1/04/1999",..: 34 32 30 28 9 7 5 3 1 25 ... $ NatAvg: num 1.46 1.46 1.46 1.47 1.44 ... $ EstCst: num 1.50 1.52 1.57 1.63 1.56 ... $ NE : num 1.64 1.74 1.93 2.12 1.97 ... $ CltAtl: num 1.62 1.65 1.82 1.96 1.85 ... $ LwrAtl: num 1.44 1.44 1.43 1.44 1.41 ... $ Gulf : num 1.45 1.44 1.42 1.41 1.37 ... $ Rocky : num 1.40 1.39 1.39 1.40 1.40 ... $ WstMt : num 1.42 1.41 1.40 1.39 1.37 ... $ Coast : num 1.51 1.48 1.45 1.45 1.47 ... $ Calif : num 1.55 1.54 1.52 1.53 1.54 ... > attach(Diesel) > boxplot(NatAvg,EstCst,Gulf,Rocky,Calif, + names=c("National Average","East Coast","Gulf","Rocky","California"),col="pink") > > > > > cleanEx(); ..nameEx <- "Diplomat" > > ### * Diplomat > > flush(stderr()); flush(stdout()) > > ### Name: Diplomat > ### Title: Parking tickets issued to diplomats > ### Aliases: Diplomat > ### Keywords: datasets > > ### ** Examples > > str(Diplomat) `data.frame': 10 obs. of 4 variables: $ Country: Factor w/ 10 levels "Brazil","Bulgaria",..: 7 6 5 4 3 2 1 8 9 10 $ Number : int 8138 2556 2363 1582 1421 1263 1260 1239 956 919 $ rate : num 8.9 3.3 1.6 1.6 2.7 6.6 2.1 0.8 10.6 2.2 $ Code : Factor w/ 10 levels "Br","Bu","Eg",..: 7 6 5 4 3 2 1 8 9 10 > attach(Diplomat) > par(mfrow=c(1,2)) > names(Number) <- Country > dotchart(Number,main="Number of Tickets",col="blue",pch=1) > names(rate) <- Country > dotchart(rate,main="Tickets/Vehicle/Month",col="red",pch=2) > barplot(rate,col="pink") > detach(Diplomat) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Disposal" > > ### * Disposal > > flush(stderr()); flush(stdout()) > > ### Name: Disposal > ### Title: Toxic intensity for plants producing herbicidal preparations > ### Aliases: Disposal > ### Keywords: datasets > > ### ** Examples > > str(Disposal) `data.frame': 29 obs. of 1 variable: $ pounds: num 1.45 1.38 4.37 2.97 1.06 ... > attach(Disposal) > stem(pounds) The decimal point is at the | 0 | 3348 1 | 1344577 2 | 022457 3 | 04556 4 | 0334 5 | 56 6 | 7 | 8 | 9 | 1 > fivenum(pounds) [1] 0.28 1.39 2.43 3.57 9.12 > EDA(pounds) [1] "pounds" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 29.000 0.000 0.280 1.385 2.757 2.430 2.613 3.765 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 9.120 1.913 3.659 0.355 2.380 8.840 1.960 1.226 SW p-val 0.012 > detach(Disposal) > > > > cleanEx(); ..nameEx <- "Dogs" > > ### * Dogs > > flush(stderr()); flush(stdout()) > > ### Name: Dogs > ### Title: Rankings of the favorite breeds of dogs > ### Aliases: Dogs > ### Keywords: datasets > > ### ** Examples > > str(Dogs) `data.frame': 20 obs. of 5 variables: $ Dog : Factor w/ 20 levels "Beagle","Boxer",..: 9 13 15 18 12 11 1 5 6 16 ... $ X1992: int 1 2 4 3 6 5 7 8 15 9 ... $ X1993: int 1 2 3 4 5 6 7 8 9 10 ... $ X1997: int 1 2 3 8 4 5 6 7 12 15 ... $ X1998: int 1 4 3 13 2 7 6 5 30 15 ... > attach(Dogs) > cor(Dogs[,2:5]) X1992 X1993 X1997 X1998 X1992 1.0000000 0.9413534 0.6414222 0.5609087 X1993 0.9413534 1.0000000 0.7850242 0.6122221 X1997 0.6414222 0.7850242 1.0000000 0.9005587 X1998 0.5609087 0.6122221 0.9005587 1.0000000 > detach(Dogs) > > > > cleanEx(); ..nameEx <- "Domestic" > > ### * Domestic > > flush(stderr()); flush(stdout()) > > ### Name: Domestic > ### Title: Rates of domestic violence per 1,000 women by age groups > ### Aliases: Domestic > ### Keywords: datasets > > ### ** Examples > > str(Domestic) `data.frame': 5 obs. of 2 variables: $ Age : Factor w/ 5 levels "12-19","20-24",..: 1 2 3 4 5 $ Rate: num 5.8 15.5 8.8 4 0.9 > attach(Domestic) > names(Rate) <- Age > barplot(Rate,col="gold") > pie(Rate) > detach(Domestic) > > > > cleanEx(); ..nameEx <- "Dopamine" > > ### * Dopamine > > flush(stderr()); flush(stdout()) > > ### Name: Dopamine > ### Title: Dopamine b-hydroxylase activity of schizophrenic patients > ### treated with an antipsychotic drug > ### Aliases: Dopamine > ### Keywords: datasets > > ### ** Examples > > str(Dopamine) `data.frame': 25 obs. of 4 variables: $ nonpsych : int 104 105 112 116 130 145 154 156 170 180 ... $ psychotic: int 150 204 208 222 226 245 270 275 306 320 ... $ DBH : int 104 105 112 116 130 145 154 156 170 180 ... $ group : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Dopamine) > boxplot(DBH~group,names=c("Non Psychotic","Psychotic")) > t.test(DBH~group,var.equal=TRUE) Two Sample t-test data: DBH by group t = -3.9364, df = 23, p-value = 0.0006587 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -119.49885 -37.16782 sample estimates: mean in group 1 mean in group 2 164.2667 242.6000 > detach(Dopamine) > > > > cleanEx(); ..nameEx <- "Dowjones" > > ### * Dowjones > > flush(stderr()); flush(stdout()) > > ### Name: Dowjones > ### Title: Closing yearend Dow Jones Industrial averages from 1896 through > ### 2000 > ### Aliases: Dowjones > ### Keywords: datasets > > ### ** Examples > > str(Dowjones) `data.frame': 105 obs. of 3 variables: $ year : int 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 ... $ close : num 40.5 49.4 60.5 66.1 70.7 ... $ X.change: num 0.0000 0.2215 0.2249 0.0919 0.0701 ... > attach(Dowjones) > plot(year,close,type="l",lty=2,lwd=2,col="blue") > barplot(close,col="blue",las=2,main="Problem 1.35",names.arg=FALSE) > detach(Dowjones) > > > > cleanEx(); ..nameEx <- "Drink" > > ### * Drink > > flush(stderr()); flush(stdout()) > > ### Name: Drink > ### Title: Opinion on referendum by view on moral issue of selling > ### alcoholic beverages > ### Aliases: Drink > ### Keywords: datasets > > ### ** Examples > > str(Drink) `data.frame': 3 obs. of 4 variables: $ drink : Factor w/ 3 levels "immoral","ok",..: 2 3 1 $ For : int 95 73 12 $ Against : int 83 71 46 $ undecide: int 21 18 8 > attach(Drink) > Drink drink For Against undecide 1 ok 95 83 21 2 tolerated 73 71 18 3 immoral 12 46 8 > chisq.test(Drink[,2:4]) Pearson's Chi-squared test data: Drink[, 2:4] X-squared = 19.7024, df = 4, p-value = 0.0005717 > detach(Drink) > > > > cleanEx(); ..nameEx <- "Drug" > > ### * Drug > > flush(stderr()); flush(stdout()) > > ### Name: Drug > ### Title: Number of trials to master a task for a group of 28 subjects > ### assigned to a control and an experimental group > ### Aliases: Drug > ### Keywords: datasets > > ### ** Examples > > str(Drug) `data.frame': 28 obs. of 2 variables: $ trials: int 17 15 5 14 18 3 16 13 15 16 ... $ group : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Drug) > boxplot(trials~group) > wilcox.test(trials~group) Warning in wilcox.test.default(x = c(17, 15, 5, 14, 18, 3, 16, 13, 15, 16, : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: trials by group W = 147.5, p-value = 0.02213 alternative hypothesis: true mu is not equal to 0 > detach(Drug) > > > > cleanEx(); ..nameEx <- "Dyslexia" > > ### * Dyslexia > > flush(stderr()); flush(stdout()) > > ### Name: Dyslexia > ### Title: Data on a group of college students diagnosed with dyslexia > ### Aliases: Dyslexia > ### Keywords: datasets > > ### ** Examples > > str(Dyslexia) `data.frame': 8 obs. of 7 variables: $ words : int 165 201 75 124 105 143 126 92 $ age : int 21 18 19 19 20 18 19 20 $ gender : Factor w/ 2 levels "f","m": 2 1 1 2 1 2 2 2 $ handed : Factor w/ 2 levels "l","r": 1 2 2 2 1 2 1 2 $ weight : int 165 115 138 187 100 210 178 155 $ height : int 70 66 65 72 61 71 69 68 $ children: int 2 1 4 3 2 1 1 3 > attach(Dyslexia) > plot(weight,height) > plot(handed,words) > detach(Dyslexia) > > > > cleanEx(); ..nameEx <- "EDA" > > ### * EDA > > flush(stderr()); flush(stdout()) > > ### Name: EDA > ### Title: Exploratory Data Anaalysis > ### Aliases: EDA > ### Keywords: univar > > ### ** Examples > > EDA(rnorm(100)) [1] "rnorm(100)" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 100.000 0.000 -2.215 -0.526 0.109 0.114 0.113 0.695 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 2.402 0.898 0.807 0.090 1.221 4.617 -0.052 -0.071 SW p-val 0.988 > # Produces four graphs for the 100 randomly > # generated standard normal variates. > > > > cleanEx(); ..nameEx <- "Earthqk" > > ### * Earthqk > > flush(stderr()); flush(stdout()) > > ### Name: Earthqk > ### Title: One hundred year record of worldwide seismic activity(1770-1869) > ### Aliases: Earthqk > ### Keywords: datasets > > ### ** Examples > > str(Earthqk) `data.frame': 100 obs. of 2 variables: $ year : int 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 ... $ severity: int 66 62 66 197 63 0 121 0 113 27 ... > attach(Earthqk) > EDA(severity) [1] "severity" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 100.000 0.000 0.000 69.250 97.970 94.000 96.700 122.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 216.000 44.704 1998.413 4.470 52.750 216.000 0.067 0.431 SW p-val 0.082 > t.test(severity,mu=100,alternative="greater") One Sample t-test data: severity t = -0.4541, df = 99, p-value = 0.6746 alternative hypothesis: true mean is greater than 100 95 percent confidence interval: 90.54745 Inf sample estimates: mean of x 97.97 > detach(Earthqk) > > > > cleanEx(); ..nameEx <- "Educat" > > ### * Educat > > flush(stderr()); flush(stdout()) > > ### Name: Educat > ### Title: Crime rates versus the percent of the population without a high > ### school degree > ### Aliases: Educat > ### Keywords: datasets > > ### ** Examples > > str(Educat) `data.frame': 51 obs. of 3 variables: $ State : Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 9 8 10 ... $ nodegree: num 33.1 13.4 21.3 33.7 23.8 15.6 20.8 22.5 26.9 25.6 ... $ crime : num 872 660 671 576 1120 ... > attach(Educat) > plot(nodegree,crime,xlab="No Crime",ylab="Violent Crime Rate per 100,000") > detach(Educat) > > > > cleanEx(); ..nameEx <- "Eggs" > > ### * Eggs > > flush(stderr()); flush(stdout()) > > ### Name: Eggs > ### Title: Number of eggs versus amounts of feed supplement > ### Aliases: Eggs > ### Keywords: datasets > > ### ** Examples > > str(Eggs) `data.frame': 12 obs. of 7 variables: $ feed : int 10 10 10 15 15 15 20 20 20 25 ... $ eggs : int 78 84 81 85 79 95 98 96 89 84 ... $ SRES1: num -0.938 0.173 -0.383 -0.165 -1.190 ... $ FITS1: num 83 83 83 86 86 ... $ c1sq : int 100 100 100 225 225 225 400 400 400 625 ... $ SRES2: num -0.467 0.837 0.185 -0.772 -1.965 ... $ FITS2: num 80.2 80.2 80.2 88.9 88.9 ... > attach(Eggs) > plot(feed,eggs) > model <- lm(eggs~feed) > abline(model) > summary(model) Call: lm(formula = eggs ~ feed) Residuals: Min 1Q Median 3Q Max -7.7667 -4.8417 -0.4167 2.7083 9.1333 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 77.2667 5.8540 13.20 1.19e-07 *** feed 0.5800 0.3186 1.82 0.0987 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.171 on 10 degrees of freedom Multiple R-Squared: 0.2489, Adjusted R-squared: 0.1737 F-statistic: 3.313 on 1 and 10 DF, p-value: 0.09875 > detach(Eggs) > remove(model) > > > > cleanEx(); ..nameEx <- "Elderly" > > ### * Elderly > > flush(stderr()); flush(stdout()) > > ### Name: Elderly > ### Title: Percent of the population over the age of 65 > ### Aliases: Elderly > ### Keywords: datasets > > ### ** Examples > > str(Elderly) `data.frame': 51 obs. of 3 variables: $ State : Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ X85percent: num 16.8 4.5 17.1 19.8 14.2 11.9 17.1 14.8 15.3 22.8 ... $ X98percent: num 13.1 5.5 13.2 14.3 11.1 10.1 14.3 13 13.9 18.3 ... > attach(Elderly) > stripchart(x=list(X98percent,X85percent),method="stack",pch=19, + col=c("red","blue"),group.names=c("1998","1985")) > cor(X98percent,X85percent) [1] 0.8919852 > detach(Elderly) > > > > cleanEx(); ..nameEx <- "Energy" > > ### * Energy > > flush(stderr()); flush(stdout()) > > ### Name: Energy > ### Title: Amount of energy consumed by homes versus their sizes > ### Aliases: Energy > ### Keywords: datasets > > ### ** Examples > > str(Energy) `data.frame': 12 obs. of 5 variables: $ Size : int 2820 2500 2350 2000 1950 1875 1740 1650 1490 1350 ... $ kilowatt : int 1975 1952 1894 1841 1769 1674 1590 1505 1386 1220 ... $ SRES1 : num -2.1830 -0.2411 0.0824 1.5059 1.1384 ... $ FITS1 : num 2173 1977 1885 1670 1640 ... $ Residuals: num -198.43 -25.11 8.91 170.64 129.31 ... > attach(Energy) > plot(Size,kilowatt) > cor(Size,kilowatt) [1] 0.9397546 > model <- lm(kilowatt~Size) > plot(Size,resid(model)) > detach(Energy) > > > > cleanEx(); ..nameEx <- "Engineer" > > ### * Engineer > > flush(stderr()); flush(stdout()) > > ### Name: Engineer > ### Title: Salaries after 10 years for graduates of three different > ### universities > ### Aliases: Engineer > ### Keywords: datasets > > ### ** Examples > > str(Engineer) `data.frame': 51 obs. of 6 variables: $ UnivA : int 30 42 46 50 51 51 54 54 55 56 ... $ UnivB : int 33 49 53 55 57 57 60 62 62 64 ... $ UnivC : int 35 40 56 60 62 64 64 67 67 69 ... $ salary : int 30 42 46 50 51 51 54 54 55 56 ... $ university: int 1 1 1 1 1 1 1 1 1 1 ... $ ranks : num 1 5 6 8 9.5 9.5 12.5 12.5 14.5 16.5 ... > attach(Engineer) > boxplot(salary~university) > kruskal.test(salary~as.factor(university)) Kruskal-Wallis rank sum test data: salary by as.factor(university) Kruskal-Wallis chi-squared = 6.3994, df = 2, p-value = 0.04077 > detach(Engineer) > > > > cleanEx(); ..nameEx <- "Entrance" > > ### * Entrance > > flush(stderr()); flush(stdout()) > > ### Name: Entrance > ### Title: College entrance exam scores for 24 high school seniors > ### Aliases: Entrance > ### Keywords: datasets > > ### ** Examples > > str(Entrance) `data.frame': 24 obs. of 1 variable: $ score: int 64 75 81 43 69 75 86 58 63 66 ... > attach(Entrance) > stem(score) The decimal point is 1 digit(s) to the right of the | 4 | 38 5 | 589 6 | 2346689 7 | 345579 8 | 12346 9 | 1 > detach(Entrance) > > > > cleanEx(); ..nameEx <- "Epaminicompact" > > ### * Epaminicompact > > flush(stderr()); flush(stdout()) > > ### Name: Epaminicompact > ### Title: Fuel efficiency ratings for compact vehicles in 2001 > ### Aliases: Epaminicompact > ### Keywords: datasets > > ### ** Examples > > str(Epaminicompact) `data.frame': 22 obs. of 10 variables: $ Class : Factor w/ 1 level "MINICOMPACT CARS": 1 1 1 1 1 1 1 1 1 1 ... $ Manufacturer: Factor w/ 6 levels "AUDI","BMW","JAGUAR",..: 1 1 1 2 2 2 2 2 3 3 ... $ carline.name: Factor w/ 12 levels "325CI CONVERTIBLE",..: 11 12 12 1 1 2 2 10 8 9 ... $ displ : num 1.8 1.8 1.8 2.5 2.5 3 3 3.2 4 4 ... $ cyl : int 4 4 4 6 6 6 6 6 8 8 ... $ trans : Factor w/ 5 levels "Auto(L5)","Auto(S4)",..: 4 4 5 4 3 4 3 5 1 1 ... $ drv : Factor w/ 3 levels "4","F","R": 2 1 1 3 3 3 3 3 3 3 ... $ cty : int 22 20 20 19 19 20 18 16 17 16 ... $ hwy : int 31 29 28 27 26 28 26 23 24 22 ... $ cmb : int 25 23 23 22 21 23 21 18 20 19 ... > attach(Epaminicompact) > summary(cty) Min. 1st Qu. Median Mean 3rd Qu. Max. 15.00 16.25 18.50 18.27 20.00 22.00 > detach(Epaminicompact) > > > > cleanEx(); ..nameEx <- "Epatwoseater" > > ### * Epatwoseater > > flush(stderr()); flush(stdout()) > > ### Name: Epatwoseater > ### Title: Fuel efficiency ratings for two-seater vehicles in 2001 > ### Aliases: Epatwoseater > ### Keywords: datasets > > ### ** Examples > > str(Epatwoseater) `data.frame': 36 obs. of 10 variables: $ Class : Factor w/ 1 level "TWO SEATERS": 1 1 1 1 1 1 1 1 1 1 ... $ Manufacturer: Factor w/ 13 levels "ACURA","AUDI",..: 1 1 2 2 3 3 3 3 3 3 ... $ carline.name: Factor w/ 23 levels "BOXSTER","BOXSTER S",..: 10 10 17 18 21 21 22 22 22 22 ... $ displ : num 3 3.2 1.8 1.8 3 3 2.5 2.5 3 3 ... $ cyl : int 6 6 4 4 6 6 6 6 6 6 ... $ trans : Factor w/ 7 levels "Auto(L4)","Auto(L5)",..: 3 7 6 7 6 4 6 4 6 4 ... $ drv : Factor w/ 3 levels "4","F","R": 3 3 2 1 3 3 3 3 3 3 ... $ cty : int 17 17 22 20 21 19 20 19 21 19 ... $ hwy : int 24 24 30 28 28 27 27 26 28 25 ... $ cmb : int 20 19 25 23 24 22 23 22 24 21 ... > attach(Epatwoseater) > boxplot(cty) > detach(Epatwoseater) > > > > cleanEx(); ..nameEx <- "Executiv" > > ### * Executiv > > flush(stderr()); flush(stdout()) > > ### Name: Executiv > ### Title: Ages of 25 executives > ### Aliases: Executiv > ### Keywords: datasets > > ### ** Examples > > str(Executiv) `data.frame': 25 obs. of 1 variable: $ Age: int 35 45 63 42 59 45 50 62 36 64 ... > attach(Executiv) > EDA(Age) [1] "Age" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 25.000 0.000 26.000 42.000 49.520 50.000 49.913 59.500 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 64.000 11.173 124.843 2.235 17.500 38.000 -0.900 -0.451 SW p-val 0.164 > detach(Executiv) > > > > cleanEx(); ..nameEx <- "Exercise" > > ### * Exercise > > flush(stderr()); flush(stdout()) > > ### Name: Exercise > ### Title: Weight loss for 30 members of an exercise program > ### Aliases: Exercise > ### Keywords: datasets > > ### ** Examples > > str(Exercise) `data.frame': 30 obs. of 1 variable: $ loss: int 5 15 3 -4 8 7 5 10 -3 2 ... > attach(Exercise) > stem(loss) The decimal point is 1 digit(s) to the right of the | -1 | 20 -0 | 65 -0 | 4432 0 | 223344 0 | 555556778899 1 | 001 1 | 5 > detach(Exercise) > > > > cleanEx(); ..nameEx <- "Fabric" > > ### * Fabric > > flush(stderr()); flush(stdout()) > > ### Name: Fabric > ### Title: Measures of softness of 10 different clothing garments washed > ### with and without a softener > ### Aliases: Fabric > ### Keywords: datasets > > ### ** Examples > > str(Fabric) `data.frame': 10 obs. of 3 variables: $ Type : int 1 2 3 4 5 6 7 8 9 10 $ With : int 12 3 12 16 4 24 11 17 19 8 $ Without: int 8 4 15 14 6 21 10 15 22 7 > attach(Fabric) > DIF <- With - Without > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9231, p-value = 0.3838 > wilcox.test(With,Without,paired=TRUE,alternative="greater") Warning in wilcox.test.default(With, Without, paired = TRUE, alternative = "greater") : cannot compute exact p-value with ties Wilcoxon signed rank test with continuity correction data: With and Without V = 32, p-value = 0.3406 alternative hypothesis: true mu is greater than 0 > detach(Fabric) > remove(DIF) > > > > cleanEx(); ..nameEx <- "Faithful" > > ### * Faithful > > flush(stderr()); flush(stdout()) > > ### Name: Faithful > ### Title: Waiting times between successive eruptions of the Old Faithful > ### geyser > ### Aliases: Faithful > ### Keywords: datasets > > ### ** Examples > > str(Faithful) `data.frame': 299 obs. of 2 variables: $ Time : int 80 65 91 89 54 51 52 86 79 87 ... $ Eruption: int 2 1 2 2 1 1 1 2 2 2 ... > attach(Faithful) > hist(Time,prob=TRUE,xlab="Waiting time between eruptions",col="tomato") > lines(density(Time),col="red",lwd=3) > t.test(Time)$conf [1] 70.73353 73.89524 attr(,"conf.level") [1] 0.95 > detach(Faithful) > > > > cleanEx(); ..nameEx <- "Family" > > ### * Family > > flush(stderr()); flush(stdout()) > > ### Name: Family > ### Title: Size of family versus cost per person per week for groceries > ### Aliases: Family > ### Keywords: datasets > > ### ** Examples > > str(Family) `data.frame': 20 obs. of 2 variables: $ Number: int 2 2 1 3 4 3 2 4 1 3 ... $ Cost : int 78 85 88 76 72 74 79 69 79 75 ... > attach(Family) > plot(Number,Cost) > cor(Number,Cost) [1] -0.868079 > lm(Cost~Number) Call: lm(formula = Cost ~ Number) Coefficients: (Intercept) Number 88.644 -4.089 > detach(Family) > > > > cleanEx(); ..nameEx <- "Ferraro1" > > ### * Ferraro1 > > flush(stderr()); flush(stdout()) > > ### Name: Ferraro1 > ### Title: Choice of presidental ticket in 1984 by gender > ### Aliases: Ferraro1 > ### Keywords: datasets > > ### ** Examples > > str(Ferraro1) `data.frame': 2 obs. of 4 variables: $ gender : Factor w/ 2 levels "Men","Women": 1 2 $ Reag.Bs : int 245 205 $ Mond.Fer: int 140 160 $ undecide: int 115 135 > attach(Ferraro1) > Ferraro1 gender Reag.Bs Mond.Fer undecide 1 Men 245 140 115 2 Women 205 160 135 > chisq.test(Ferraro1[,2:4]) Pearson's Chi-squared test data: Ferraro1[, 2:4] X-squared = 6.4889, df = 2, p-value = 0.03899 > detach(Ferraro1) > > > > cleanEx(); ..nameEx <- "Ferraro2" > > ### * Ferraro2 > > flush(stderr()); flush(stdout()) > > ### Name: Ferraro2 > ### Title: Choice of vice presidental candidate in 1984 by gender > ### Aliases: Ferraro2 > ### Keywords: datasets > > ### ** Examples > > str(Ferraro2) `data.frame': 2 obs. of 4 variables: $ gender : Factor w/ 2 levels "Men","Women": 1 2 $ Bush : int 245 185 $ Ferraro : int 155 235 $ undecide: int 100 80 > attach(Ferraro2) > Ferraro2 gender Bush Ferraro undecide 1 Men 245 155 100 2 Women 185 235 80 > chisq.test(Ferraro2[,2:4]) Pearson's Chi-squared test data: Ferraro2[, 2:4] X-squared = 27.0046, df = 2, p-value = 1.368e-06 > detach(Ferraro2) > > > > cleanEx(); ..nameEx <- "Fertility" > > ### * Fertility > > flush(stderr()); flush(stdout()) > > ### Name: Fertility > ### Title: Fertility rates of all 50 states and DC > ### Aliases: Fertility > ### Keywords: datasets > > ### ** Examples > > str(Fertility) `data.frame': 51 obs. of 2 variables: $ State: Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ rate : num 1.9 2.3 2.1 2 1.9 1.8 1.5 1.8 1.5 1.7 ... > attach(Fertility) > library(lattice) > dotplot(State~rate) > stem(rate) The decimal point is 1 digit(s) to the left of the | 14 | 0000 16 | 00000000000 18 | 000000000000000000 20 | 0000000000 22 | 0000 24 | 000 26 | 28 | 30 | 32 | 0 > fivenum(rate) [1] 1.50 1.70 1.90 2.05 3.20 > EDA(rate) [1] "rate" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 51.000 0.000 1.500 1.700 1.906 1.900 1.883 2.100 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 3.200 0.307 0.094 0.043 0.400 1.700 4.240 1.562 SW p-val 0.000 > detach(Fertility) > > > > cleanEx(); ..nameEx <- "Firstchi" > > ### * Firstchi > > flush(stderr()); flush(stdout()) > > ### Name: Firstchi > ### Title: Ages of women at the birth of their first child > ### Aliases: Firstchi > ### Keywords: datasets > > ### ** Examples > > str(Firstchi) `data.frame': 87 obs. of 1 variable: $ age: int 30 18 35 22 23 22 36 24 23 28 ... > attach(Firstchi) > EDA(age) [1] "age" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 87.000 0.000 14.000 20.000 23.977 23.000 23.658 26.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 42.000 6.254 39.116 0.670 6.000 28.000 0.364 0.957 SW p-val 0.000 > detach(Firstchi) > > > > cleanEx(); ..nameEx <- "Fish" > > ### * Fish > > flush(stderr()); flush(stdout()) > > ### Name: Fish > ### Title: Length and number of fish caught with small and large mesh > ### codend > ### Aliases: Fish > ### Keywords: datasets > > ### ** Examples > > str(Fish) `data.frame': 767 obs. of 5 variables: $ length : int 24 25 26 27 28 29 30 31 32 33 ... $ smalmesh : int 1 1 3 14 30 49 60 50 70 108 ... $ largmesh : int 0 0 0 1 5 19 29 51 71 120 ... $ smallmesh: int 24 25 26 26 26 27 27 27 27 27 ... $ largemesh: int 27 28 28 28 28 28 29 29 29 29 ... > attach(Fish) > median(smallmesh,na.rm=TRUE) [1] 33 > median(largemesh) [1] 34 > IQR(smallmesh,na.rm=TRUE) [1] 4 > IQR(largemesh) [1] 3 > sign.test(smallmesh,conf.level=.99) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: smallmesh s = 739, p-value < 2.2e-16 alternative hypothesis: true median is not equal to 0 99 percent confidence interval: 33 34 sample estimates: median of x 33 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9877 33 34 Interpolated CI 0.9900 33 34 Upper Achieved CI 0.9900 33 34 > sign.test(largemesh,conf.level=.99) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: largemesh s = 767, p-value < 2.2e-16 alternative hypothesis: true median is not equal to 0 99 percent confidence interval: 34 35 sample estimates: median of x 34 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9886 34 35 Interpolated CI 0.9900 34 35 Upper Achieved CI 0.9907 34 35 > t.test(smallmesh,largemesh) Welch Two Sample t-test data: smallmesh and largemesh t = -7.0137, df = 1485.163, p-value = 3.514e-12 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -1.5251693 -0.8585092 sample estimates: mean of x mean of y 33.42355 34.61538 > detach(Fish) > > > > cleanEx(); ..nameEx <- "Fitness" > > ### * Fitness > > flush(stderr()); flush(stdout()) > > ### Name: Fitness > ### Title: Number of sit-ups before and after a physical fitness course > ### Aliases: Fitness > ### Keywords: datasets > > ### ** Examples > > str(Fitness) `data.frame': 9 obs. of 2 variables: $ Before: int 28 31 17 22 12 32 24 18 25 $ After : int 32 33 19 26 17 30 26 19 25 > attach(Fitness) > DIF <- After - Before > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9512, p-value = 0.7037 > t.test(After,Before,paired=TRUE,alternative="greater") Paired t-test data: After and Before t = 2.753, df = 8, p-value = 0.01247 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 0.6490697 Inf sample estimates: mean of the differences 2 > detach(Fitness) > > > > cleanEx(); ..nameEx <- "Florida2000" > > ### * Florida2000 > > flush(stderr()); flush(stdout()) > > ### Name: Florida2000 > ### Title: Florida voter results in the 2000 presidential election > ### Aliases: Florida2000 > ### Keywords: datasets > > ### ** Examples > > str(Florida2000) `data.frame': 67 obs. of 12 variables: $ County : Factor w/ 67 levels "ALACHUA","BAKER",..: 1 2 3 4 5 6 7 8 9 10 ... $ GORE : int 47300 2392 18850 3072 97318 386518 2155 29641 25501 14630 ... $ BUSH : int 34062 5610 38637 5413 115185 177279 2873 35419 29744 41745 ... $ BUCHANAN : int 262 73 248 65 570 789 90 182 270 186 ... $ NADER : int 3215 53 828 84 4470 7099 39 1461 1378 562 ... $ BROWNE : int 658 17 171 28 643 1212 10 127 194 204 ... $ HAGELIN : int 42 3 18 2 39 128 1 15 16 14 ... $ HARRIS : int 4 0 5 0 11 49 0 6 5 1 ... $ MCREYNOLDS: int 658 0 3 0 11 35 1 3 0 3 ... $ MOOREHEAD : int 21 3 37 3 76 123 3 12 28 9 ... $ PHILLIPS : int 20 3 18 2 72 74 2 19 18 6 ... $ Total : int 86242 8154 58815 8669 218395 573306 5174 66885 57154 57360 ... > attach(Florida2000) > plot(Total,BUCHANAN,xlab="Total votes cast (in thousands)", + ylab="Votes for Buchanan") > detach(Florida2000) > > > > cleanEx(); ..nameEx <- "Fluid" > > ### * Fluid > > flush(stderr()); flush(stdout()) > > ### Name: Fluid > ### Title: Breakdown times of an insulating fluid under various levels of > ### voltage stress > ### Aliases: Fluid > ### Keywords: datasets > > ### ** Examples > > str(Fluid) `data.frame': 76 obs. of 10 variables: $ X26kV : num 5.79 1579.52 2323.70 NA NA ... $ X28kV : num 68.8 108.3 110.6 426.1 1067.6 ... $ X30kV : num 7.74 17.05 20.46 21.02 22.66 ... $ X32kV : num 0.27 0.40 0.69 0.79 2.75 ... $ X34kV : num 0.19 0.78 0.96 1.31 2.78 ... $ X36kV : num 0.35 0.59 0.96 0.99 1.69 ... $ X38kV : num 0.09 0.39 0.47 0.73 0.74 ... $ response: num 5.79 1579.52 2323.70 68.85 108.29 ... $ group : int 1 1 1 2 2 2 2 2 3 3 ... $ ln.resp.: num 1.76 7.36 7.75 4.23 4.68 ... > attach(Fluid) > stem(X34kV) The decimal point is 1 digit(s) to the right of the | 0 | 01113345577882 2 | 2347 4 | 6 | 3 > sign.test(X34kV) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: X34kV s = 19, p-value = 3.815e-06 alternative hypothesis: true median is not equal to 0 95 percent confidence interval: 3.043765 18.082824 sample estimates: median of x 6.5 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9364 3.1600 12.0600 Interpolated CI 0.9500 3.0438 18.0828 Upper Achieved CI 0.9808 2.7800 31.7500 > detach(Fluid) > > > > cleanEx(); ..nameEx <- "Food" > > ### * Food > > flush(stderr()); flush(stdout()) > > ### Name: Food > ### Title: Annual food expenditures for 40 single households in Ohio > ### Aliases: Food > ### Keywords: datasets > > ### ** Examples > > str(Food) `data.frame': 40 obs. of 1 variable: $ food: int 2845 3170 2352 4978 3820 2475 3160 5780 2175 2648 ... > attach(Food) > EDA(food) [1] "food" Size (n) Missing Minimum 1st Qu Mean Median 40.000 0.000 1180.000 2648.000 3609.600 3165.000 TrMean 3rd Qu Max. Stdev. Var. SE Mean 3486.139 4180.000 8147.000 1509.300 2277985.836 238.641 I.Q.R. Range Kurtosis Skewness SW p-val 1532.000 6967.000 1.331 1.300 0.000 > detach(Food) > > > > cleanEx(); ..nameEx <- "Framingh" > > ### * Framingh > > flush(stderr()); flush(stdout()) > > ### Name: Framingh > ### Title: Cholesterol values of 62 subjects in the Framingham Heart Study > ### Aliases: Framingh > ### Keywords: datasets > > ### ** Examples > > str(Framingh) `data.frame': 62 obs. of 1 variable: $ cholest: int 393 353 334 336 327 300 300 308 283 285 ... > attach(Framingh) > stem(cholest) The decimal point is 1 digit(s) to the right of the | 16 | 7 18 | 428 20 | 020125678 22 | 05560000122244668 24 | 03678444668 26 | 34777800288 28 | 35 30 | 008 32 | 746 34 | 3 36 | 38 | 3 > hist(cholest,prob=TRUE,ylim=c(0,.012)) > lines(density(cholest)) > boxplot(cholest,col="brown") > sum(cholest>200&cholest<240)/length(cholest) [1] 0.4032258 > detach(Framingh) > > > > cleanEx(); ..nameEx <- "Freshman" > > ### * Freshman > > flush(stderr()); flush(stdout()) > > ### Name: Freshman > ### Title: Ages of a random sample of 30 college freshmen > ### Aliases: Freshman > ### Keywords: datasets > > ### ** Examples > > str(Freshman) `data.frame': 30 obs. of 1 variable: $ age: int 19 18 19 22 18 21 20 19 19 28 ... > attach(Freshman) > sign.test(age,md=19) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: age s = 13, p-value = 0.09625 alternative hypothesis: true median is not equal to 19 95 percent confidence interval: 19 20 sample estimates: median of x 19 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9013 19 20 Interpolated CI 0.9500 19 20 Upper Achieved CI 0.9572 19 20 > detach(Freshman) > > > > cleanEx(); ..nameEx <- "Funeral" > > ### * Funeral > > flush(stderr()); flush(stdout()) > > ### Name: Funeral > ### Title: Cost of funeral by region of country > ### Aliases: Funeral > ### Keywords: datasets > > ### ** Examples > > str(Funeral) `data.frame': 4 obs. of 4 variables: $ Region : Factor w/ 4 levels "Central","East",..: 4 1 3 2 $ Less : int 15 20 34 12 $ Average: int 60 38 44 40 $ More : int 25 42 22 48 > attach(Funeral) > Funeral Region Less Average More 1 West 15 60 25 2 Central 20 38 42 3 South 34 44 22 4 East 12 40 48 > chisq.test(Funeral[,2:4]) Pearson's Chi-squared test data: Funeral[, 2:4] X-squared = 34.7864, df = 6, p-value = 4.74e-06 > detach(Funeral) > > > > cleanEx(); ..nameEx <- "Galaxie" > > ### * Galaxie > > flush(stderr()); flush(stdout()) > > ### Name: Galaxie > ### Title: Velocities of 82 galaxies in the Corona Borealis region > ### Aliases: Galaxie > ### Keywords: datasets > > ### ** Examples > > str(Galaxie) `data.frame': 82 obs. of 1 variable: $ velocity: int 9172 9558 10406 18419 18972 19330 19440 19541 19846 19914 ... > attach(Galaxie) > EDA(velocity) [1] "velocity" Size (n) Missing Minimum 1st Qu Mean Median 82.000 0.000 9172.000 19515.000 20832.012 20833.500 TrMean 3rd Qu Max. Stdev. Var. SE Mean 20872.081 23214.750 34279.000 4567.906 20865763.543 504.441 I.Q.R. Range Kurtosis Skewness SW p-val 3699.750 25107.000 2.133 -0.423 0.000 > detach(Galaxie) > > > > cleanEx(); ..nameEx <- "Gallup" > > ### * Gallup > > flush(stderr()); flush(stdout()) > > ### Name: Gallup > ### Title: Results of a Gallup poll on possession of marijuana as a > ### criminal offense conducted in 1980 > ### Aliases: Gallup > ### Keywords: datasets > > ### ** Examples > > INFO <- c(43,52,5,42,53,5,44,51,5,30,67,3,45,50,5,58,33,9,27,67,6,26,70,4,45, + 52,3,54,39,7,49,47,4,39,55,6) > INFOmat <- matrix(INFO,nrow=12,byrow=TRUE) > INFOmat [,1] [,2] [,3] [1,] 43 52 5 [2,] 42 53 5 [3,] 44 51 5 [4,] 30 67 3 [5,] 45 50 5 [6,] 58 33 9 [7,] 27 67 6 [8,] 26 70 4 [9,] 45 52 3 [10,] 54 39 7 [11,] 49 47 4 [12,] 39 55 6 > rownames(INFOmat) <- c("National","Gender: Male","Gender: Female", + "Education: College","Education: High School","Education: Grade School", + "Age: 18-24", "Age: 25-29", "Age: 30-49", "Age: 50-older", "Religion: Protestant", + "Religion: Catholic") > colnames(INFOmat) <- c("Criminal", "Not.Criminal", "No.Opinion") > INFOmat Criminal Not.Criminal No.Opinion National 43 52 5 Gender: Male 42 53 5 Gender: Female 44 51 5 Education: College 30 67 3 Education: High School 45 50 5 Education: Grade School 58 33 9 Age: 18-24 27 67 6 Age: 25-29 26 70 4 Age: 30-49 45 52 3 Age: 50-older 54 39 7 Religion: Protestant 49 47 4 Religion: Catholic 39 55 6 > barplot(t(INFOmat[2:3,]),beside=TRUE,legend=TRUE,names=c("Male","Female"), + ylab="Percent of Population Opining") > barplot((INFOmat[2:3,]),beside=TRUE,legend=TRUE,ylab="Percent of Population Opining" ) > remove(INFO,INFOmat) > > > > cleanEx(); ..nameEx <- "Gasoline" > > ### * Gasoline > > flush(stderr()); flush(stdout()) > > ### Name: Gasoline > ### Title: Price of regular unleaded gasoline obtained from 25 service > ### stations > ### Aliases: Gasoline > ### Keywords: datasets > > ### ** Examples > > str(Gasoline) `data.frame': 25 obs. of 1 variable: $ price: num 1.46 1.52 1.5 1.52 1.48 1.6 1.5 1.49 1.48 1.5 ... > attach(Gasoline) > stem(price) The decimal point is 1 digit(s) to the left of the | 14 | 688899999 15 | 000000011222 15 | 9 16 | 001 > detach(Gasoline) > > > > cleanEx(); ..nameEx <- "German" > > ### * German > > flush(stderr()); flush(stdout()) > > ### Name: German > ### Title: Number of errors in copying a German passage before and after an > ### experimental course in German > ### Aliases: German > ### Keywords: datasets > > ### ** Examples > > str(German) `data.frame': 10 obs. of 4 variables: $ Before : int 10 6 8 7 7 12 4 0 7 10 $ After : int 6 4 5 3 6 8 0 1 8 5 $ differ : int 4 2 3 4 1 4 4 -1 -1 5 $ sgnrnks: num 7.5 4 5 7.5 2 7.5 7.5 -2 -2 10 > attach(German) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.8515, p-value = 0.0606 > wilcox.test(Before,After,paired=TRUE) Warning in wilcox.test.default(Before, After, paired = TRUE) : cannot compute exact p-value with ties Wilcoxon signed rank test with continuity correction data: Before and After V = 51, p-value = 0.01798 alternative hypothesis: true mu is not equal to 0 > detach(German) > > > > cleanEx(); ..nameEx <- "Golf" > > ### * Golf > > flush(stderr()); flush(stdout()) > > ### Name: Golf > ### Title: Distances a golf ball can be driven by 20 professional golfers > ### Aliases: Golf > ### Keywords: datasets > > ### ** Examples > > str(Golf) `data.frame': 20 obs. of 1 variable: $ yards: int 259 270 248 262 271 255 261 242 251 238 ... > attach(Golf) > stem(yards) The decimal point is 1 digit(s) to the right of the | 23 | 89 24 | 128 25 | 11459 26 | 12558 27 | 01133 > EDA(yards) [1] "yards" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 20.000 0.000 238.000 248.750 257.850 260.000 258.111 269.500 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 273.000 11.887 141.292 2.658 20.750 35.000 -1.391 -0.291 SW p-val 0.104 > detach(Golf) > > > > cleanEx(); ..nameEx <- "Governor" > > ### * Governor > > flush(stderr()); flush(stdout()) > > ### Name: Governor > ### Title: Annual salaries for state governors in 1994 > ### Aliases: Governor > ### Keywords: datasets > > ### ** Examples > > str(Governor) `data.frame': 50 obs. of 3 variables: $ State : Factor w/ 50 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ X1994salary: int 81151 81648 75000 60000 120000 70000 78000 95000 101764 91092 ... $ X1999salary: int 94655 81648 95000 60000 165000 90000 78000 107000 117240 115939 ... > attach(Governor) > EDA(X1999salary) [1] "X1999salary" Size (n) Missing Minimum 1st Qu Mean Median 5.000000e+01 0.000000e+00 6.000000e+04 8.804400e+04 1.018051e+05 9.500000e+04 TrMean 3rd Qu Max. Stdev. Var. SE Mean 1.004620e+05 1.158070e+05 1.790000e+05 2.270517e+04 5.155249e+08 3.210997e+03 I.Q.R. Range Kurtosis Skewness SW p-val 2.776300e+04 1.190000e+05 1.780000e+00 1.054000e+00 4.000000e-03 > detach(Governor) > > > > cleanEx(); ..nameEx <- "Gpa" > > ### * Gpa > > flush(stderr()); flush(stdout()) > > ### Name: Gpa > ### Title: High school GPA versus college GPA > ### Aliases: Gpa > ### Keywords: datasets > > ### ** Examples > > str(Gpa) `data.frame': 10 obs. of 2 variables: $ HSGPA : num 2.7 3.1 2.1 3.2 2.4 3.4 2.6 2 3.1 2.5 $ CollGPA: num 2.2 2.8 2.4 3.8 1.9 3.5 3.1 1.4 3.4 2.5 > attach(Gpa) > plot(HSGPA,CollGPA) > model <- lm(CollGPA~HSGPA) > abline(model) > model Call: lm(formula = CollGPA ~ HSGPA) Coefficients: (Intercept) HSGPA -0.9504 1.3470 > r <- resid(model) > yhat <- fitted(model) > Table2.1 <- cbind(HSGPA,CollGPA,yhat,r) > Table2.1 HSGPA CollGPA yhat r 1 2.7 2.2 2.686530 -0.4865300 2 3.1 2.8 3.225329 -0.4253294 3 2.1 2.4 1.878331 0.5216691 4 3.2 3.8 3.360029 0.4399707 5 2.4 1.9 2.282430 -0.3824305 6 3.4 3.5 3.629429 -0.1294290 7 2.6 3.1 2.551830 0.5481698 8 2.0 1.4 1.743631 -0.3436310 9 3.1 3.4 3.225329 0.1746706 10 2.5 2.5 2.417130 0.0828697 > remove(r,yhat,model,Table2.1) > detach(Gpa) > > > > cleanEx(); ..nameEx <- "Grades" > > ### * Grades > > flush(stderr()); flush(stdout()) > > ### Name: Grades > ### Title: Test grades in a beginning statistics class > ### Aliases: Grades > ### Keywords: datasets > > ### ** Examples > > str(Grades) `data.frame': 29 obs. of 1 variable: $ grades: int 76 73 81 65 83 90 77 60 67 76 ... > attach(Grades) > EDA(grades) [1] "grades" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 29.000 0.000 57.000 67.500 75.207 76.000 75.148 82.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 95.000 9.901 98.027 1.839 14.500 38.000 -0.766 0.034 SW p-val 0.946 > detach(Grades) > > > > cleanEx(); ..nameEx <- "Graduate" > > ### * Graduate > > flush(stderr()); flush(stdout()) > > ### Name: Graduate > ### Title: Graduation rates for student athletes in the Southeastern Conf. > ### Aliases: Graduate > ### Keywords: datasets > > ### ** Examples > > str(Graduate) `data.frame': 12 obs. of 3 variables: $ School : Factor w/ 12 levels "Alabama","Arkansas",..: 1 2 3 4 5 6 7 8 9 10 ... $ Code : Factor w/ 12 levels "Al","Ar","Au",..: 1 2 3 4 5 6 7 8 9 10 ... $ Percent: int 35 42 51 44 42 53 30 46 53 54 ... > attach(Graduate) > names(Percent) <- School > barplot(Percent,las=2,cex.names=.65,col="tomato") > detach(Graduate) > > > > cleanEx(); ..nameEx <- "Greenriv" > > ### * Greenriv > > flush(stderr()); flush(stdout()) > > ### Name: Greenriv > ### Title: Varve thickness from a sequence through an Eocene lake deposit > ### in the Rocky Mountains > ### Aliases: Greenriv > ### Keywords: datasets > > ### ** Examples > > str(Greenriv) `data.frame': 37 obs. of 1 variable: $ thick: num 10.8 11.7 11 9.9 9.8 9.9 10 10 10.2 10.8 ... > attach(Greenriv) > EDA(thick) [1] "thick" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 37.000 0.000 8.900 9.850 11.073 10.700 11.006 12.150 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 15.600 1.813 3.286 0.298 2.300 6.700 -0.195 0.905 SW p-val 0.003 > sign.test(thick,md=7.3,alternative="greater") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: thick s = 37, p-value = 7.276e-12 alternative hypothesis: true median is greater than 7.3 95 percent confidence interval: 10.10127 Inf sample estimates: median of x 10.7 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9061 10.2000 Inf Interpolated CI 0.9500 10.1013 Inf Upper Achieved CI 0.9506 10.1000 Inf > detach(Greenriv) > > > > cleanEx(); ..nameEx <- "Grnriv2" > > ### * Grnriv2 > > flush(stderr()); flush(stdout()) > > ### Name: Grnriv2 > ### Title: Thickness of a varved section of the Green river oil shale > ### deposit near a major lake in the Rocky Mountains > ### Aliases: Grnriv2 > ### Keywords: datasets > > ### ** Examples > > str(Grnriv2) `data.frame': 101 obs. of 1 variable: $ thick: num 6 7.2 7.1 7.1 7.2 7.4 8 8.6 10 11.4 ... > attach(Grnriv2) > EDA(thick) [1] "thick" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 101.000 0.000 2.800 6.350 7.831 7.300 7.766 9.100 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 14.000 2.587 6.695 0.257 2.750 11.200 -0.144 0.489 SW p-val 0.001 > t.test(thick,mu=8,alternative="less") One Sample t-test data: thick t = -0.6576, df = 100, p-value = 0.2561 alternative hypothesis: true mean is less than 8 95 percent confidence interval: -Inf 8.258134 sample estimates: mean of x 7.830693 > sign.test(thick,md=8,alternative="less") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: thick s = 38, p-value = 0.01049 alternative hypothesis: true median is less than 8 95 percent confidence interval: -Inf 7.8 sample estimates: median of x 7.3 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9445 -Inf 7.8 Interpolated CI 0.9500 -Inf 7.8 Upper Achieved CI 0.9636 -Inf 7.8 > detach(Grnriv2) > > > > cleanEx(); ..nameEx <- "Groupabc" > > ### * Groupabc > > flush(stderr()); flush(stdout()) > > ### Name: Groupabc > ### Title: Group data to illustrate analysis of variance > ### Aliases: Groupabc > ### Keywords: datasets > > ### ** Examples > > str(Groupabc) `data.frame': 15 obs. of 3 variables: $ GroupA: int 110 121 124 127 130 133 135 135 138 141 ... $ GroupB: int 105 114 122 123 124 127 131 132 133 135 ... $ GroupC: int 106 123 124 133 135 137 138 141 145 148 ... > attach(Groupabc) > STACKED <-stack(Groupabc) > STACKED[1:5,] values ind 1 110 GroupA 2 121 GroupA 3 124 GroupA 4 127 GroupA 5 130 GroupA > boxplot(values~ind,col=c("red","blue","green"),data=STACKED) > anova(lm(values~ind,data=STACKED)) Analysis of Variance Table Response: values Df Sum Sq Mean Sq F value Pr(>F) ind 2 572.8 286.4 1.6106 0.2121 Residuals 41 7291.0 177.8 > remove(STACKED) > detach(Groupabc) > > > > cleanEx(); ..nameEx <- "Groups" > > ### * Groups > > flush(stderr()); flush(stdout()) > > ### Name: Groups > ### Title: An illustration of analysis of variance > ### Aliases: Groups > ### Keywords: datasets > > ### ** Examples > > str(Groups) `data.frame': 26 obs. of 3 variables: $ GroupA: int 62 81 67 64 72 77 58 68 54 78 ... $ GroupB: int 100 66 65 85 54 81 90 72 84 81 ... $ GroupC: int 71 66 88 71 73 66 77 79 59 76 ... > attach(Groups) > STACKED <-stack(Groups) > STACKED[1:5,] values ind 1 62 GroupA 2 81 GroupA 3 67 GroupA 4 64 GroupA 5 72 GroupA > boxplot(values~ind,col=c("red","blue","green"),data=STACKED) > anova(lm(values~ind,data=STACKED)) Analysis of Variance Table Response: values Df Sum Sq Mean Sq F value Pr(>F) ind 2 1067.5 533.7 6.0532 0.003738 ** Residuals 71 6260.5 88.2 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > remove(STACKED) > detach(Groups) > > > > cleanEx(); ..nameEx <- "Gym" > > ### * Gym > > flush(stderr()); flush(stdout()) > > ### Name: Gym > ### Title: Children's age versus number of completed gymnastic activities > ### Aliases: Gym > ### Keywords: datasets > > ### ** Examples > > str(Gym) `data.frame': 8 obs. of 3 variables: $ age : int 2 3 4 4 5 6 7 7 $ number: int 5 5 6 3 10 9 11 13 $ x. : int 2 4 6 8 10 NA NA NA > attach(Gym) > plot(age,number) > model <- lm(number~age) > abline(model) > cor(age,number) [1] 0.8589023 > detach(Gym) > > > > cleanEx(); ..nameEx <- "Habits" > > ### * Habits > > flush(stderr()); flush(stdout()) > > ### Name: Habits > ### Title: Study habits of students in two matched school districts > ### Aliases: Habits > ### Keywords: datasets > > ### ** Examples > > str(Habits) `data.frame': 11 obs. of 4 variables: $ A : int 105 109 115 112 124 107 121 112 104 101 ... $ B : int 115 103 110 125 99 121 119 106 100 97 ... $ differ : int 10 -6 -5 13 -25 14 -2 -6 -4 -4 ... $ signrks: num 8 -5.5 -4 9 -11 10 -1 -5.5 -2.5 -2.5 ... > attach(Habits) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.8909, p-value = 0.1428 > t.test(B,A,paired=TRUE,alternative="less") Paired t-test data: B and A t = -0.6468, df = 10, p-value = 0.2662 alternative hypothesis: true difference in means is less than 0 95 percent confidence interval: -Inf 3.931985 sample estimates: mean of the differences -2.181818 > wilcox.test(B,A,paired=TRUE,alternative="less") Warning in wilcox.test.default(B, A, paired = TRUE, alternative = "less") : cannot compute exact p-value with ties Wilcoxon signed rank test with continuity correction data: B and A V = 27, p-value = 0.3122 alternative hypothesis: true mu is less than 0 > detach(Habits) > > > > cleanEx(); ..nameEx <- "Haptologo" > > ### * Haptologo > > flush(stderr()); flush(stdout()) > > ### Name: Haptologo > ### Title: Haptoglobin concentration in blood serum of 8 healthy adults > ### Aliases: Haptologo > ### Keywords: datasets > > ### ** Examples > > str(Haptologo) `data.frame': 8 obs. of 1 variable: $ concent: num 1.82 3.32 1.07 1.27 0.49 ... > attach(Haptologo) > qqnorm(concent,col="blue") > qqline(concent,col="red") > shapiro.test(concent) Shapiro-Wilk normality test data: concent W = 0.9382, p-value = 0.5932 > t.test(concent,mu=2,alternative="less") One Sample t-test data: concent t = -0.5814, df = 7, p-value = 0.2896 alternative hypothesis: true mean is less than 2 95 percent confidence interval: -Inf 2.595669 sample estimates: mean of x 1.73625 > detach(Haptologo) > > > > cleanEx(); ..nameEx <- "Hardware" > > ### * Hardware > > flush(stderr()); flush(stdout()) > > ### Name: Hardware > ### Title: Daily receipts for a small hardware store for 31 working days > ### Aliases: Hardware > ### Keywords: datasets > > ### ** Examples > > str(Hardware) `data.frame': 31 obs. of 1 variable: $ receipt: num 98.5 195.6 73.6 156.8 184.7 ... > attach(Hardware) > stem(receipt) The decimal point is 2 digit(s) to the right of the | 0 | 4 0 | 567 1 | 000 1 | 5666777789 2 | 00001123 2 | 569 3 | 3 | 8 4 | 2 4 | 5 | 3 > detach(Hardware) > > > > cleanEx(); ..nameEx <- "Hardwood" > > ### * Hardwood > > flush(stderr()); flush(stdout()) > > ### Name: Hardwood > ### Title: Tensile strength of Kraft paper for different percentages of > ### hardwood in the batches of pulp > ### Aliases: Hardwood > ### Keywords: datasets > > ### ** Examples > > str(Hardwood) `data.frame': 19 obs. of 2 variables: $ tensile : num 6.3 11.1 20 24 26.1 30 33.8 34 38.1 39.9 ... $ hardwood: num 1 1.5 2 3 4 4.5 5 5.5 6 6.5 ... > attach(Hardwood) > plot(hardwood,tensile) > model <- lm(tensile~hardwood) > abline(model) > summary(model) Call: lm(formula = tensile ~ hardwood) Residuals: Min 1Q Median 3Q Max -25.986 -3.749 2.938 7.675 15.840 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 21.3213 5.4302 3.926 0.00109 ** hardwood 1.7710 0.6478 2.734 0.01414 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.82 on 17 degrees of freedom Multiple R-Squared: 0.3054, Adjusted R-squared: 0.2645 F-statistic: 7.474 on 1 and 17 DF, p-value: 0.01414 > anova(model) Analysis of Variance Table Response: tensile Df Sum Sq Mean Sq F value Pr(>F) hardwood 1 1043.43 1043.43 7.4736 0.01414 * Residuals 17 2373.46 139.62 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > rm(model) > detach(Hardwood) > > > > cleanEx(); ..nameEx <- "Heat" > > ### * Heat > > flush(stderr()); flush(stdout()) > > ### Name: Heat > ### Title: Primary heating sources of homes on indian reservations versus > ### all households > ### Aliases: Heat > ### Keywords: datasets > > ### ** Examples > > str(Heat) `data.frame': 6 obs. of 4 variables: $ Fuel : Factor w/ 6 levels "Electricity",..: 5 3 1 2 6 4 $ Reserv : int 16 22 19 6 34 4 $ All.US : int 48 9 25 9 8 1 $ Not.Rese: int 51 6 26 12 4 1 > attach(Heat) > MAT <- cbind(Reserv, All.US, Not.Rese) > row.names(MAT) <- c("Utility Gas","LP bottled Gas","Electricity", + "Fuel Oil","Wood","Other Fuel") > MAT Reserv All.US Not.Rese Utility Gas 16 48 51 LP bottled Gas 22 9 6 Electricity 19 25 26 Fuel Oil 6 9 12 Wood 34 8 4 Other Fuel 4 1 1 > barplot(t(MAT),beside=TRUE,legend=TRUE,main="Heating of American Indian Homes") > sum(Reserv) [1] 101 > sum(All.US) [1] 100 > sum(Not.Rese) [1] 100 > detach(Heat) > > > > cleanEx(); ..nameEx <- "Heating" > > ### * Heating > > flush(stderr()); flush(stdout()) > > ### Name: Heating > ### Title: Fuel efficiency ratings for three types of oil heaters > ### Aliases: Heating > ### Keywords: datasets > > ### ** Examples > > str(Heating) `data.frame': 30 obs. of 6 variables: $ TypeA : int 75 71 74 86 77 84 76 75 57 96 ... $ TypeB : int 73 83 70 66 54 71 74 76 92 75 ... $ TypeC : int 60 63 74 56 61 73 71 62 91 64 ... $ Rating: int 75 71 74 86 77 84 76 75 57 96 ... $ Type : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks : num 20 12 17 27 24 26 22.5 20 3 30 ... > attach(Heating) > boxplot(Rating~Type) > kruskal.test(Rating~as.factor(Type)) Kruskal-Wallis rank sum test data: Rating by as.factor(Type) Kruskal-Wallis chi-squared = 6.264, df = 2, p-value = 0.04363 > detach(Heating) > > > > cleanEx(); ..nameEx <- "Hodgkin" > > ### * Hodgkin > > flush(stderr()); flush(stdout()) > > ### Name: Hodgkin > ### Title: Results of treatments for Hodgkin's disease > ### Aliases: Hodgkin > ### Keywords: datasets > > ### ** Examples > > str(Hodgkin) `data.frame': 4 obs. of 4 variables: $ Histological: Factor w/ 4 levels "LD","LP","MC",..: 2 4 3 1 $ Positive : int 74 68 154 18 $ Partial : int 18 16 54 10 $ None : int 12 12 58 44 > attach(Hodgkin) > HOD <- as.matrix(Hodgkin[,2:4]) > rownames(HOD) <- Histological > HOD Positive Partial None LP 74 18 12 NS 68 16 12 MC 154 54 58 LD 18 10 44 > barplot(t(HOD),legend=TRUE,beside=TRUE) > detach(Hodgkin) > remove(HOD) > > > > cleanEx(); ..nameEx <- "Homes" > > ### * Homes > > flush(stderr()); flush(stdout()) > > ### Name: Homes > ### Title: Median prices of single-family homes in 65 metropolitan > ### statistical areas > ### Aliases: Homes > ### Keywords: datasets > > ### ** Examples > > str(Homes) `data.frame': 65 obs. of 5 variables: $ City : Factor w/ 65 levels "Akron OH","Albuquerque NM",..: 1 2 3 4 5 6 7 8 9 10 ... $ X1994 : int 81600 103100 209500 93200 115700 78400 99500 170600 86400 82400 ... $ Region : Factor w/ 4 levels "Midwest","Northeast",..: 1 4 4 3 2 3 3 2 3 2 ... $ X2000 : int 100900 128000 300800 125400 145200 106400 122200 255000 114300 78800 ... $ difference: int 19300 24900 91300 32200 29500 28000 22700 84400 27900 -3600 ... > attach(Homes) > EDA(X2000) [1] "X2000" Size (n) Missing Minimum 1st Qu Mean Median 6.500000e+01 0.000000e+00 7.450000e+04 1.041000e+05 1.364938e+05 1.194000e+05 TrMean 3rd Qu Max. Stdev. Var. SE Mean 1.293593e+05 1.414500e+05 4.186000e+05 6.012338e+04 3.614821e+09 7.457388e+03 I.Q.R. Range Kurtosis Skewness SW p-val 3.735000e+04 3.441000e+05 6.680000e+00 2.361000e+00 0.000000e+00 > boxplot(X1994,X2000,names=c("1994","2000"),col=c("red","blue"),ylab="Cost") > boxplot(X2000~Region) > detach(Homes) > > > > cleanEx(); ..nameEx <- "Homework" > > ### * Homework > > flush(stderr()); flush(stdout()) > > ### Name: Homework > ### Title: Number of hours per week spent on homework for private and > ### public high school students > ### Aliases: Homework > ### Keywords: datasets > > ### ** Examples > > str(Homework) `data.frame': 15 obs. of 2 variables: $ Private: num 21.3 16.8 8.5 12.6 15.8 19.3 18.5 24.6 18.3 12.9 ... $ Public : num 15.3 17.4 12.3 10.7 16.4 11.3 17.6 13.9 20.2 16.8 ... > attach(Homework) > boxplot(Private,Public) > t.test(Private,Public,conf.level=.98) Welch Two Sample t-test data: Private and Public t = 1.7134, df = 27.727, p-value = 0.0978 alternative hypothesis: true difference in means is not equal to 0 98 percent confidence interval: -1.201748 6.655081 sample estimates: mean of x mean of y 17.63333 14.90667 > detach(Homework) > > > > cleanEx(); ..nameEx <- "Honda" > > ### * Honda > > flush(stderr()); flush(stdout()) > > ### Name: Honda > ### Title: Miles per gallon for a Honda Civic on 35 different occasions > ### Aliases: Honda > ### Keywords: datasets > > ### ** Examples > > str(Honda) `data.frame': 35 obs. of 1 variable: $ mileage: num 39.3 40.8 30.6 34.5 37.8 40.4 43.6 36.3 40.7 36.3 ... > attach(Honda) > t.test(mileage,mu=40,alternative="less") One Sample t-test data: mileage t = -2.5255, df = 34, p-value = 0.00819 alternative hypothesis: true mean is less than 40 95 percent confidence interval: -Inf 39.49769 sample estimates: mean of x 38.48 > detach(Honda) > > > > cleanEx(); ..nameEx <- "Hostile" > > ### * Hostile > > flush(stderr()); flush(stdout()) > > ### Name: Hostile > ### Title: Hostility levels of high school students from rural, suburban, > ### and urban areas > ### Aliases: Hostile > ### Keywords: datasets > > ### ** Examples > > str(Hostile) `data.frame': 45 obs. of 6 variables: $ Rural : int 16 21 33 51 53 63 64 64 66 67 ... $ Suburban: int 22 37 52 63 65 67 70 72 73 74 ... $ Urban : int 33 53 54 72 74 76 80 82 83 83 ... $ HLT : int 16 21 33 51 53 63 64 64 66 67 ... $ Type : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks : num 1 2 4.5 7 9.5 12.5 14.5 14.5 17 18.5 ... > attach(Hostile) > boxplot(HLT~Type) > kruskal.test(HLT~as.factor(Type)) Kruskal-Wallis rank sum test data: HLT by as.factor(Type) Kruskal-Wallis chi-squared = 11.6066, df = 2, p-value = 0.003018 > detach(Hostile) > > > > cleanEx(); ..nameEx <- "Housing" > > ### * Housing > > flush(stderr()); flush(stdout()) > > ### Name: Housing > ### Title: Median home prices for 1984 and 1993 in 37 markets across the > ### U.S. > ### Aliases: Housing > ### Keywords: datasets > > ### ** Examples > > str(Housing) `data.frame': 37 obs. of 3 variables: $ City : Factor w/ 37 levels "Albany","Anaheim",..: 1 2 3 4 5 6 7 8 9 10 ... $ X1984: int 52400 134900 64600 65200 66600 102000 77500 59600 65600 60400 ... $ X1993: int 109900 222200 94000 113200 89000 165200 131300 85600 89200 89300 ... > attach(Housing) > stem(X1993) The decimal point is 4 digit(s) to the right of the | 6 | 1003899 8 | 1344679990246688 10 | 09033 12 | 1 14 | 4 16 | 586 18 | 20 | 0 22 | 2 24 | 9 26 | 28 | 7 > stem(X1984) The decimal point is 4 digit(s) to the right of the | 4 | 8 5 | 0248 6 | 000112444555678 7 | 02568 8 | 0345 9 | 3 10 | 237 11 | 5 12 | 2 13 | 35 > par(mfrow=c(2,2)) > stripchart(x=list(X1984,X1993),method="stack",pch=1,cex=1.2,col=c("orange","pink"),group.names=c("1984","1993")) > title(main="Problem 5.82 \n We have not talked about this kind of graph before...") > hist(X1993,breaks="Scott",col="pink") > hist(X1984,breaks="Scott",col="orange") > plot(density(X1993),col="red",xlab="",ylab="",main="",ylim=c(0,.00003)) > lines(density(X1984),col="orange") > par(mfrow=c(1,1)) > boxplot(X1993,X1984,col=c("pink","orange"),names=c("1993","1984"),main="Problem 5.82") > sign.test(X1984,conf.level=.98) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: X1984 s = 37, p-value = 1.455e-11 alternative hypothesis: true median is not equal to 0 98 percent confidence interval: 63591.10 79622.56 sample estimates: median of x 66600 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9799 63600.0 79600.00 Interpolated CI 0.9800 63591.1 79622.56 Upper Achieved CI 0.9924 62100.0 83400.00 > sign.test(X1993,conf.level=.98) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: X1993 s = 37, p-value = 1.455e-11 alternative hypothesis: true median is not equal to 0 98 percent confidence interval: 85591.69 109915.43 sample estimates: median of x 94000 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9799 85600.00 109900.0 Interpolated CI 0.9800 85591.69 109915.4 Upper Achieved CI 0.9924 84200.00 112500.0 > # 98 > # Placing on a common number line... > my.axis <- function(side, at, labels,...) + {for(i in seq(along=at)) axis(side=side, at=at[i], labels=labels[i],...) } > > plot(1,type="n",xlim=c(63000,110000),ylim=c(0,1), + xlab="Median House Price",ylab="",yaxt="n",main="") > title(main="98 Percent Confidence Intervals") > my.axis(2,at=c(.25,.75),labels=c("1984","1993"), cex.axis=1.2 ,las=2) > lines( c(63591.1, 79622.56),c(.25,.25),col="orange",lwd=24) > lines( c(85591.69, 109915.4),c(.75,.75),col="pink",lwd=24) > detach(Housing) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Hurrican" > > ### * Hurrican > > flush(stderr()); flush(stdout()) > > ### Name: Hurrican > ### Title: Number of storms, hurricanes and El Nino effects from 1950 > ### through 1995 > ### Aliases: Hurrican > ### Keywords: datasets > > ### ** Examples > > str(Hurrican) `data.frame': 46 obs. of 5 variables: $ year : int 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 ... $ storms : int 13 10 7 14 11 12 8 8 10 11 ... $ hurrican: int 11 8 6 6 8 9 4 3 7 7 ... $ ElNino : Factor w/ 3 levels "cold","neutral",..: 1 3 2 3 1 1 2 3 2 2 ... $ code : int 1 2 3 2 1 1 3 2 3 3 ... > attach(Hurrican) > barplot(table(hurrican),col="blue",main="Problem 1.38", + xlab="Number of Hurricanes",ylab="Number of Seasons") > boxplot(storms~ElNino) > anova(lm(storms~ElNino)) Analysis of Variance Table Response: storms Df Sum Sq Mean Sq F value Pr(>F) ElNino 2 113.70 56.85 7.6299 0.001459 ** Residuals 43 320.40 7.45 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Hurrican) > > > > cleanEx(); ..nameEx <- "Iceberg" > > ### * Iceberg > > flush(stderr()); flush(stdout()) > > ### Name: Iceberg > ### Title: Number of icebergs sighted each month south of Newfoundland and > ### south of the Grand Banks in 1920 > ### Aliases: Iceberg > ### Keywords: datasets > > ### ** Examples > > str(Iceberg) `data.frame': 12 obs. of 3 variables: $ Month : Factor w/ 12 levels "Apr","Aug","Dec",..: 5 4 8 1 9 7 6 2 12 11 ... $ Newfound: int 3 10 36 83 130 68 25 13 9 4 ... $ GrandBk : int 0 1 4 9 18 13 3 2 1 0 ... > attach(Iceberg) > plot(GrandBk,Newfound) > abline(lm(Newfound~GrandBk)) > detach(Iceberg) > > > > cleanEx(); ..nameEx <- "Income" > > ### * Income > > flush(stderr()); flush(stdout()) > > ### Name: Income > ### Title: Percent change in personal income from 1st to 2nd quarter in > ### 2000 > ### Aliases: Income > ### Keywords: datasets > > ### ** Examples > > str(Income) `data.frame': 51 obs. of 6 variables: $ State : Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ income : num 1.6 1.7 0.7 1.4 1.4 2.1 0.5 2.4 0.3 2.1 ... $ C3 : int 4 4 2 3 3 5 1 5 1 5 ... $ Class : int 1 2 3 4 5 NA NA NA NA NA ... $ freq : int 2 5 13 22 9 NA NA NA NA NA ... $ percent: num 3.92 9.80 25.49 43.14 17.65 ... > attach(Income) > CATS <-factor(cut(income,breaks=c(0.5,1.0,1.5,2,max(income)) )) > table(CATS) CATS (0.5,1] (1,1.5] (1.5,2] (2,2.5] 5 13 22 9 > table(CATS)/length(income) CATS (0.5,1] (1,1.5] (1.5,2] (2,2.5] 0.09803922 0.25490196 0.43137255 0.17647059 > barplot(table(CATS),col="lightblue",main="Problem 1.33") > detach(Income) > remove(CATS) > > > > cleanEx(); ..nameEx <- "Independent" > > ### * Independent > > flush(stderr()); flush(stdout()) > > ### Name: Independent > ### Title: Illustrates a comparison problem for long-tailed distributions > ### Aliases: Independent > ### Keywords: datasets > > ### ** Examples > > str(Independent) `data.frame': 46 obs. of 3 variables: $ score: int 67 72 82 83 86 87 90 91 92 92 ... $ group: int 1 1 1 1 1 1 1 1 1 1 ... $ ranks: num 2 5 9 10 13.5 16 21.5 23.5 25.5 25.5 ... > attach(Independent) > boxplot(score~group) > wilcox.test(score~group) Warning in wilcox.test.default(x = c(67, 72, 82, 83, 86, 87, 90, 91, 92, : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: score by group W = 349.5, p-value = 0.06321 alternative hypothesis: true mu is not equal to 0 > detach(Independent) > > > > cleanEx(); ..nameEx <- "Indian" > > ### * Indian > > flush(stderr()); flush(stdout()) > > ### Name: Indian > ### Title: Educational attainment versus per capita income and poverty rate > ### for American indians living on reservations > ### Aliases: Indian > ### Keywords: datasets > > ### ** Examples > > str(Indian) `data.frame': 10 obs. of 4 variables: $ Reserv : Factor w/ 10 levels "Blackfeet","Fort Apache",..: 1 4 8 10 7 9 2 6 5 3 $ highsch: num 66.3 62.6 59.3 55.4 55.2 49.4 48.3 47.3 41.1 37.3 $ income : int 4718 4566 3739 3904 3115 3173 3805 3113 3735 3176 $ poverty: num 50.1 49.4 60.4 52.5 66.6 62.5 52.7 65.7 57.8 64.4 > attach(Indian) > par(mfrow=c(1,2)) > plot(highsch,income,xlab="Percent High School Graduates", ylab="Per capita income") > plot(highsch,poverty,xlab="Percent High School Graduates", ylab="Poverty rate") > par(mfrow=c(1,1)) > cor(cbind(highsch,income,poverty)) highsch income poverty highsch 1.0000000 0.6964546 -0.5418413 income 0.6964546 1.0000000 -0.9284242 poverty -0.5418413 -0.9284242 1.0000000 > detach(Indian) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Indiapol" > > ### * Indiapol > > flush(stderr()); flush(stdout()) > > ### Name: Indiapol > ### Title: Average miles per hour for the winners of the Indianapolis 500 > ### race > ### Aliases: Indiapol > ### Keywords: datasets > > ### ** Examples > > str(Indiapol) `data.frame': 39 obs. of 3 variables: $ year : int 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 ... $ speed : num 139 140 143 147 151 ... $ yr.1960: int 1 2 3 4 5 6 7 8 9 10 ... > attach(Indiapol) > plot(year,speed,type="l") > detach(Indiapol) > > > > cleanEx(); ..nameEx <- "Indy500" > > ### * Indy500 > > flush(stderr()); flush(stdout()) > > ### Name: Indy500 > ### Title: Qualifying miles per hour and number of previous starts for > ### drivers in 79th Indianapolis 500 race > ### Aliases: Indy500 > ### Keywords: datasets > > ### ** Examples > > str(Indy500) `data.frame': 33 obs. of 4 variables: $ driver: Factor w/ 33 levels "andretti","bachelart",..: 4 20 12 1 32 14 13 23 31 22 ... $ qualif: num 232 231 231 229 228 ... $ starts: int 13 10 5 10 1 1 2 3 3 3 ... $ group : int 2 2 2 2 1 1 1 1 1 1 ... > attach(Indy500) > stripchart(qualif~group, method="stack",pch=19,col=c("red","blue")) > boxplot(qualif~group) > t.test(qualif~group) Welch Two Sample t-test data: qualif by group t = -1.9197, df = 12.033, p-value = 0.07892 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -3.0111081 0.1899245 sample estimates: mean in group 1 mean in group 2 226.4538 227.8644 > detach(Indy500) > > > > cleanEx(); ..nameEx <- "Inflatio" > > ### * Inflatio > > flush(stderr()); flush(stdout()) > > ### Name: Inflatio > ### Title: Private pay increase of salaried employees versus inflation rate > ### Aliases: Inflatio > ### Keywords: datasets > > ### ** Examples > > str(Inflatio) `data.frame': 24 obs. of 5 variables: $ year : int 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 ... $ pay : num 4.53 4.86 5.25 5.69 6.16 ... $ increase : num NA 7.3 8 8.4 8.3 8.1 8.9 5.9 4.4 3.7 ... $ inflation: num 6.9 4.9 6.7 9 13.3 12.5 8.9 3.8 3.8 3.9 ... $ C6.T : Factor w/ 3 levels "alow","bmiddle",..: 3 2 3 3 3 3 3 1 1 1 ... > attach(Inflatio) > plot(inflation,increase) > cor(inflation,increase,use="complete.obs") [1] 0.8164214 > detach(Inflatio) > > > > cleanEx(); ..nameEx <- "Inletoil" > > ### * Inletoil > > flush(stderr()); flush(stdout()) > > ### Name: Inletoil > ### Title: Inlet oil temperature through a valve > ### Aliases: Inletoil > ### Keywords: datasets > > ### ** Examples > > str(Inletoil) `data.frame': 12 obs. of 1 variable: $ temp: int 93 99 97 99 94 91 93 90 89 92 ... > attach(Inletoil) > t.test(temp)$conf [1] 91.17727 95.48940 attr(,"conf.level") [1] 0.95 > t.test(temp,mu=98,alternative="less") One Sample t-test data: temp t = -4.7639, df = 11, p-value = 0.0002932 alternative hypothesis: true mean is less than 98 95 percent confidence interval: -Inf 95.09256 sample estimates: mean of x 93.33333 > detach(Inletoil) > > > > cleanEx(); ..nameEx <- "Inmate" > > ### * Inmate > > flush(stderr()); flush(stdout()) > > ### Name: Inmate > ### Title: Type of drug offense by race > ### Aliases: Inmate > ### Keywords: datasets > > ### ** Examples > > str(Inmate) `data.frame': 3 obs. of 5 variables: $ Race : Factor w/ 3 levels "black","hispanic",..: 3 1 2 $ heroin : int 407 1156 1314 $ crack : int 106 2513 348 $ cocaine : int 4525 4439 7297 $ marijuan: int 2825 442 2675 > attach(Inmate) > Inmate Race heroin crack cocaine marijuan 1 white 407 106 4525 2825 2 black 1156 2513 4439 442 3 hispanic 1314 348 7297 2675 > chisq.test(Inmate[,2:5]) Pearson's Chi-squared test data: Inmate[, 2:5] X-squared = 6385.21, df = 6, p-value < 2.2e-16 > detach(Inmate) > > > > cleanEx(); ..nameEx <- "Inspect" > > ### * Inspect > > flush(stderr()); flush(stdout()) > > ### Name: Inspect > ### Title: Percent of vehicles passing inspection by type inspection > ### station > ### Aliases: Inspect > ### Keywords: datasets > > ### ** Examples > > str(Inspect) `data.frame': 6 obs. of 4 variables: $ Type : Factor w/ 6 levels "auto inspection",..: 1 2 6 4 3 5 $ less70 : int 1 16 16 19 4 1 $ X70.85 : int 8 13 11 21 4 5 $ great85: int 4 7 6 6 4 28 > attach(Inspect) > Inspect Type less70 X70.85 great85 1 auto inspection 1 8 4 2 auto repair 16 13 7 3 tire store 16 11 6 4 gas station 19 21 6 5 car care center 4 4 4 6 new car dealer 1 5 28 > chisq.test(Inspect[,2:4]) Warning in chisq.test(Inspect[, 2:4]) : Chi-squared approximation may be incorrect Pearson's Chi-squared test data: Inspect[, 2:4] X-squared = 61.027, df = 10, p-value = 2.316e-09 > detach(Inspect) > > > > cleanEx(); ..nameEx <- "Insulate" > > ### * Insulate > > flush(stderr()); flush(stdout()) > > ### Name: Insulate > ### Title: Heat loss through a new insulating medium > ### Aliases: Insulate > ### Keywords: datasets > > ### ** Examples > > str(Insulate) `data.frame': 10 obs. of 2 variables: $ temp: int -10 -10 0 0 10 10 20 20 30 30 $ loss: int 96 91 84 82 68 75 49 51 28 24 > attach(Insulate) > summary(lm(loss~temp)) Call: lm(formula = loss ~ temp) Residuals: Min 1Q Median 3Q Max -7.40 -3.00 0.70 2.85 10.20 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 81.6000 2.1772 37.48 2.82e-10 *** temp -1.6800 0.1257 -13.37 9.39e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.621 on 8 degrees of freedom Multiple R-Squared: 0.9571, Adjusted R-squared: 0.9518 F-statistic: 178.6 on 1 and 8 DF, p-value: 9.394e-07 > detach(Insulate) > > > > cleanEx(); ..nameEx <- "Iqgpa" > > ### * Iqgpa > > flush(stderr()); flush(stdout()) > > ### Name: Iqgpa > ### Title: GPA versus IQ for 12 individuals > ### Aliases: Iqgpa > ### Keywords: datasets > > ### ** Examples > > str(Iqgpa) `data.frame': 12 obs. of 2 variables: $ IQ : int 115 132 125 120 119 132 105 114 106 139 ... $ GPA: num 2.2 3.3 3 2.6 2.9 3.5 2.2 2.7 3.7 1.8 ... > attach(Iqgpa) > plot(IQ,GPA) > model <- lm(GPA~IQ) > abline(model) > summary(model) Call: lm(formula = GPA ~ IQ) Residuals: Min 1Q Median 3Q Max -1.07841 -0.46768 -0.02206 0.48912 0.90423 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.530328 2.305324 1.098 0.298 IQ 0.002504 0.018988 0.132 0.898 Residual standard error: 0.6572 on 10 degrees of freedom Multiple R-Squared: 0.001736, Adjusted R-squared: -0.09809 F-statistic: 0.01739 on 1 and 10 DF, p-value: 0.8977 > detach(Iqgpa) > remove(model) > > > > cleanEx(); ..nameEx <- "Irises" > > ### * Irises > > flush(stderr()); flush(stdout()) > > ### Name: Irises > ### Title: R.A. Fishers famous data on sepal length of a species of Iris > ### Setosa > ### Aliases: Irises > ### Keywords: datasets > > ### ** Examples > > str(Irises) `data.frame': 150 obs. of 14 variables: $ sepalL1 : num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... $ sepalW1 : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... $ petalL1 : num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... $ petalW1 : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... $ sepalL2 : num 7 6.4 6.9 5.5 6.5 5.7 6.3 4.9 6.6 5.2 ... $ sepalW2 : num 3.2 3.2 3.1 2.3 2.8 2.8 3.3 2.4 2.9 2.7 ... $ petalL2 : num 4.7 4.5 4.9 4 4.6 4.5 4.7 3.3 4.6 3.9 ... $ peatalW2: num 1.4 1.5 1.5 1.3 1.5 1.3 1.6 1 1.3 1.4 ... $ sepalL3 : num 6.3 5.8 7.1 6.3 6.5 7.6 4.9 7.3 6.7 7.2 ... $ sepalW3 : num 3.3 2.7 3 2.9 3 3 2.5 2.9 2.5 3.6 ... $ petalL3 : num 6 5.1 5.9 5.6 5.8 6.6 4.5 6.3 5.8 6.1 ... $ petalW3 : num 2.5 1.9 2.1 1.8 2.2 2.1 1.7 1.8 1.8 2.5 ... $ sepalL : num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... $ sample : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Irises) > EDA(sepalL1) [1] "sepalL1" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 50.000 100.000 4.300 4.800 5.006 5.000 5.002 5.200 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 5.800 0.352 0.124 0.050 0.400 1.500 -0.451 0.113 SW p-val 0.460 > t.test(sepalL1,conf.level=.99)$conf [1] 4.872406 5.139594 attr(,"conf.level") [1] 0.99 > detach(Irises) > > > > cleanEx(); ..nameEx <- "Jdpower" > > ### * Jdpower > > flush(stderr()); flush(stdout()) > > ### Name: Jdpower > ### Title: Number of problems reported per 100 cars in 1994 versus 1995s > ### Aliases: Jdpower > ### Keywords: datasets > > ### ** Examples > > str(Jdpower) `data.frame': 29 obs. of 3 variables: $ Car : Factor w/ 29 levels "Acura","BMW",..: 12 14 1 10 27 17 2 9 20 29 ... $ X1994: int 75 54 101 92 69 91 114 134 99 108 ... $ X1995: int 55 60 64 71 74 79 82 82 83 86 ... > attach(Jdpower) > plot(X1994,X1995) > model <- lm(X1995~X1994) > abline(model) > model Call: lm(formula = X1995 ~ X1994) Coefficients: (Intercept) X1994 2.2241 0.9098 > cor(X1995,X1994) [1] 0.8220294 > detach(Jdpower) > > > > cleanEx(); ..nameEx <- "Jobsat" > > ### * Jobsat > > flush(stderr()); flush(stdout()) > > ### Name: Jobsat > ### Title: Job satisfaction and stress level for 9 school teachers > ### Aliases: Jobsat > ### Keywords: datasets > > ### ** Examples > > str(Jobsat) `data.frame': 9 obs. of 2 variables: $ WSPT : int 90 78 85 65 94 82 96 79 80 $ satisfac: num 3.6 5.3 4.7 8.9 3.2 4 3.8 6.2 6.5 > attach(Jobsat) > plot(WSPT,satisfac) > model <- lm(satisfac~WSPT) > abline(model) > summary(model) Call: lm(formula = satisfac ~ WSPT) Residuals: Min 1Q Median 3Q Max -1.34806 -0.34255 -0.03980 0.56522 0.91158 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 19.75457 2.48050 7.964 9.38e-05 *** WSPT -0.17569 0.02964 -5.928 0.000583 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7939 on 7 degrees of freedom Multiple R-Squared: 0.8339, Adjusted R-squared: 0.8102 F-statistic: 35.14 on 1 and 7 DF, p-value: 0.0005826 > detach(Jobsat) > remove(model) > > > > cleanEx(); ..nameEx <- "Kidsmoke" > > ### * Kidsmoke > > flush(stderr()); flush(stdout()) > > ### Name: Kidsmoke > ### Title: Smoking habits of boys and girls ages 12 to 18 > ### Aliases: Kidsmoke > ### Keywords: datasets > > ### ** Examples > > str(Kidsmoke) `data.frame': 1000 obs. of 2 variables: $ gender: int 0 0 0 0 1 1 1 0 1 1 ... $ smoke : int 0 0 0 0 1 0 0 0 0 0 ... > attach(Kidsmoke) > table(gender,smoke) smoke gender 0 1 0 375 105 1 418 102 > addmargins(table(gender,smoke)) smoke gender 0 1 Sum 0 375 105 480 1 418 102 520 Sum 793 207 1000 > addmargins(table(gender,smoke)/1000) smoke gender 0 1 Sum 0 0.375 0.105 0.48 1 0.418 0.102 0.52 Sum 0.793 0.207 1.00 > detach(Kidsmoke) > > > > cleanEx(); ..nameEx <- "Kilowatt" > > ### * Kilowatt > > flush(stderr()); flush(stdout()) > > ### Name: Kilowatt > ### Title: Rates per kilowatt-hour for each of the 50 states and DC > ### Aliases: Kilowatt > ### Keywords: datasets > > ### ** Examples > > str(Kilowatt) `data.frame': 51 obs. of 2 variables: $ State: Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ rate : num 6.34 8.38 7.35 6.68 6.74 ... > attach(Kilowatt) > EDA(rate) [1] "rate" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 51.000 0.000 3.380 6.010 6.761 6.570 6.727 7.340 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 11.290 1.610 2.592 0.225 1.330 7.910 0.561 0.505 SW p-val 0.022 > detach(Kilowatt) > > > > cleanEx(); ..nameEx <- "Kinder" > > ### * Kinder > > flush(stderr()); flush(stdout()) > > ### Name: Kinder > ### Title: Reading scores for first grade children who attended > ### kindergarten versus those who did not > ### Aliases: Kinder > ### Keywords: datasets > > ### ** Examples > > str(Kinder) `data.frame': 8 obs. of 3 variables: $ Pair : int 1 2 3 4 5 6 7 8 $ Kinder : int 83 74 67 64 70 67 81 64 $ NoKinder: int 78 74 63 66 68 63 77 65 > attach(Kinder) > DIF <- Kinder - NoKinder > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.8792, p-value = 0.1852 > t.test(Kinder, NoKinder,paired=TRUE,alternative="greater") Paired t-test data: Kinder and NoKinder t = 2.1166, df = 7, p-value = 0.03604 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 0.2097915 Inf sample estimates: mean of the differences 2 > detach(Kinder) > remove(DIF) > > > > cleanEx(); ..nameEx <- "Laminect" > > ### * Laminect > > flush(stderr()); flush(stdout()) > > ### Name: Laminect > ### Title: Median costs of laminectomies at hospitals across North Carolina > ### in 1992 > ### Aliases: Laminect > ### Keywords: datasets > > ### ** Examples > > str(Laminect) `data.frame': 46 obs. of 5 variables: $ cost : int 7455 5223 4142 6278 9158 5807 7733 5782 8892 4288 ... $ class : int 2 1 2 2 2 3 2 1 1 2 ... $ Rural : int 5223 5782 8892 7405 8460 4353 9296 5227 6535 10238 ... $ Regional: int 7455 4142 6278 9158 7733 4288 7054 8308 11391 3339 ... $ Metropol: int 5807 6943 4925 4556 2696 6177 5477 5656 5621 4324 ... > attach(Laminect) > boxplot(cost~class) > anova(lm(cost~as.factor(class))) Analysis of Variance Table Response: cost Df Sum Sq Mean Sq F value Pr(>F) as.factor(class) 2 12838182 6419091 1.6658 0.201 Residuals 43 165698288 3853449 > detach(Laminect) > > > > cleanEx(); ..nameEx <- "Lead" > > ### * Lead > > flush(stderr()); flush(stdout()) > > ### Name: Lead > ### Title: Lead levels in children's blood whose parents worked in a > ### battery factory > ### Aliases: Lead > ### Keywords: datasets > > ### ** Examples > > str(Lead) `data.frame': 33 obs. of 3 variables: $ Pair : int 1 2 3 4 5 6 7 8 9 10 ... $ exposed: int 38 23 41 18 37 36 23 62 31 34 ... $ control: int 16 18 18 24 19 11 10 15 16 18 ... > attach(Lead) > boxplot(exposed,control, names=c("Exposed","Control"),col=c("red","blue")) > detach(Lead) > > > > cleanEx(); ..nameEx <- "Leader" > > ### * Leader > > flush(stderr()); flush(stdout()) > > ### Name: Leader > ### Title: Leadership exam scores by age for employees on an industrial > ### plant > ### Aliases: Leader > ### Keywords: datasets > > ### ** Examples > > str(Leader) `data.frame': 34 obs. of 2 variables: $ under35: int 25 13 9 46 25 30 17 20 17 20 ... $ over35 : int 24 31 43 23 13 23 21 42 34 14 ... > attach(Leader) > boxplot(under35,over35,names=c("Under 35","Over 35"),col=c("green","brown")) > t.test(under35,over35) Welch Two Sample t-test data: under35 and over35 t = -1.1462, df = 60.522, p-value = 0.2562 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -9.505807 2.579337 sample estimates: mean of x mean of y 24.12500 27.58824 > detach(Leader) > > > > cleanEx(); ..nameEx <- "Lethal" > > ### * Lethal > > flush(stderr()); flush(stdout()) > > ### Name: Lethal > ### Title: Survival time of mice injected with an experimental lethal drug > ### Aliases: Lethal > ### Keywords: datasets > > ### ** Examples > > str(Lethal) `data.frame': 30 obs. of 1 variable: $ survival: int 32 37 44 41 65 27 35 29 54 42 ... > attach(Lethal) > sign.test(survival,md=45,alternative="less") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: survival s = 8, p-value = 0.008062 alternative hypothesis: true median is less than 45 95 percent confidence interval: -Inf 41.98759 sample estimates: median of x 38 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.8998 -Inf 41.0000 Interpolated CI 0.9500 -Inf 41.9876 Upper Achieved CI 0.9506 -Inf 42.0000 > detach(Lethal) > > > > cleanEx(); ..nameEx <- "Life" > > ### * Life > > flush(stderr()); flush(stdout()) > > ### Name: Life > ### Title: Life expectancy of men and women in U.S. > ### Aliases: Life > ### Keywords: datasets > > ### ** Examples > > str(Life) `data.frame': 8 obs. of 3 variables: $ year : int 1920 1930 1940 1950 1960 1970 1980 1990 $ Men : num 53.6 58.1 60.8 65.6 66.6 67.1 70 71.8 $ Women: num 54.6 61.6 65.2 71.1 73.1 74.7 77.5 78.8 > attach(Life) > plot(year,Men,type="l",ylim=c(min(Men,Women),max(Men,Women)),col="blue", + main="Life Expectancy versus Year",ylab="Age",xlab="Year") > lines(year,Women,col="red") > text(1955,65,"Men",col="blue") > text(1955,70,"Women",col="red") > detach(Life) > > > > cleanEx(); ..nameEx <- "Lifespan" > > ### * Lifespan > > flush(stderr()); flush(stdout()) > > ### Name: Lifespan > ### Title: Life span of electronic components used in a spacecraft versus > ### heat > ### Aliases: Lifespan > ### Keywords: datasets > > ### ** Examples > > str(Lifespan) `data.frame': 6 obs. of 4 variables: $ heat : int 50 100 150 200 250 300 $ life : int 875 884 762 424 365 128 $ RESI1: num -100.1 69.7 108.6 -68.6 33.3 ... $ FITS1: num 975 814 653 493 332 ... > attach(Lifespan) > plot(heat,life) > model <- lm(life~heat) > model Call: lm(formula = life ~ heat) Coefficients: (Intercept) heat 1136.000 -3.217 > resid(model) 1 2 3 4 5 6 -100.14286 69.71429 108.57143 -68.57143 33.28571 -42.85714 > sum((resid(model))^2) [1] 34323.14 > anova(model) Analysis of Variance Table Response: life Df Sum Sq Mean Sq F value Pr(>F) heat 1 452813 452813 52.771 0.001907 ** Residuals 4 34323 8581 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > # plot(model) # Used for diagnostic purposes > detach(Lifespan) > > > > cleanEx(); ..nameEx <- "Ligntmonth" > > ### * Ligntmonth > > flush(stderr()); flush(stdout()) > > ### Name: Ligntmonth > ### Title: Relationship between damage reports and deaths caused by > ### lightning > ### Aliases: Ligntmonth > ### Keywords: datasets > > ### ** Examples > > str(Ligntmonth) `data.frame': 12 obs. of 4 variables: $ Month : Factor w/ 12 levels "1/01/2000","10/01/2000",..: 1 5 6 7 8 9 10 11 12 2 ... $ deaths : int 5 6 40 97 347 690 934 687 281 51 ... $ injuries: int 28 29 158 288 910 1970 2960 2345 869 202 ... $ damage : int 102 150 425 996 2169 3935 5155 4280 1755 514 ... > attach(Ligntmonth) > plot(damage,deaths) > detach(Ligntmonth) > > > > cleanEx(); ..nameEx <- "Lodge" > > ### * Lodge > > flush(stderr()); flush(stdout()) > > ### Name: Lodge > ### Title: Measured traffic at three prospective locations for a motor > ### lodge > ### Aliases: Lodge > ### Keywords: datasets > > ### ** Examples > > str(Lodge) `data.frame': 45 obs. of 6 variables: $ SiteA : int 162 154 174 148 150 148 185 157 164 172 ... $ SiteB : int 165 193 178 184 157 165 204 195 183 189 ... $ SiteC : int 165 160 155 168 140 151 163 175 182 150 ... $ Traffic: int 162 154 174 148 150 148 185 157 164 172 ... $ Site : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks : num 17 8 27 3.5 5.5 3.5 37.5 10.5 19.5 25 ... > attach(Lodge) > boxplot(Traffic~Site) > anova(lm(Traffic~as.factor(Site))) Analysis of Variance Table Response: Traffic Df Sum Sq Mean Sq F value Pr(>F) as.factor(Site) 2 3951.6 1975.8 9.1838 0.0004913 *** Residuals 42 9036.0 215.1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Lodge) > > > > cleanEx(); ..nameEx <- "Longtail" > > ### * Longtail > > flush(stderr()); flush(stdout()) > > ### Name: Longtail > ### Title: Long-tailed distributions to illustrate Kruskal Wallis test > ### Aliases: Longtail > ### Keywords: datasets > > ### ** Examples > > str(Longtail) `data.frame': 60 obs. of 6 variables: $ GroupA: int 62 68 70 76 78 89 80 81 83 84 ... $ GroupB: int 58 63 67 76 78 80 81 83 83 84 ... $ GroupC: int 57 60 70 73 74 75 76 77 78 78 ... $ score : int 62 68 70 76 78 89 80 81 83 84 ... $ Group : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks : num 4 7 8.5 15 20 49 25 28 34 38.5 ... > attach(Longtail) > boxplot(score~Group) > kruskal.test(score~as.factor(Group)) Kruskal-Wallis rank sum test data: score by as.factor(Group) Kruskal-Wallis chi-squared = 5.5622, df = 2, p-value = 0.06197 > anova(lm(score~as.factor(Group))) Analysis of Variance Table Response: score Df Sum Sq Mean Sq F value Pr(>F) as.factor(Group) 2 333.7 166.9 1.3917 0.257 Residuals 57 6834.5 119.9 > detach(Longtail) > > > > cleanEx(); ..nameEx <- "Lowabil" > > ### * Lowabil > > flush(stderr()); flush(stdout()) > > ### Name: Lowabil > ### Title: Reading skills of 24 matched low ability students > ### Aliases: Lowabil > ### Keywords: datasets > > ### ** Examples > > str(Lowabil) `data.frame': 12 obs. of 3 variables: $ Pair : int 1 2 3 4 5 6 7 8 9 10 ... $ Experimt: int 82 65 63 71 48 74 61 65 73 92 ... $ Control : int 78 60 64 66 51 68 61 59 71 88 ... > attach(Lowabil) > DIF <- Experimt - Control > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9501, p-value = 0.639 > t.test(Experimt,Control,paired=TRUE) Paired t-test data: Experimt and Control t = 3.6035, df = 11, p-value = 0.004144 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 1.427113 5.906220 sample estimates: mean of the differences 3.666667 > detach(Lowabil) > remove(DIF) > > > > cleanEx(); ..nameEx <- "MATH" > > ### * MATH > > flush(stderr()); flush(stdout()) > > ### Name: MATH > ### Title: Standardized math test scores for 30 students > ### Aliases: MATH > ### Keywords: datasets > > ### ** Examples > > str(MATH) `data.frame': 30 obs. of 1 variable: $ math: int 44 49 62 45 51 59 57 55 70 64 ... > attach(MATH) > hist(math,col="pink") > CharlieZ <- (62-mean(math))/sd(math) > CharlieZ [1] 0.7284843 > detach(MATH) > remove(CharlieZ) > > > > cleanEx(); ..nameEx <- "Magnesiu" > > ### * Magnesiu > > flush(stderr()); flush(stdout()) > > ### Name: Magnesiu > ### Title: Magnesium concentration and distances between samples > ### Aliases: Magnesiu > ### Keywords: datasets > > ### ** Examples > > str(Magnesiu) `data.frame': 20 obs. of 4 variables: $ distance: int 0 1820 2542 2889 3460 4586 6020 6841 7232 10903 ... $ magnesiu: num 6.44 8.61 5.24 5.73 3.81 ... $ SRES1 : num 0.618 2.965 0.100 0.613 -0.960 ... $ FITS1 : num 5.77 5.31 5.13 5.04 4.90 ... > attach(Magnesiu) > model <- lm(magnesiu~distance) > plot(distance,magnesiu) > abline(model) > summary(model) Call: lm(formula = magnesiu ~ distance) Residuals: Min 1Q Median 3Q Max -1.5453 -0.7039 0.1234 0.6766 3.3006 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.768e+00 4.952e-01 11.647 8.15e-10 *** distance -2.518e-04 4.027e-05 -6.254 6.73e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.195 on 18 degrees of freedom Multiple R-Squared: 0.6848, Adjusted R-squared: 0.6673 F-statistic: 39.11 on 1 and 18 DF, p-value: 6.73e-06 > detach(Magnesiu) > remove(model) > > > > cleanEx(); ..nameEx <- "Malpract" > > ### * Malpract > > flush(stderr()); flush(stdout()) > > ### Name: Malpract > ### Title: Amounts awarded in 17 malpractice cases > ### Aliases: Malpract > ### Keywords: datasets > > ### ** Examples > > str(Malpract) `data.frame': 17 obs. of 1 variable: $ award: int 760 380 125 250 2800 450 100 150 2000 180 ... > attach(Malpract) > sign.test(award,conf.level=.90) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: award s = 17, p-value = 1.526e-05 alternative hypothesis: true median is not equal to 0 90 percent confidence interval: 263.4922 1149.2017 sample estimates: median of x 450 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.8565 275.0000 850.000 Interpolated CI 0.9000 263.4922 1149.202 Upper Achieved CI 0.9510 250.0000 1500.000 > detach(Malpract) > > > > cleanEx(); ..nameEx <- "Manager" > > ### * Manager > > flush(stderr()); flush(stdout()) > > ### Name: Manager > ### Title: Advertised salaries offered general managers of major > ### corporations in 1995 > ### Aliases: Manager > ### Keywords: datasets > > ### ** Examples > > str(Manager) `data.frame': 26 obs. of 1 variable: $ salary: int 95000 85000 65500 98000 150000 75000 60000 78000 100000 75500 ... > attach(Manager) > stem(salary) The decimal point is 4 digit(s) to the right of the | 4 | 5 6 | 00605568 8 | 55560558 10 | 000 12 | 00 14 | 000 16 | 18 | 5 > sign.test(salary) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: salary s = 26, p-value = 2.98e-08 alternative hypothesis: true median is not equal to 0 95 percent confidence interval: 76629.78 99954.81 sample estimates: median of x 87750 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9245 78000.00 99900.0 Interpolated CI 0.9500 76629.78 99954.8 Upper Achieved CI 0.9710 75500.00 100000.0 > detach(Manager) > > > > cleanEx(); ..nameEx <- "Marked" > > ### * Marked > > flush(stderr()); flush(stdout()) > > ### Name: Marked > ### Title: Percent of marked cars in 65 police departments in Florida > ### Aliases: Marked > ### Keywords: datasets > > ### ** Examples > > str(Marked) `data.frame': 65 obs. of 1 variable: $ percent: int 61 74 49 65 62 62 73 71 37 54 ... > attach(Marked) > EDA(percent) [1] "percent" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 65.000 0.000 37.000 54.000 61.108 60.000 60.932 68.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 92.000 9.980 99.598 1.238 14.000 55.000 0.273 0.443 SW p-val 0.072 > t.test(percent,mu=60,alternative="greater") One Sample t-test data: percent t = 0.8949, df = 64, p-value = 0.1871 alternative hypothesis: true mean is greater than 60 95 percent confidence interval: 59.0417 Inf sample estimates: mean of x 61.10769 > sign.test(percent,md=60,alternative="greater") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: percent s = 32, p-value = 0.4495 alternative hypothesis: true median is greater than 60 95 percent confidence interval: 57.33704 Inf sample estimates: median of x 60 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9320 58.000 Inf Interpolated CI 0.9500 57.337 Inf Upper Achieved CI 0.9592 57.000 Inf > detach(Marked) > > > > cleanEx(); ..nameEx <- "Mathcomp" > > ### * Mathcomp > > flush(stderr()); flush(stdout()) > > ### Name: Mathcomp > ### Title: Standardized math competency for a group of entering freshmen at > ### a small community college > ### Aliases: Mathcomp > ### Keywords: datasets > > ### ** Examples > > str(Mathcomp) `data.frame': 31 obs. of 1 variable: $ score: int 61 67 73 68 76 82 90 83 75 55 ... > attach(Mathcomp) > stem(score) The decimal point is 1 digit(s) to the right of the | 4 | 6 5 | 035 6 | 11557889 7 | 0003355567 8 | 2357 9 | 0025 10 | 0 > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 31.000 0.000 46.000 65.000 73.097 73.000 73.103 83.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 100.000 13.212 174.557 2.373 18.000 54.000 -0.600 0.015 SW p-val 0.886 > detach(Mathcomp) > > > > cleanEx(); ..nameEx <- "Mathpro" > > ### * Mathpro > > flush(stderr()); flush(stdout()) > > ### Name: Mathpro > ### Title: Math proficiency and SAT scores by states > ### Aliases: Mathpro > ### Keywords: datasets > > ### ** Examples > > str(Mathpro) `data.frame': 51 obs. of 10 variables: $ state1 : Factor w/ 20 levels "","Conn","D.C.",..: 2 4 3 5 6 7 8 10 9 12 ... $ Sat.M1 : int 472 464 443 446 480 466 463 479 475 486 ... $ Profic1: num 23.1 16.1 2.8 14.7 12.5 17.5 NA 17.1 NA 22.5 ... $ state2 : Factor w/ 33 levels "","Ala","Alaska",..: 2 3 4 5 6 7 8 9 10 11 ... $ Sat.M2 : int 529 477 496 518 482 513 466 508 546 574 ... $ Profic2: num 8.8 NA NA 9.7 13.9 18.2 12.8 19.5 NA 26.7 ... $ state : Factor w/ 51 levels "Ala","Alaska",..: 7 9 8 11 12 15 20 22 21 30 ... $ Sat.M : int 472 464 443 446 480 466 463 479 475 486 ... $ Profic : num 23.1 16.1 2.8 14.7 12.5 17.5 NA 17.1 NA 22.5 ... $ Group : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Mathpro) > model <- lm(Sat.M1~Profic1) > plot(Profic1,Sat.M1) > abline(model) > model Call: lm(formula = Sat.M1 ~ Profic1) Coefficients: (Intercept) Profic1 439.270 1.729 > detach(Mathpro) > remove(model) > > > > cleanEx(); ..nameEx <- "Maze" > > ### * Maze > > flush(stderr()); flush(stdout()) > > ### Name: Maze > ### Title: Error scores for four groups of experimental animals running a > ### maze > ### Aliases: Maze > ### Keywords: datasets > > ### ** Examples > > str(Maze) `data.frame': 32 obs. of 6 variables: $ CondA : int 16 12 15 13 15 14 15 14 NA NA ... $ CondB : int 20 18 22 17 21 19 18 18 NA NA ... $ CondC : int 9 11 14 15 8 10 11 10 NA NA ... $ CondD : int 15 14 18 20 16 17 17 16 NA NA ... $ score : int 16 12 15 13 15 14 15 14 20 18 ... $ condition: Factor w/ 4 levels "CondA","CondB",..: 1 1 1 1 1 1 1 1 2 2 ... > attach(Maze) > boxplot(score~condition) > anova(lm(score~condition)) Analysis of Variance Table Response: score Df Sum Sq Mean Sq F value Pr(>F) condition 3 287.750 95.917 27.903 1.465e-08 *** Residuals 28 96.250 3.437 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Maze) > > > > cleanEx(); ..nameEx <- "Median" > > ### * Median > > flush(stderr()); flush(stdout()) > > ### Name: Median > ### Title: Illustrates test of equality of medians with the Kruskal Wallis > ### test > ### Aliases: Median > ### Keywords: datasets > > ### ** Examples > > str(Median) `data.frame': 15 obs. of 3 variables: $ Sample1: int 11 12 14 14 15 16 17 18 19 20 ... $ Sample2: int 5 6 7 10 12 14 14 15 16 16 ... $ Sample3: int 0 1 5 6 8 10 11 12 13 15 ... > attach(Median) > STACKED <-stack(Median) > STACKED[1:5,] values ind 1 11 Sample1 2 12 Sample1 3 14 Sample1 4 14 Sample1 5 15 Sample1 > boxplot(values~ind,col=c("red","blue","green"),data=STACKED) > anova(lm(values~ind,data=STACKED)) Analysis of Variance Table Response: values Df Sum Sq Mean Sq F value Pr(>F) ind 2 309.38 154.69 2.5634 0.08905 . Residuals 42 2534.53 60.35 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > kruskal.test(values~ind,data=STACKED) Kruskal-Wallis rank sum test data: values by ind Kruskal-Wallis chi-squared = 5.1308, df = 2, p-value = 0.07689 > remove(STACKED) > detach(Median) > > > > cleanEx(); ..nameEx <- "Mental" > > ### * Mental > > flush(stderr()); flush(stdout()) > > ### Name: Mental > ### Title: Median mental ages of 16 girls > ### Aliases: Mental > ### Keywords: datasets > > ### ** Examples > > str(Mental) `data.frame': 16 obs. of 1 variable: $ age: int 87 89 93 93 93 95 95 99 99 102 ... > attach(Mental) > sign.test(age,md=100) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: age s = 7, p-value = 0.8036 alternative hypothesis: true median is not equal to 100 95 percent confidence interval: 93.0000 110.4137 sample estimates: median of x 99 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9232 93 108.0000 Interpolated CI 0.9500 93 110.4137 Upper Achieved CI 0.9787 93 113.0000 > detach(Mental) > > > > cleanEx(); ..nameEx <- "Mercury" > > ### * Mercury > > flush(stderr()); flush(stdout()) > > ### Name: Mercury > ### Title: Concentration of mercury in 25 lake trout > ### Aliases: Mercury > ### Keywords: datasets > > ### ** Examples > > str(Mercury) `data.frame': 25 obs. of 1 variable: $ mercury: num 2.2 3.4 3 2.6 3.8 1.8 2.8 3.2 3.7 1.4 ... > attach(Mercury) > stem(mercury) The decimal point is at the | 1 | 4 1 | 789 2 | 2234 2 | 66789 3 | 00012344 3 | 5678 > detach(Mercury) > > > > cleanEx(); ..nameEx <- "Metrent" > > ### * Metrent > > flush(stderr()); flush(stdout()) > > ### Name: Metrent > ### Title: Monthly rental costs in metro areas with 1 million or more > ### persons > ### Aliases: Metrent > ### Keywords: datasets > > ### ** Examples > > str(Metrent) `data.frame': 46 obs. of 1 variable: $ rent: int 790 529 490 646 656 426 491 367 406 421 ... > attach(Metrent) > EDA(rent) [1] "rent" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 46.000 0.000 366.000 425.750 514.870 485.000 509.119 590.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 790.000 114.981 13220.560 16.953 164.250 424.000 -0.308 0.836 SW p-val 0.002 > t.test(rent,conf.level=.99)$conf [1] 469.2731 560.4660 attr(,"conf.level") [1] 0.99 > detach(Metrent) > > > > cleanEx(); ..nameEx <- "Miller" > > ### * Miller > > flush(stderr()); flush(stdout()) > > ### Name: Miller > ### Title: Miller personality test scores for a group of college students > ### applying for graduate school > ### Aliases: Miller > ### Keywords: datasets > > ### ** Examples > > str(Miller) `data.frame': 25 obs. of 1 variable: $ miller: int 21 18 20 25 23 19 30 24 29 14 ... > attach(Miller) > stem(miller) The decimal point is 1 digit(s) to the right of the | 1 | 4 1 | 6889 2 | 01222334 2 | 5555679 3 | 0134 3 | 5 > fivenum(miller) [1] 14 21 24 27 35 > boxplot(miller) > qqnorm(miller,col="blue") > qqline(miller,col="red") > detach(Miller) > > > > cleanEx(); ..nameEx <- "Miller1" > > ### * Miller1 > > flush(stderr()); flush(stdout()) > > ### Name: Miller1 > ### Title: Twenty scores on the Miller personality test > ### Aliases: Miller1 > ### Keywords: datasets > > ### ** Examples > > str(Miller1) `data.frame': 20 obs. of 1 variable: $ miller: int 22 21 16 26 22 23 31 25 20 25 ... > attach(Miller1) > stem(miller) The decimal point is 1 digit(s) to the right of the | 1 | 678 2 | 0122233 2 | 5555679 3 | 013 > stem(miller,scale=2) The decimal point is at the | 16 | 00 18 | 0 20 | 00 22 | 00000 24 | 0000 26 | 00 28 | 0 30 | 00 32 | 0 > detach(Miller1) > > > > cleanEx(); ..nameEx <- "Moisture" > > ### * Moisture > > flush(stderr()); flush(stdout()) > > ### Name: Moisture > ### Title: Moisture content and depth of core sample for marine muds in > ### eastern Louisiana > ### Aliases: Moisture > ### Keywords: datasets > > ### ** Examples > > str(Moisture) `data.frame': 16 obs. of 4 variables: $ depth : int 0 5 10 15 20 25 30 35 0 5 ... $ moisture: int 124 78 54 35 30 21 22 18 137 84 ... $ lnmoist : num 4.82 4.36 3.99 3.56 3.40 ... $ depthsq : int 0 25 100 225 400 625 900 1225 0 25 ... > attach(Moisture) > model <- lm(moisture~depth) > plot(depth,resid(model)) > detach(Moisture) > remove(model) > > > > cleanEx(); ..nameEx <- "Monoxide" > > ### * Monoxide > > flush(stderr()); flush(stdout()) > > ### Name: Monoxide > ### Title: Carbon monoxide emitted by smoke stacks of a manufacturer and a > ### competitor > ### Aliases: Monoxide > ### Keywords: datasets > > ### ** Examples > > str(Monoxide) `data.frame': 10 obs. of 2 variables: $ manufac: num 2.7 3.1 3.1 2.9 2.5 3.4 3.4 3.4 2.4 NA $ compet : num 3.7 3 3.5 3.8 2.8 3.5 3.4 3.6 2.7 3.7 > attach(Monoxide) > t.test(manufac,compet) Welch Two Sample t-test data: manufac and compet t = -2.1187, df = 16.842, p-value = 0.04929 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.760895683 -0.001326539 sample estimates: mean of x mean of y 2.988889 3.370000 > wilcox.test(manufac,compet) Warning in wilcox.test.default(manufac, compet) : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: manufac and compet W = 19, p-value = 0.03617 alternative hypothesis: true mu is not equal to 0 > detach(Monoxide) > > > > cleanEx(); ..nameEx <- "Movie" > > ### * Movie > > flush(stderr()); flush(stdout()) > > ### Name: Movie > ### Title: Moral attitude scale on 15 subjects before and after viewing a > ### movie > ### Aliases: Movie > ### Keywords: datasets > > ### ** Examples > > str(Movie) `data.frame': 12 obs. of 3 variables: $ Before: int 14 16 15 18 15 17 19 17 17 16 ... $ After : int 14 18 16 17 16 19 20 18 19 15 ... $ differ: int 0 2 1 -1 1 2 1 1 2 -1 ... > attach(Movie) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.8364, p-value = 0.02506 > t.test(After,Before,paired=TRUE,conf.level=.99) Paired t-test data: After and Before t = 2, df = 11, p-value = 0.0708 alternative hypothesis: true difference in means is not equal to 0 99 percent confidence interval: -0.3686022 1.7019355 sample estimates: mean of the differences 0.6666667 > wilcox.test(After,Before,paired=TRUE) Warning in wilcox.test.default(After, Before, paired = TRUE) : cannot compute exact p-value with ties Warning in wilcox.test.default(After, Before, paired = TRUE) : cannot compute exact p-value with zeroes Wilcoxon signed rank test with continuity correction data: After and Before V = 52.5, p-value = 0.07707 alternative hypothesis: true mu is not equal to 0 > detach(Movie) > > > > cleanEx(); ..nameEx <- "Music" > > ### * Music > > flush(stderr()); flush(stdout()) > > ### Name: Music > ### Title: Improvement scores for identical twins taught music recognition > ### by two techniques > ### Aliases: Music > ### Keywords: datasets > > ### ** Examples > > str(Music) `data.frame': 12 obs. of 3 variables: $ Method1: int 7 4 6 1 5 1 6 3 4 6 ... $ Method2: int 2 4 3 2 3 4 2 4 4 3 ... $ differ : int 5 0 3 -1 2 -3 4 -1 0 3 ... > attach(Music) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.9663, p-value = 0.8685 > t.test(Method1,Method2,paired=TRUE) Paired t-test data: Method1 and Method2 t = 1.5947, df = 11, p-value = 0.1391 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.411863 2.578530 sample estimates: mean of the differences 1.083333 > detach(Music) > > > > cleanEx(); ..nameEx <- "Name" > > ### * Name > > flush(stderr()); flush(stdout()) > > ### Name: Name > ### Title: Estimated value of a brand name product and the conpany's > ### revenue > ### Aliases: Name > ### Keywords: datasets > > ### ** Examples > > str(Name) `data.frame': 42 obs. of 3 variables: $ Brand : Factor w/ 42 levels "Band-Aid","Barbie",..: 28 8 4 34 29 24 41 33 5 6 ... $ value : num 31.2 24.4 10.1 9.6 8.5 8.4 6.1 6.1 4.4 3.9 ... $ revenue: num 15.4 8.4 6.2 5.5 4.3 4.7 3.6 4 2.3 2.4 ... > attach(Name) > plot(revenue,value) > model <- lm(value~revenue) > abline(model) > cor(value,revenue) [1] 0.9403903 > summary(model) Call: lm(formula = value ~ revenue) Residuals: Min 1Q Median 3Q Max -7.5574 -0.3404 0.2231 0.6834 8.2840 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.8889 0.4174 -2.13 0.0394 * revenue 2.0244 0.1158 17.49 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.096 on 40 degrees of freedom Multiple R-Squared: 0.8843, Adjusted R-squared: 0.8814 F-statistic: 305.8 on 1 and 40 DF, p-value: < 2.2e-16 > detach(Name) > remove(model) > > > > cleanEx(); ..nameEx <- "Nascar" > > ### * Nascar > > flush(stderr()); flush(stdout()) > > ### Name: Nascar > ### Title: Efficiency of pit crews for three major NASCAR teams > ### Aliases: Nascar > ### Keywords: datasets > > ### ** Examples > > str(Nascar) `data.frame': 36 obs. of 6 variables: $ TeamA: int 25 22 18 30 24 15 29 23 10 20 ... $ TeamB: int 25 30 24 26 22 15 32 36 20 28 ... $ TeamC: int 30 35 32 26 37 43 36 40 35 25 ... $ Time : int 25 22 18 30 24 15 29 23 10 20 ... $ Team : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks: num 14 7.5 4 22 10.5 2.5 20 9 1 5.5 ... > attach(Nascar) > boxplot(Time~Team) > anova(lm(Time~as.factor(Team))) Analysis of Variance Table Response: Time Df Sum Sq Mean Sq F value Pr(>F) as.factor(Team) 2 873.50 436.75 10.826 0.0002426 *** Residuals 33 1331.25 40.34 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Nascar) > > > > cleanEx(); ..nameEx <- "Nervous" > > ### * Nervous > > flush(stderr()); flush(stdout()) > > ### Name: Nervous > ### Title: Reaction effects of 4 drugs on 25 subjects with a nervous > ### disorder > ### Aliases: Nervous > ### Keywords: datasets > > ### ** Examples > > str(Nervous) `data.frame': 25 obs. of 2 variables: $ react: int 3 5 4 6 4 5 7 3 4 5 ... $ drug : int 1 1 1 1 1 2 2 2 2 2 ... > attach(Nervous) > boxplot(react~drug) > anova(lm(react~as.factor(drug))) Analysis of Variance Table Response: react Df Sum Sq Mean Sq F value Pr(>F) as.factor(drug) 3 43.021 14.340 8.1791 0.0008504 *** Residuals 21 36.819 1.753 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Nervous) > > > > cleanEx(); ..nameEx <- "Newsstand" > > ### * Newsstand > > flush(stderr()); flush(stdout()) > > ### Name: Newsstand > ### Title: Daily profits for 20 newsstands > ### Aliases: Newsstand > ### Keywords: datasets > > ### ** Examples > > str(Newsstand) `data.frame': 20 obs. of 1 variable: $ profit: num 81.3 61.5 64.9 70.9 76.0 ... > attach(Newsstand) > stem(profit) The decimal point is 1 digit(s) to the right of the | 5 | 89 6 | 14 6 | 5558 7 | 13 7 | 555566778 8 | 1 > stem(profit,scale=3) The decimal point is at the | 58 | 04 60 | 5 62 | 64 | 2914 66 | 68 | 1 70 | 9 72 | 4 74 | 8914 76 | 00576 78 | 80 | 3 > detach(Newsstand) > > > > cleanEx(); ..nameEx <- "Nfldraf2" > > ### * Nfldraf2 > > flush(stderr()); flush(stdout()) > > ### Name: Nfldraf2 > ### Title: Rating, time in 40-yard dash, and weight of top defensive > ### linemen in the 1994 NFL draft > ### Aliases: Nfldraf2 > ### Keywords: datasets > > ### ** Examples > > str(Nfldraf2) `data.frame': 47 obs. of 3 variables: $ Rating: num 8.2 7.5 7 6.6 6.4 6.2 5.6 5.4 5.4 5.3 ... $ forty : num 4.72 4.94 5.06 5.09 5.07 5.1 5.13 5 5.03 4.78 ... $ weight: num 313 276 289 300 285 312 287 265 277 272 ... > attach(Nfldraf2) > plot(forty,Rating) > model <- lm(Rating~forty) > abline(model) > anova(model) Analysis of Variance Table Response: Rating Df Sum Sq Mean Sq F value Pr(>F) forty 1 0.4143 0.4143 0.706 0.4052 Residuals 45 26.4057 0.5868 > summary(model) Call: lm(formula = Rating ~ forty) Residuals: Min 1Q Median 3Q Max -1.0476 -0.5691 -0.2625 0.5055 2.0457 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9.5141 4.1838 2.274 0.0278 * forty -0.7118 0.8472 -0.840 0.4052 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.766 on 45 degrees of freedom Multiple R-Squared: 0.01545, Adjusted R-squared: -0.006432 F-statistic: 0.706 on 1 and 45 DF, p-value: 0.4052 > detach(Nfldraf2) > > > > cleanEx(); ..nameEx <- "Nfldraft" > > ### * Nfldraft > > flush(stderr()); flush(stdout()) > > ### Name: Nfldraft > ### Title: Rating, time in 40-yard dash, and weight of top offensive > ### linemen in the 1994 NFL draft > ### Aliases: Nfldraft > ### Keywords: datasets > > ### ** Examples > > str(Nfldraft) `data.frame': 29 obs. of 3 variables: $ Rating: num 6.5 6.1 6 5.7 5.5 5.2 5 7.6 7.2 7 ... $ forty : num 4.94 5.27 5.27 5.14 5.09 5.23 5.3 5.15 5.2 5.2 ... $ weight: num 285 285 285 277 280 274 310 303 315 325 ... > attach(Nfldraft) > plot(forty,Rating) > model <- lm(Rating~forty) > abline(model) > anova(model) Analysis of Variance Table Response: Rating Df Sum Sq Mean Sq F value Pr(>F) forty 1 0.8724 0.8724 2.0977 0.1590 Residuals 27 11.2290 0.4159 > summary(model) Call: lm(formula = Rating ~ forty) Residuals: Min 1Q Median 3Q Max -0.974070 -0.508635 -0.001843 0.350006 1.406025 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 13.744 5.291 2.598 0.0150 * forty -1.466 1.012 -1.448 0.1590 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.6449 on 27 degrees of freedom Multiple R-Squared: 0.07209, Adjusted R-squared: 0.03772 F-statistic: 2.098 on 1 and 27 DF, p-value: 0.1590 > detach(Nfldraft) > > > > cleanEx(); ..nameEx <- "Nicotine" > > ### * Nicotine > > flush(stderr()); flush(stdout()) > > ### Name: Nicotine > ### Title: Nicotine content versus sales for 8 major brands of cigarettes > ### Aliases: Nicotine > ### Keywords: datasets > > ### ** Examples > > str(Nicotine) `data.frame': 8 obs. of 2 variables: $ nicotine: num 0.86 1.38 1.67 0.25 0.59 ... $ sales : int 24 65 83 34 59 62 85 38 > attach(Nicotine) > model <- lm(sales~nicotine) > summary(model) Call: lm(formula = sales ~ nicotine) Residuals: Min 1Q Median 3Q Max -29.3548 -6.3547 -0.3917 5.7778 27.0129 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 24.90 15.37 1.620 0.1564 nicotine 33.09 14.78 2.238 0.0665 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 17.9 on 6 degrees of freedom Multiple R-Squared: 0.455, Adjusted R-squared: 0.3641 F-statistic: 5.009 on 1 and 6 DF, p-value: 0.06653 > detach(Nicotine) > remove(model) > > > > cleanEx(); ..nameEx <- "Orange" > > ### * Orange > > flush(stderr()); flush(stdout()) > > ### Name: Orange > ### Title: Price of oranges versus size of the harvest > ### Aliases: Orange > ### Keywords: datasets > > ### ** Examples > > str(Orange) `data.frame': 6 obs. of 2 variables: $ harvest: int 72 69 58 70 65 54 $ price : num 5.4 6.1 9.3 6.5 7.2 13.4 > attach(Orange) > summary(lm(price~harvest)) Call: lm(formula = price ~ harvest) Residuals: 1 2 3 4 5 6 0.2963 -0.1817 -1.3012 0.6109 -0.6524 1.2281 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 33.37622 4.09694 8.147 0.00124 ** harvest -0.39267 0.06303 -6.230 0.00338 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.015 on 4 degrees of freedom Multiple R-Squared: 0.9066, Adjusted R-squared: 0.8832 F-statistic: 38.81 on 1 and 4 DF, p-value: 0.003381 > detach(Orange) > > > > cleanEx(); ..nameEx <- "Orioles" > > ### * Orioles > > flush(stderr()); flush(stdout()) > > ### Name: Orioles > ### Title: Salaries of members of the Baltimore Orioles baseball team > ### Aliases: Orioles > ### Keywords: datasets > > ### ** Examples > > str(Orioles) `data.frame': 27 obs. of 3 variables: $ first.name : Factor w/ 22 levels "Albert","Arthur",..: 1 16 5 19 4 14 21 7 3 6 ... $ last.name : Factor w/ 27 levels "Amaral","Anderson",..: 4 17 23 10 2 13 7 9 25 15 ... $ X1999salary: int 11949794 6523143 6300000 6079931 5674897 5250000 4920840 4053092 3605516 3600000 ... > attach(Orioles) > stripchart(X1999salary,method="stack",pch=19,col="blue") > detach(Orioles) > > > > cleanEx(); ..nameEx <- "Oxytocin" > > ### * Oxytocin > > flush(stderr()); flush(stdout()) > > ### Name: Oxytocin > ### Title: Arterial blood pressure of 11 subjects before and after > ### receiving oxytocin > ### Aliases: Oxytocin > ### Keywords: datasets > > ### ** Examples > > str(Oxytocin) `data.frame': 11 obs. of 3 variables: $ Subject: int 1 2 3 4 5 6 7 8 9 10 ... $ Before : int 95 173 94 97 81 100 97 104 72 101 ... $ After : int 55 90 36 59 46 46 49 92 23 55 ... > attach(Oxytocin) > DIF <- Before - After > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9446, p-value = 0.5765 > t.test(Before,After,paired=TRUE) Paired t-test data: Before and After t = 8.506, df = 10, p-value = 6.854e-06 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 33.34646 57.01717 sample estimates: mean of the differences 45.18182 > detach(Oxytocin) > > > > cleanEx(); ..nameEx <- "Parented" > > ### * Parented > > flush(stderr()); flush(stdout()) > > ### Name: Parented > ### Title: Education backgrounds of parents of entering freshmen at a state > ### university > ### Aliases: Parented > ### Keywords: datasets > > ### ** Examples > > str(Parented) `data.frame': 6 obs. of 3 variables: $ Educat: Factor w/ 6 levels "4yr college degree",..: 4 5 1 6 3 2 $ Mother: num 0.23 0.33 0.25 0.05 0.13 0.01 $ Father: num 0.2 0.25 0.28 0.04 0.17 0.06 > attach(Parented) > MAT <- cbind(Mother, Father) > row.names(MAT) <- Educat > MAT Mother Father H.S grad or less 0.23 0.20 Some college 0.33 0.25 4yr college degree 0.25 0.28 Some grad school 0.05 0.04 Grad degree 0.13 0.17 Doctoral degree 0.01 0.06 > barplot(t(MAT),beside=TRUE,legend=TRUE,col=c("blue","red")) > detach(Parented) > remove(MAT) > > > > cleanEx(); ..nameEx <- "Patrol" > > ### * Patrol > > flush(stderr()); flush(stdout()) > > ### Name: Patrol > ### Title: Years of experience and number of tickets given by patrolpersons > ### in New York City > ### Aliases: Patrol > ### Keywords: datasets > > ### ** Examples > > str(Patrol) `data.frame': 10 obs. of 7 variables: $ tickets : int 42 30 54 12 32 8 75 28 20 15 $ years : int 3 8 2 15 5 20 1 10 7 12 $ ln.tickets.: num 3.74 3.40 3.99 2.48 3.47 ... $ SRES1 : num -0.5079 -0.2332 0.3966 0.0047 -0.8888 ... $ FITS1 : num 47.1 32.5 50.1 12.0 41.3 ... $ SRES2 : num -0.460 0.569 0.271 -0.194 -0.713 ... $ FITS2 : num 3.83 3.28 3.94 2.52 3.61 ... > attach(Patrol) > model <- lm(tickets~years) > summary(model) Call: lm(formula = tickets ~ years) Residuals: Min 1Q Median 3Q Max -15.412 -5.598 -1.217 3.291 21.995 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 55.938 6.215 9.001 1.85e-05 *** years -2.932 0.615 -4.768 0.00141 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.21 on 8 degrees of freedom Multiple R-Squared: 0.7397, Adjusted R-squared: 0.7071 F-statistic: 22.73 on 1 and 8 DF, p-value: 0.001413 > detach(Patrol) > remove(model) > > > > cleanEx(); ..nameEx <- "Pearson" > > ### * Pearson > > flush(stderr()); flush(stdout()) > > ### Name: Pearson > ### Title: Karl Pearson's data on heights of brothers and sisters > ### Aliases: Pearson > ### Keywords: datasets > > ### ** Examples > > str(Pearson) `data.frame': 11 obs. of 2 variables: $ brother: int 71 68 66 67 70 71 70 73 72 65 ... $ sister : int 69 64 65 63 65 62 65 64 66 59 ... > attach(Pearson) > plot(brother,sister) > cor(brother,sister) [1] 0.5580547 > detach(Pearson) > > > > cleanEx(); ..nameEx <- "Phone" > > ### * Phone > > flush(stderr()); flush(stdout()) > > ### Name: Phone > ### Title: Length of long-distance phone calls for a small business firm > ### Aliases: Phone > ### Keywords: datasets > > ### ** Examples > > str(Phone) `data.frame': 20 obs. of 1 variable: $ time: num 12.8 3.5 2.9 9.4 8.7 3.5 4.8 7.7 5.9 6.2 ... > attach(Phone) > qqnorm(time) > qqline(time) > shapiro.test(time) Shapiro-Wilk normality test data: time W = 0.8699, p-value = 0.01172 > sign.test(time,md=5,alternative="greater") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: time s = 9, p-value = 0.7483 alternative hypothesis: true median is greater than 5 95 percent confidence interval: 3.058559 Inf sample estimates: median of x 4.75 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9423 3.1000 Inf Interpolated CI 0.9500 3.0586 Inf Upper Achieved CI 0.9793 2.9000 Inf > detach(Phone) > > > > cleanEx(); ..nameEx <- "Poison" > > ### * Poison > > flush(stderr()); flush(stdout()) > > ### Name: Poison > ### Title: Number of poisonings reported to 16 poison control centers > ### Aliases: Poison > ### Keywords: datasets > > ### ** Examples > > str(Poison) `data.frame': 6 obs. of 2 variables: $ Type : Factor w/ 6 levels "Alcohol","Cleaning agent",..: 4 2 6 3 5 1 $ number: int 150857 22347 22326 13192 8438 9201 > attach(Poison) > names(number) <- Type > barplot(number,col="red") > > > > cleanEx(); ..nameEx <- "Politic" > > ### * Politic > > flush(stderr()); flush(stdout()) > > ### Name: Politic > ### Title: Political party and gender in a voting district > ### Aliases: Politic > ### Keywords: datasets > > ### ** Examples > > str(Politic) `data.frame': 250 obs. of 2 variables: $ Party : int 2 1 2 2 2 1 2 2 2 2 ... $ Gender: int 2 2 2 1 2 1 1 2 2 1 ... > attach(Politic) > table(Party,Gender) Gender Party 1 2 1 49 55 2 64 73 3 6 3 > chisq.test(table(Party,Gender)) Warning in chisq.test(table(Party, Gender)) : Chi-squared approximation may be incorrect Pearson's Chi-squared test data: table(Party, Gender) X-squared = 1.3645, df = 2, p-value = 0.5055 > detach(Politic) > > > > cleanEx(); ..nameEx <- "Pollutio" > > ### * Pollutio > > flush(stderr()); flush(stdout()) > > ### Name: Pollutio > ### Title: Air pollution index for 15 randomly selected days for a major > ### western city > ### Aliases: Pollutio > ### Keywords: datasets > > ### ** Examples > > str(Pollutio) `data.frame': 15 obs. of 1 variable: $ inde: num 57.6 61.2 59.4 65.6 58.3 44.7 63.2 48.8 55.7 59 ... > attach(Pollutio) > EDA(inde) [1] "inde" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 15.000 0.000 43.200 48.800 57.167 59.000 57.167 63.200 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 71.200 8.213 67.448 2.121 14.400 28.000 -1.049 -0.331 SW p-val 0.298 > t.test(inde,conf.level=.98)$conf [1] 51.60141 62.73192 attr(,"conf.level") [1] 0.98 > detach(Pollutio) > > > > cleanEx(); ..nameEx <- "Porosity" > > ### * Porosity > > flush(stderr()); flush(stdout()) > > ### Name: Porosity > ### Title: Porosity measurements on 20 samples of Tensleep Sandstone, > ### Pennsylvanian from Bighorn Basin in Wyoming > ### Aliases: Porosity > ### Keywords: datasets > > ### ** Examples > > str(Porosity) `data.frame': 20 obs. of 1 variable: $ porosity: int 15 10 15 23 18 26 24 18 19 21 ... > attach(Porosity) > stem(porosity) The decimal point is 1 digit(s) to the right of the | 1 | 03 1 | 55578889 2 | 013344 2 | 6779 > fivenum(porosity) [1] 10.0 16.0 19.5 24.0 29.0 > boxplot(porosity) > detach(Porosity) > > > > cleanEx(); ..nameEx <- "Poverty" > > ### * Poverty > > flush(stderr()); flush(stdout()) > > ### Name: Poverty > ### Title: Percent poverty and crime rate for selected cities > ### Aliases: Poverty > ### Keywords: datasets > > ### ** Examples > > str(Poverty) `data.frame': 20 obs. of 6 variables: $ City : Factor w/ 20 levels "Atlanta","Buffalo",..: 6 11 15 7 13 10 9 4 1 5 ... $ Poverty: num 46.6 46.4 46.3 44.6 44.1 43.8 43 43 42.9 40.9 ... $ Crime : int 13 4 9 12 17 12 8 7 18 6 ... $ cindex : int 1172 100 504 187 654 211 120 425 713 205 ... $ popu : int 1027974 122893 496938 140925 358648 139739 116646 505616 393929 182005 ... $ ratio : num 114.0 81.4 101.4 132.7 182.4 ... > attach(Poverty) > plot(Crime,Poverty) > model <- lm(Poverty~Crime) > abline(model) > summary(model) Call: lm(formula = Poverty ~ Crime) Residuals: Min 1Q Median 3Q Max -4.9540 -3.1121 -0.5467 2.5390 6.5606 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 39.116 1.858 21.052 3.97e-14 *** Crime 0.181 0.171 1.058 0.304 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.667 on 18 degrees of freedom Multiple R-Squared: 0.05857, Adjusted R-squared: 0.006268 F-statistic: 1.12 on 1 and 18 DF, p-value: 0.3039 > detach(Poverty) > remove(model) > > > > cleanEx(); ..nameEx <- "Precinct" > > ### * Precinct > > flush(stderr()); flush(stdout()) > > ### Name: Precinct > ### Title: Robbery rates versus percent low income in 8 precincts > ### Aliases: Precinct > ### Keywords: datasets > > ### ** Examples > > str(Precinct) `data.frame': 8 obs. of 2 variables: $ rate : int 20 41 165 88 60 120 65 81 $ income: num 4.9 7.1 10.1 11.8 13.5 14.8 16.2 11.2 > attach(Precinct) > plot(rate,income,main="Exercise 2.2") > model <- lm(income~rate) > model Call: lm(formula = income ~ rate) Coefficients: (Intercept) rate 8.61897 0.03226 > abline(model,col="green") > detach(Precinct) > > > > cleanEx(); ..nameEx <- "Prejudic" > > ### * Prejudic > > flush(stderr()); flush(stdout()) > > ### Name: Prejudic > ### Title: Racial prejudice measured on a sample of 25 high school students > ### Aliases: Prejudic > ### Keywords: datasets > > ### ** Examples > > str(Prejudic) `data.frame': 25 obs. of 1 variable: $ prejud: int 59 54 41 51 87 42 65 42 44 46 ... > attach(Prejudic) > EDA(prejud) [1] "prejud" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 25.000 0.000 41.000 45.500 56.280 52.000 55.609 63.500 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 87.000 13.664 186.710 2.733 18.000 46.000 -0.592 0.786 SW p-val 0.015 > detach(Prejudic) > > > > cleanEx(); ..nameEx <- "Presiden" > > ### * Presiden > > flush(stderr()); flush(stdout()) > > ### Name: Presiden > ### Title: Ages at inauguration and death of U.S. presidents > ### Aliases: Presiden > ### Keywords: datasets > > ### ** Examples > > str(Presiden) `data.frame': 43 obs. of 5 variables: $ firs : Factor w/ 16 levels "A.","B.","C.",..: 6 9 13 9 9 9 1 11 15 9 ... $ Presiden: Factor w/ 37 levels "Adams","Arthur",..: 36 1 19 23 25 1 18 35 15 34 ... $ Birt : Factor w/ 20 levels "ARK","CAL","CONN",..: 19 8 19 19 19 8 17 14 19 19 ... $ Inaugage: int 57 61 57 57 58 57 61 54 68 51 ... $ Deathage: int 67 90 83 85 73 80 78 79 68 71 ... > attach(Presiden) > table(Birt) Birt ARK CAL CONN GA IA ILL KY MASS MO NC NEB NH NJ NY OH PA 1 1 1 1 1 1 1 4 1 2 1 1 2 4 7 1 SC TEX VA VT 1 2 8 2 > pie(table(Birt)) > stripchart(x=list(Inaugage,Deathage),method="stack", + group.names=c("Inaugural Age","Death Age"),col=c("green","brown"),pch=19) > detach(Presiden) > > > > cleanEx(); ..nameEx <- "Press" > > ### * Press > > flush(stderr()); flush(stdout()) > > ### Name: Press > ### Title: Degree of confidence in the press versus education level for 20 > ### randomly selected persons > ### Aliases: Press > ### Keywords: datasets > > ### ** Examples > > str(Press) `data.frame': 20 obs. of 4 variables: $ educat: int 12 12 14 8 10 12 11 12 16 14 ... $ confid: int 28 36 22 58 41 32 30 62 14 21 ... $ SRES1 : num -0.670 0.123 -0.435 0.686 -0.225 ... $ FITS1 : num 34.8 34.8 26.3 51.7 43.2 ... > attach(Press) > summary(lm(confid~educat)) Call: lm(formula = confid ~ educat) Residuals: Min 1Q Median 3Q Max -18.762 -5.665 -2.492 3.777 27.238 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 85.530 12.508 6.838 2.12e-06 *** educat -4.231 1.020 -4.147 0.000605 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 10.35 on 18 degrees of freedom Multiple R-Squared: 0.4887, Adjusted R-squared: 0.4602 F-statistic: 17.2 on 1 and 18 DF, p-value: 0.000605 > detach(Press) > > > > cleanEx(); ..nameEx <- "Prognost" > > ### * Prognost > > flush(stderr()); flush(stdout()) > > ### Name: Prognost > ### Title: Klopfer's prognostic rating scale for subjects receiving > ### behavior modification therapy > ### Aliases: Prognost > ### Keywords: datasets > > ### ** Examples > > str(Prognost) `data.frame': 15 obs. of 1 variable: $ score: num 11.9 8.2 6.9 11.7 7.4 6.5 9.5 7.4 6.3 9.4 ... > attach(Prognost) > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 15.000 0.000 4.900 6.800 8.000 7.400 8.000 9.400 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 11.900 1.947 3.790 0.503 2.600 7.000 -0.501 0.667 SW p-val 0.169 > t.test(score,mu=9) One Sample t-test data: score t = -1.9894, df = 14, p-value = 0.06656 alternative hypothesis: true mean is not equal to 9 95 percent confidence interval: 6.921902 9.078098 sample estimates: mean of x 8 > detach(Prognost) > > > > cleanEx(); ..nameEx <- "Program" > > ### * Program > > flush(stderr()); flush(stdout()) > > ### Name: Program > ### Title: Effects of four different methods of programmed learning for > ### statistics students > ### Aliases: Program > ### Keywords: datasets > > ### ** Examples > > str(Program) `data.frame': 11 obs. of 4 variables: $ Method1: int 3 5 6 8 4 3 5 6 4 6 ... $ Method2: int 5 7 7 7 6 6 8 4 6 7 ... $ Method3: int 7 5 6 8 7 6 9 8 7 7 ... $ Method4: int 4 6 6 7 6 5 5 5 6 5 ... > attach(Program) > STACKED <-stack(Program) > STACKED[1:5,] values ind 1 3 Method1 2 5 Method1 3 6 Method1 4 8 Method1 5 4 Method1 > boxplot(values~ind,col=c("red","blue","green","yellow"),data=STACKED) > anova(lm(values~ind,data=STACKED)) Analysis of Variance Table Response: values Df Sum Sq Mean Sq F value Pr(>F) ind 3 32.455 10.818 7.1257 0.0006043 *** Residuals 40 60.727 1.518 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > remove(STACKED) > detach(Program) > > > > cleanEx(); ..nameEx <- "Psat" > > ### * Psat > > flush(stderr()); flush(stdout()) > > ### Name: Psat > ### Title: PSAT scores versus SAT scores > ### Aliases: Psat > ### Keywords: datasets > > ### ** Examples > > str(Psat) `data.frame': 7 obs. of 4 variables: $ psat : int 760 1150 820 1060 950 1320 750 $ sat : int 920 1100 1050 1340 1060 1500 920 $ SRES1: num -0.198 -1.908 0.593 1.330 -0.453 ... $ FITS1: num 938 1284 992 1204 1107 ... > attach(Psat) > model <- lm(sat~psat) > plot(psat,resid(model)) > detach(Psat) > > > > cleanEx(); ..nameEx <- "Psych" > > ### * Psych > > flush(stderr()); flush(stdout()) > > ### Name: Psych > ### Title: Correct responses for 24 students in a psychology experiment > ### Aliases: Psych > ### Keywords: datasets > > ### ** Examples > > str(Psych) `data.frame': 23 obs. of 1 variable: $ score: int 12 14 18 7 11 15 8 15 10 14 ... > attach(Psych) > stem(score) The decimal point is 1 digit(s) to the right of the | 0 | 67889 1 | 00122234444 1 | 5556789 > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 23.000 0.000 6.000 10.000 12.565 13.000 12.571 15.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 19.000 3.527 12.439 0.735 5.000 13.000 -0.984 -0.118 SW p-val 0.804 > detach(Psych) > > > > cleanEx(); ..nameEx <- "Puerto" > > ### * Puerto > > flush(stderr()); flush(stdout()) > > ### Name: Puerto > ### Title: Weekly incomes of a random sample of 50 Puerto Rican families in > ### Miami > ### Aliases: Puerto > ### Keywords: datasets > > ### ** Examples > > str(Puerto) `data.frame': 50 obs. of 1 variable: $ income: int 150 280 175 190 305 380 290 300 170 315 ... > attach(Puerto) > EDA(income) [1] "income" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 50.000 0.000 150.000 223.750 277.500 272.500 274.239 335.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 550.000 75.918 5763.520 10.736 111.250 400.000 1.375 0.756 SW p-val 0.022 > t.test(income,conf.level=.90)$conf [1] 259.4999 295.5001 attr(,"conf.level") [1] 0.9 > detach(Puerto) > > > > cleanEx(); ..nameEx <- "Quail" > > ### * Quail > > flush(stderr()); flush(stdout()) > > ### Name: Quail > ### Title: Plasma LDL levels in two groups of quail > ### Aliases: Quail > ### Keywords: datasets > > ### ** Examples > > str(Quail) `data.frame': 20 obs. of 2 variables: $ placebo : int 64 49 54 64 97 66 76 44 71 89 ... $ treatmen: int 40 31 50 48 152 44 74 38 81 64 ... > attach(Quail) > boxplot(placebo,treatmen,names=c("Placebo","Treatment"), + horizontal=TRUE,xlab="LDL level",col=c("lightblue","yellow")) > boxplot(placebo,treatmen,names=c("Placebo","Treatment"), + ylab="LDL level",col=c("lightblue","yellow")) > detach(Quail) > > > > cleanEx(); ..nameEx <- "Quality" > > ### * Quality > > flush(stderr()); flush(stdout()) > > ### Name: Quality > ### Title: Quality control test scores on two manufacturing processes > ### Aliases: Quality > ### Keywords: datasets > > ### ** Examples > > str(Quality) `data.frame': 8 obs. of 2 variables: $ Process1: num 1.5 2.5 3.4 2.3 3.2 2.8 1.9 NA $ Process2: num 2.5 3 2.7 4 3.5 2 1.8 3.7 > attach(Quality) > qqnorm(Process1) > qqline(Process1) > shapiro.test(Process1) Shapiro-Wilk normality test data: Process1 W = 0.9744, p-value = 0.9282 > qqnorm(Process2) > qqline(Process2) > shapiro.test(Process2) Shapiro-Wilk normality test data: Process2 W = 0.9566, p-value = 0.7772 > t.test(Process1,Process2) Welch Two Sample t-test data: Process1 and Process2 t = -1.0106, df = 12.998, p-value = 0.3307 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -1.2102969 0.4388683 sample estimates: mean of x mean of y 2.514286 2.900000 > detach(Quality) > > > > cleanEx(); ..nameEx <- "Rainks" > > ### * Rainks > > flush(stderr()); flush(stdout()) > > ### Name: Rainks > ### Title: Rainfall in an area of west central Kansas and four surrounding > ### counties > ### Aliases: Rainks > ### Keywords: datasets > > ### ** Examples > > str(Rainks) `data.frame': 35 obs. of 5 variables: $ rain: num 2.97 1.88 2.19 1.68 2.40 ... $ x1 : num 1.85 1.72 1.94 0.78 2.51 ... $ x2 : num 2.36 1.93 3.35 1.23 2.04 ... $ x3 : num 2.17 1.25 2.30 0.97 3.19 ... $ x4 : num 2.77 1.50 2.64 1.66 2.17 ... > attach(Rainks) > cor(Rainks) rain x1 x2 x3 x4 rain 1.0000000 0.7932854 0.8184772 0.7479617 0.8176309 x1 0.7932854 1.0000000 0.7686657 0.8826127 0.7199976 x2 0.8184772 0.7686657 1.0000000 0.7456419 0.7335268 x3 0.7479617 0.8826127 0.7456419 1.0000000 0.6384376 x4 0.8176309 0.7199976 0.7335268 0.6384376 1.0000000 > lm(rain~x2) Call: lm(formula = rain ~ x2) Coefficients: (Intercept) x2 0.5322 0.7770 > detach(Rainks) > > > > cleanEx(); ..nameEx <- "Randd" > > ### * Randd > > flush(stderr()); flush(stdout()) > > ### Name: Randd > ### Title: Research and development expenditures and sales of a large > ### company > ### Aliases: Randd > ### Keywords: datasets > > ### ** Examples > > str(Randd) `data.frame': 12 obs. of 5 variables: $ rd : num 1.2 2.4 3.1 4 4.9 6.3 1.8 2.7 3.3 3.7 ... $ sales: int 55 48 32 21 10 41 43 44 21 32 ... $ SRES1: num 0.763 0.779 -0.152 -0.546 -0.975 ... $ FITS1: num 46.8 38.6 33.9 27.7 21.6 ... $ RESI1: num 8.17 9.35 -1.88 -6.74 -11.61 ... > attach(Randd) > plot(rd,sales) > model <- lm(sales~rd) > abline(model) > summary(model) Call: lm(formula = sales ~ rd) Residuals: Min 1Q Median 3Q Max -14.3800 -10.5291 -0.8083 7.5896 28.9340 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 55.008 10.126 5.433 0.000288 *** rd -6.816 2.626 -2.596 0.026690 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 12.95 on 10 degrees of freedom Multiple R-Squared: 0.4025, Adjusted R-squared: 0.3428 F-statistic: 6.737 on 1 and 10 DF, p-value: 0.02669 > # plot(model) > detach(Randd) > remove(model) > > > > cleanEx(); ..nameEx <- "Rat" > > ### * Rat > > flush(stderr()); flush(stdout()) > > ### Name: Rat > ### Title: Survival times of 20 rats exposed to high levels of radiation > ### Aliases: Rat > ### Keywords: datasets > > ### ** Examples > > str(Rat) `data.frame': 20 obs. of 1 variable: $ survival.time: int 152 152 115 109 137 88 94 77 160 165 ... > attach(Rat) > hist(survival.time) > qqnorm(survival.time,col="blue") > qqline(survival.time,col="red") > t.test(survival.time)$conf [1] 96.69997 130.20003 attr(,"conf.level") [1] 0.95 > t.test(survival.time,mu=100,alternative="greater") One Sample t-test data: survival.time t = 1.6807, df = 19, p-value = 0.0546 alternative hypothesis: true mean is greater than 100 95 percent confidence interval: 99.61212 Inf sample estimates: mean of x 113.45 > detach(Rat) > > > > cleanEx(); ..nameEx <- "Ratings" > > ### * Ratings > > flush(stderr()); flush(stdout()) > > ### Name: Ratings > ### Title: Grade point averages versus teacher's ratings > ### Aliases: Ratings > ### Keywords: datasets > > ### ** Examples > > str(Ratings) `data.frame': 250 obs. of 7 variables: $ F : num 1.2 2.4 1.6 0.8 3.2 1.6 0.8 0.8 1.2 1.2 ... $ D : num 0.8 3.2 2 1.6 2.8 2 0.8 1.6 3.6 1.6 ... $ C : num 1.2 2.8 2.4 1.6 1.6 2.8 2.4 2 4 2 ... $ B : num 3.2 2 2 2.8 3.2 2 3.6 2.4 2.4 2.8 ... $ A : num 2.8 4 2.8 3.2 3.2 4 2 3.6 3.2 2 ... $ Rating: Factor w/ 5 levels "A","B","C","D",..: 5 5 5 5 5 5 5 5 5 5 ... $ GPA : num 1.2 2.4 1.6 0.8 3.2 1.6 0.8 0.8 1.2 1.2 ... > attach(Ratings) > boxplot(GPA~Rating,xlab="Teacher's Rating",ylab="GPA",main="Example 2.6",col="pink") > detach(Ratings) > > > > cleanEx(); ..nameEx <- "Reaction" > > ### * Reaction > > flush(stderr()); flush(stdout()) > > ### Name: Reaction > ### Title: Threshold reaction time for persons subjected to emotional > ### stress > ### Aliases: Reaction > ### Keywords: datasets > > ### ** Examples > > str(Reaction) `data.frame': 12 obs. of 1 variable: $ time: num 14.3 13.7 15.4 14.7 12.4 13.1 9.2 14.2 14.4 15.8 ... > attach(Reaction) > sign.test(time,md=15,alternative="less") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: time s = 2, p-value = 0.03271 alternative hypothesis: true median is less than 15 95 percent confidence interval: -Inf 14.82845 sample estimates: median of x 14.25 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9270 -Inf 14.7000 Interpolated CI 0.9500 -Inf 14.8285 Upper Achieved CI 0.9807 -Inf 15.0000 > detach(Reaction) > > > > cleanEx(); ..nameEx <- "Reading" > > ### * Reading > > flush(stderr()); flush(stdout()) > > ### Name: Reading > ### Title: Standardized reading scores for 30 fifth graders > ### Aliases: Reading > ### Keywords: datasets > > ### ** Examples > > str(Reading) `data.frame': 30 obs. of 4 variables: $ reading : int 86 103 92 115 94 102 123 81 108 93 ... $ sorted : int 48 67 73 81 83 86 92 93 94 94 ... $ trimmed : int NA NA NA 81 83 86 92 93 94 94 ... $ winsoriz: int 81 81 81 81 83 86 92 93 94 94 ... > attach(Reading) > EDA(reading) [1] "reading" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 30.000 0.000 48.000 92.750 98.800 98.500 98.821 106.250 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 149.000 18.920 357.959 3.454 13.500 101.000 1.356 0.018 SW p-val 0.118 > detach(Reading) > > > > cleanEx(); ..nameEx <- "Readiq" > > ### * Readiq > > flush(stderr()); flush(stdout()) > > ### Name: Readiq > ### Title: Reading scores versus IQ scores > ### Aliases: Readiq > ### Keywords: datasets > > ### ** Examples > > str(Readiq) `data.frame': 14 obs. of 2 variables: $ reading: int 42 35 61 28 48 46 59 21 47 29 ... $ IQ : int 105 110 122 92 112 100 120 85 125 96 ... > attach(Readiq) > plot(IQ,reading) > model <- lm(reading~IQ) > abline(model) > detach(Readiq) > > > > cleanEx(); ..nameEx <- "Referend" > > ### * Referend > > flush(stderr()); flush(stdout()) > > ### Name: Referend > ### Title: Opinion on referendum by view on freedom of the press > ### Aliases: Referend > ### Keywords: datasets > > ### ** Examples > > str(Referend) `data.frame': 3 obs. of 4 variables: $ Response: Factor w/ 3 levels "A","B","C": 1 2 3 $ For : int 24 68 47 $ Against : int 29 39 8 $ undecide: int 7 12 3 > attach(Referend) > chisq.test(Referend[,2:4]) Pearson's Chi-squared test data: Referend[, 2:4] X-squared = 21.0738, df = 4, p-value = 0.0003062 > detach(Referend) > > > > cleanEx(); ..nameEx <- "Region" > > ### * Region > > flush(stderr()); flush(stdout()) > > ### Name: Region > ### Title: Pollution index taken in three regions of the country > ### Aliases: Region > ### Keywords: datasets > > ### ** Examples > > str(Region) `data.frame': 48 obs. of 6 variables: $ West : int 153 164 171 173 176 178 180 181 181 182 ... $ Central: int 157 165 167 170 171 172 175 177 179 180 ... $ East : int 153 165 167 171 175 176 179 182 183 184 ... $ Index : int 153 164 171 173 176 178 180 181 181 182 ... $ Region : int 1 1 1 1 1 1 1 1 1 1 ... $ Ranks : num 1.5 4 11 14 17.5 20 23.5 25.5 25.5 28 ... > attach(Region) > boxplot(Index~Region) > anova(lm(Index~as.factor(Region))) Analysis of Variance Table Response: Index Df Sum Sq Mean Sq F value Pr(>F) as.factor(Region) 2 115.4 57.7 0.4224 0.6581 Residuals 45 6149.5 136.7 > detach(Region) > > > > cleanEx(); ..nameEx <- "Register" > > ### * Register > > flush(stderr()); flush(stdout()) > > ### Name: Register > ### Title: Maintenance cost versus age of cash registers in a department > ### store > ### Aliases: Register > ### Keywords: datasets > > ### ** Examples > > str(Register) `data.frame': 9 obs. of 4 variables: $ age : int 6 7 1 3 6 2 5 4 3 $ cost : int 92 181 23 40 126 35 86 72 51 $ SRES1: num -1.677 2.245 1.036 -0.692 0.230 ... $ FITS1: num 121.90 144.90 6.88 52.89 121.90 ... > attach(Register) > plot(age,cost,main="Exercise 2.3") > model <- lm(cost~age) > abline(model) > plot(age,resid(model)) > detach(Register) > > > > cleanEx(); ..nameEx <- "Rehab" > > ### * Rehab > > flush(stderr()); flush(stdout()) > > ### Name: Rehab > ### Title: Rehabilitative potential of 20 prison inmates as judged by two > ### psychiatrists > ### Aliases: Rehab > ### Keywords: datasets > > ### ** Examples > > str(Rehab) `data.frame': 20 obs. of 3 variables: $ Psych1: int 7 12 7 5 8 6 5 8 5 9 ... $ Psych2: int 5 10 8 6 5 4 5 6 5 8 ... $ differ: int 2 2 -1 -1 3 2 0 2 0 1 ... > attach(Rehab) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.9592, p-value = 0.5284 > boxplot(Psych1,Psych2,names=c("Psychiatrist 1","Psychiatrist 2"), + col=c("pink","lightblue")) > t.test(Psych1,Psych2,paired=TRUE) Paired t-test data: Psych1 and Psych2 t = 0.8569, df = 19, p-value = 0.4022 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.5770068 1.3770068 sample estimates: mean of the differences 0.4 > detach(Rehab) > > > > cleanEx(); ..nameEx <- "Remedial" > > ### * Remedial > > flush(stderr()); flush(stdout()) > > ### Name: Remedial > ### Title: Math placement test score for 35 freshmen females and 42 > ### freshmen males > ### Aliases: Remedial > ### Keywords: datasets > > ### ** Examples > > str(Remedial) `data.frame': 42 obs. of 2 variables: $ female: int 28 21 4 20 16 19 39 22 5 18 ... $ male : int 18 22 16 14 2 16 18 20 22 19 ... > attach(Remedial) > boxplot(female,male,col=c("blue","red")) > wilcox.test(female,male,conf.int=TRUE) Warning in wilcox.test.default(female, male, conf.int = TRUE) : cannot compute exact p-value with ties Warning in wilcox.test.default(female, male, conf.int = TRUE) : cannot compute exact confidence intervals with ties Wilcoxon rank sum test with continuity correction data: female and male W = 855.5, p-value = 0.2180 alternative hypothesis: true mu is not equal to 0 95 percent confidence interval: -0.9999613 3.0000179 sample estimates: difference in location 1.000024 > t.test(female,male) Welch Two Sample t-test data: female and male t = 0.21, df = 68.546, p-value = 0.8343 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -3.522407 4.350978 sample estimates: mean of x mean of y 19.34286 18.92857 > detach(Remedial) > > > > cleanEx(); ..nameEx <- "Rentals" > > ### * Rentals > > flush(stderr()); flush(stdout()) > > ### Name: Rentals > ### Title: Weekly rentals for 45 apartments > ### Aliases: Rentals > ### Keywords: datasets > > ### ** Examples > > str(Rentals) `data.frame': 45 obs. of 1 variable: $ rent: int 100 130 130 305 175 155 150 95 295 210 ... > attach(Rentals) > EDA(rent) [1] "rent" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 45.000 0.000 60.000 95.000 179.444 150.000 171.585 242.500 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 490.000 101.445 10291.162 15.123 147.500 430.000 0.516 1.047 SW p-val 0.001 > detach(Rentals) > > > > cleanEx(); ..nameEx <- "Repair" > > ### * Repair > > flush(stderr()); flush(stdout()) > > ### Name: Repair > ### Title: Recorded times for repairing 22 automobiles involved in wrecks > ### Aliases: Repair > ### Keywords: datasets > > ### ** Examples > > str(Repair) `data.frame': 22 obs. of 1 variable: $ time: num 10.3 4.1 8.6 2.1 3.7 5.6 11.4 5.7 3.8 4.5 ... > attach(Repair) > stem(time) The decimal point is 1 digit(s) to the right of the | 0 | 234444 0 | 5556666789 1 | 00012 1 | 2 | 3 > sign.test(time,conf.level=.98) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: time s = 22, p-value = 4.768e-07 alternative hypothesis: true median is not equal to 0 98 percent confidence interval: 4.134847 9.512883 sample estimates: median of x 5.65 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9475 4.5000 8.6000 Interpolated CI 0.9800 4.1348 9.5129 Upper Achieved CI 0.9831 4.1000 9.6000 > detach(Repair) > > > > cleanEx(); ..nameEx <- "Retail" > > ### * Retail > > flush(stderr()); flush(stdout()) > > ### Name: Retail > ### Title: Length of employment versus gross sales for 10 employees of a > ### large retail store > ### Aliases: Retail > ### Keywords: datasets > > ### ** Examples > > str(Retail) `data.frame': 10 obs. of 2 variables: $ months: int 10 22 8 16 31 2 13 36 18 6 $ sales : int 3860 4230 2650 5170 4970 4780 3120 4690 4920 2150 > attach(Retail) > summary(lm(sales~months)) Call: lm(formula = sales ~ months) Residuals: Min 1Q Median 3Q Max -1395.5067 -668.6233 0.9705 626.7460 1433.9024 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3246.39 574.50 5.651 0.000481 *** months 49.85 29.89 1.668 0.133910 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 977.6 on 8 degrees of freedom Multiple R-Squared: 0.258, Adjusted R-squared: 0.1652 F-statistic: 2.782 on 1 and 8 DF, p-value: 0.1339 > detach(Retail) > > > > cleanEx(); ..nameEx <- "Ronbrown1" > > ### * Ronbrown1 > > flush(stderr()); flush(stdout()) > > ### Name: Ronbrown1 > ### Title: Oceanography data obtained at site 1 by scientist aboard the > ### ship Ron Brown > ### Aliases: Ronbrown1 > ### Keywords: datasets > > ### ** Examples > > str(Ronbrown1) `data.frame': 75 obs. of 12 variables: $ depth : int 10 20 30 40 50 60 70 80 90 100 ... $ downtemp1 : num 27.4 27.4 27.3 27.2 26.8 ... $ downtemp2 : num 27.4 27.4 27.3 27.2 26.8 ... $ downsalinity1: num 33.3 33.3 33.3 33.3 33.4 ... $ downsalinity2: num 33.3 33.3 33.3 33.3 33.4 ... $ downdensity : num 21.3 21.3 21.3 21.4 21.6 ... $ C7 : int 10 20 30 40 50 60 70 80 90 100 ... $ uptemp1 : num 27.5 27.4 27.3 27.1 26.8 ... $ uptemp2 : num 27.5 27.4 27.3 27.1 26.8 ... $ upsalinity1 : num 33.3 33.3 33.3 33.4 33.5 ... $ upsalinity2 : num 33.3 33.3 33.3 33.4 33.5 ... $ updensity : num 21.3 21.3 21.3 21.5 21.6 ... > attach(Ronbrown1) > plot(depth,downtemp1) > detach(Ronbrown1) > > > > cleanEx(); ..nameEx <- "Ronbrown2" > > ### * Ronbrown2 > > flush(stderr()); flush(stdout()) > > ### Name: Ronbrown2 > ### Title: Oceanography data obtained at site 2 by scientist aboard the > ### ship Ron Brown > ### Aliases: Ronbrown2 > ### Keywords: datasets > > ### ** Examples > > str(Ronbrown2) `data.frame': 150 obs. of 6 variables: $ depth : int 10 20 30 40 50 60 70 80 90 100 ... $ primarytemp : num 23.6 23.6 23.5 23.5 23.5 ... $ secondarytemp : num 23.6 23.6 23.5 23.5 23.5 ... $ primarysalinity : num 35.6 35.6 35.6 35.6 35.6 ... $ secondarysalinity: num 35.6 35.6 35.6 35.6 35.6 ... $ density : num 24.2 24.2 24.2 24.2 24.3 ... > attach(Ronbrown2) > plot(depth,primarysalinity,xlab="Depth",ylab="Salinity", + main="Example 2.4",col="tomato") > detach(Ronbrown2) > > > > cleanEx(); ..nameEx <- "Rural" > > ### * Rural > > flush(stderr()); flush(stdout()) > > ### Name: Rural > ### Title: Social adjustment scores for a rural group and a city group of > ### children > ### Aliases: Rural > ### Keywords: datasets > > ### ** Examples > > str(Rural) `data.frame': 33 obs. of 4 variables: $ Rural: int 55 57 62 58 34 52 63 84 50 56 ... $ City : int 61 59 64 42 58 65 81 67 69 23 ... $ score: int 55 57 62 58 34 52 63 84 50 56 ... $ code : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Rural) > wilcox.test(score~code) Warning in wilcox.test.default(x = c(55, 57, 62, 58, 34, 52, 63, 84, 50, : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: score by code W = 94, p-value = 0.1346 alternative hypothesis: true mu is not equal to 0 > wilcox.test(Rural,City) Warning in wilcox.test.default(Rural, City) : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: Rural and City W = 94, p-value = 0.1346 alternative hypothesis: true mu is not equal to 0 > detach(Rural) > > > > cleanEx(); ..nameEx <- "SRS" > > ### * SRS > > flush(stderr()); flush(stdout()) > > ### Name: SRS > ### Title: Simple Random Sampling > ### Aliases: SRS > ### Keywords: distribution > > ### ** Examples > > SRS(c(5,8,3),2) [,1] [,2] [1,] 5 8 [2,] 5 3 [3,] 8 3 > # The rows in the matrix list the values for the 3 possible > # simple random samples of size 2 from the population of 5,8, and 3. > > > > cleanEx(); ..nameEx <- "Salary" > > ### * Salary > > flush(stderr()); flush(stdout()) > > ### Name: Salary > ### Title: Starting salaries for 25 new PhD psychologist > ### Aliases: Salary > ### Keywords: datasets > > ### ** Examples > > str(Salary) `data.frame': 25 obs. of 1 variable: $ salary: int 27900 28300 14400 25200 28900 23700 31000 20100 23100 26600 ... > attach(Salary) > qqnorm(salary,main="Problem 3.66") > qqline(salary) > shapiro.test(salary) Shapiro-Wilk normality test data: salary W = 0.9621, p-value = 0.4588 > detach(Salary) > > > > cleanEx(); ..nameEx <- "Salinity" > > ### * Salinity > > flush(stderr()); flush(stdout()) > > ### Name: Salinity > ### Title: Surface-water salinity measurements from Whitewater Bay, Florida > ### Aliases: Salinity > ### Keywords: datasets > > ### ** Examples > > str(Salinity) `data.frame': 48 obs. of 1 variable: $ salinity: int 46 37 62 59 40 53 58 49 60 56 ... > attach(Salinity) > EDA(salinity) [1] "salinity" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 48.000 0.000 34.000 42.250 49.542 48.500 49.182 57.500 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 78.000 9.269 85.913 1.338 15.250 44.000 0.212 0.550 SW p-val 0.168 > t.test(salinity,conf.level=.99)$conf [1] 45.95012 53.13321 attr(,"conf.level") [1] 0.99 > detach(Salinity) > > > > cleanEx(); ..nameEx <- "Sat" > > ### * Sat > > flush(stderr()); flush(stdout()) > > ### Name: Sat > ### Title: SAT scores, percent taking exam and state funding per student by > ### state for 1994, 1995 and 1999 > ### Aliases: Sat > ### Keywords: datasets > > ### ** Examples > > str(Sat) `data.frame': 51 obs. of 16 variables: $ state : Factor w/ 51 levels "alabama","alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ verbal94 : int 482 434 443 417 413 456 426 428 406 413 ... $ math94 : int 529 477 496 518 482 513 472 464 443 466 ... $ total94 : int 1011 911 939 935 895 969 898 892 849 879 ... $ percent94: int 8 49 26 6 46 28 80 68 53 49 ... $ code94 : int 1 2 1 1 2 1 2 2 2 2 ... $ expend94 : int 3616 8450 4381 4031 4746 5172 8017 6093 9549 5243 ... $ verbal95 : int 565 521 524 556 492 538 507 505 485 497 ... $ math95 : int 555 513 520 542 509 538 502 494 471 496 ... $ total95 : int 1120 1034 1044 1098 1001 1076 1009 999 956 993 ... $ verbal99 : int 561 516 524 563 497 536 510 503 494 499 ... $ math99 : int 555 514 525 556 514 540 509 497 478 498 ... $ total99 : int 1116 1030 1049 1119 1011 1076 1019 1000 972 997 ... $ percent99: int 9 50 34 6 49 32 80 67 77 53 ... $ code99 : int 1 2 2 1 2 2 2 2 2 2 ... $ expend99 : int 4903 9097 4940 4840 5414 5728 8901 7804 9019 5986 ... > attach(Sat) > pairs(Sat) > detach(Sat) > > > > cleanEx(); ..nameEx <- "Saving" > > ### * Saving > > flush(stderr()); flush(stdout()) > > ### Name: Saving > ### Title: Problem asset ration for savings and loan companies in > ### California, New York, and Texas > ### Aliases: Saving > ### Keywords: datasets > > ### ** Examples > > str(Saving) `data.frame': 75 obs. of 6 variables: $ calif : num 103 188 108 140 101 ... $ newyork: num 124 176 NA 169 111 ... $ texas : num 34033 418 416 565 128 ... $ PAR : num 103 188 108 140 101 ... $ state : int 1 1 1 1 1 1 1 1 1 1 ... $ ranks : int 3 36 7 24 2 4 NA NA 14 31 ... > attach(Saving) > boxplot(PAR~state) > kruskal.test(PAR~as.factor(state)) Kruskal-Wallis rank sum test data: PAR by as.factor(state) Kruskal-Wallis chi-squared = 1.708, df = 2, p-value = 0.4257 > detach(Saving) > > > > cleanEx(); ..nameEx <- "Scales" > > ### * Scales > > flush(stderr()); flush(stdout()) > > ### Name: Scales > ### Title: Readings obtained from a 100 pound weight placed on four brands > ### of bathroom scales > ### Aliases: Scales > ### Keywords: datasets > > ### ** Examples > > str(Scales) `data.frame': 20 obs. of 2 variables: $ Brand : Factor w/ 4 levels "A","B","C","D": 1 1 1 1 1 2 2 2 2 2 ... $ reading: num 102 102 106 104 103 ... > attach(Scales) > boxplot(reading~Brand,ylab="Reading",xlab="Brand",main="Problem 1.89") > detach(Scales) > > > > cleanEx(); ..nameEx <- "Schizop2" > > ### * Schizop2 > > flush(stderr()); flush(stdout()) > > ### Name: Schizop2 > ### Title: Exam scores for 17 patients to assess the learning ability of > ### schizophrenics after taking a specified does of a tranquilizer > ### Aliases: Schizop2 > ### Keywords: datasets > > ### ** Examples > > str(Schizop2) `data.frame': 17 obs. of 1 variable: $ score: int 36 29 30 32 37 15 34 23 32 5 ... > attach(Schizop2) > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 17.000 0.000 5.000 19.000 26.000 30.000 26.000 33.500 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 37.000 9.721 94.500 2.358 14.500 32.000 -0.749 -0.809 SW p-val 0.031 > sign.test(score,md=22,alternative="greater") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: score s = 13, p-value = 0.02452 alternative hypothesis: true median is greater than 22 95 percent confidence interval: 23.53969 Inf sample estimates: median of x 30 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9283 24.0000 Inf Interpolated CI 0.9500 23.5397 Inf Upper Achieved CI 0.9755 23.0000 Inf > detach(Schizop2) > > > > cleanEx(); ..nameEx <- "Schizoph" > > ### * Schizoph > > flush(stderr()); flush(stdout()) > > ### Name: Schizoph > ### Title: Standardized exam scores for 13 patients to investigate the > ### learning ability of schizophrenics after a specified dose of a > ### tranquilizer > ### Aliases: Schizoph > ### Keywords: datasets > > ### ** Examples > > str(Schizoph) `data.frame': 13 obs. of 1 variable: $ score: int 15 20 30 27 24 22 22 17 21 25 ... > attach(Schizoph) > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 13.000 0.000 15.000 20.500 22.923 23.000 22.923 26.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 30.000 4.132 17.077 1.146 5.500 15.000 -0.795 -0.250 SW p-val 0.980 > t.test(score,mu=20) One Sample t-test data: score t = 2.5504, df = 12, p-value = 0.02545 alternative hypothesis: true mean is not equal to 20 95 percent confidence interval: 20.42588 25.42028 sample estimates: mean of x 22.92308 > detach(Schizoph) > > > > cleanEx(); ..nameEx <- "Seatbelt" > > ### * Seatbelt > > flush(stderr()); flush(stdout()) > > ### Name: Seatbelt > ### Title: Injury level versus seatbelt usage > ### Aliases: Seatbelt > ### Keywords: datasets > > ### ** Examples > > str(Seatbelt) `data.frame': 2 obs. of 5 variables: $ seatbelt: Factor w/ 2 levels "no","yes": 2 1 $ None : int 12813 65963 $ Minimal : int 647 4000 $ Minor : int 359 2642 $ Major : int 42 303 > attach(Seatbelt) > Seatbelt seatbelt None Minimal Minor Major 1 yes 12813 647 359 42 2 no 65963 4000 2642 303 > chisq.test(Seatbelt[,2:5]) Pearson's Chi-squared test data: Seatbelt[, 2:5] X-squared = 59.224, df = 3, p-value = 8.61e-13 > detach(Seatbelt) > > > > cleanEx(); ..nameEx <- "Selfdefe" > > ### * Selfdefe > > flush(stderr()); flush(stdout()) > > ### Name: Selfdefe > ### Title: Self-confidence scores for 9 women before and after instructions > ### on self-defense > ### Aliases: Selfdefe > ### Keywords: datasets > > ### ** Examples > > str(Selfdefe) `data.frame': 9 obs. of 3 variables: $ Woman : int 1 2 3 4 5 6 7 8 9 $ Before: int 6 10 8 6 5 4 3 8 5 $ After : int 7 12 7 5 8 6 5 8 6 > attach(Selfdefe) > DIF <- After-Before > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9115, p-value = 0.3267 > t.test(After,Before,paired=TRUE,alternative="greater") Paired t-test data: After and Before t = 2.1213, df = 8, p-value = 0.03334 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 0.1234006 Inf sample estimates: mean of the differences 1 > detach(Selfdefe) > remove(DIF) > > > > cleanEx(); ..nameEx <- "Senior" > > ### * Senior > > flush(stderr()); flush(stdout()) > > ### Name: Senior > ### Title: Reaction times of 30 senior citizens applying for drivers > ### license renewals > ### Aliases: Senior > ### Keywords: datasets > > ### ** Examples > > str(Senior) `data.frame': 31 obs. of 1 variable: $ reaction: int 93 105 66 94 64 98 109 71 86 31 ... > attach(Senior) > fivenum(reaction) [1] 31 74 90 98 128 > boxplot(reaction,horizontal=TRUE,main="Problem 1.83 Part d.",col="orange") > detach(Senior) > > > > cleanEx(); ..nameEx <- "Sentence" > > ### * Sentence > > flush(stderr()); flush(stdout()) > > ### Name: Sentence > ### Title: Sentences of 41 prisoners convicted of a homicide offense > ### Aliases: Sentence > ### Keywords: datasets > > ### ** Examples > > str(Sentence) `data.frame': 41 obs. of 1 variable: $ months: int 117 188 172 145 173 159 123 136 115 190 ... > attach(Sentence) > stem(months) The decimal point is 1 digit(s) to the right of the | 10 | 577 12 | 13683455679 14 | 45678905789 16 | 03489236 18 | 058056 20 | 96 > EDA(months) [1] "months" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 41.000 0.000 115.000 135.000 155.073 150.000 154.081 172.500 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 216.000 25.863 668.870 4.039 37.500 101.000 -0.632 0.441 SW p-val 0.286 > ll <- mean(months)-2*sd(months) > ul <- mean(months)+2*sd(months) > limits <- c(ll,ul) > limits [1] 103.3481 206.7982 > detach(Sentence) > > > > cleanEx(); ..nameEx <- "Shkdrug" > > ### * Shkdrug > > flush(stderr()); flush(stdout()) > > ### Name: Shkdrug > ### Title: Effects of a drug and electroshock therapy on the ability to > ### solve simple tasks > ### Aliases: Shkdrug > ### Keywords: datasets > > ### ** Examples > > str(Shkdrug) `data.frame': 64 obs. of 6 variables: $ Drug.Shk : int 3 1 2 1 4 3 2 4 2 1 ... $ Drug.NoS : int 2 3 4 0 2 4 2 4 5 6 ... $ NoDrug.S : int 1 2 2 0 1 2 3 1 0 3 ... $ NoDg.NoS : int 5 3 2 3 4 6 5 4 6 3 ... $ Treatment: Factor w/ 4 levels "Drug/NoS","Drug/Shk",..: 2 2 2 2 2 2 2 2 2 2 ... $ Response : int 3 1 2 1 4 3 2 4 2 1 ... > attach(Shkdrug) > boxplot(Response~Treatment) > anova(lm(Response~Treatment)) Analysis of Variance Table Response: Response Df Sum Sq Mean Sq F value Pr(>F) Treatment 3 58.125 19.375 11.006 7.435e-06 *** Residuals 60 105.625 1.760 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Shkdrug) > > > > cleanEx(); ..nameEx <- "Shock" > > ### * Shock > > flush(stderr()); flush(stdout()) > > ### Name: Shock > ### Title: Effect of experimental shock on time to complete difficult task > ### Aliases: Shock > ### Keywords: datasets > > ### ** Examples > > str(Shock) `data.frame': 9 obs. of 3 variables: $ Group1: int 6 3 4 8 6 3 7 9 7 $ Group2: int 11 9 7 14 10 9 13 11 10 $ Group3: int 14 15 12 16 15 18 16 13 15 > attach(Shock) > STACKED <-stack(Shock) > STACKED[1:5,] values ind 1 6 Group1 2 3 Group1 3 4 Group1 4 8 Group1 5 6 Group1 > boxplot(values~ind,col=c("red","blue","green"),data=STACKED) > anova(lm(values~ind,data=STACKED)) Analysis of Variance Table Response: values Df Sum Sq Mean Sq F value Pr(>F) ind 2 364.52 182.26 44.635 8.188e-09 *** Residuals 24 98.00 4.08 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > remove(STACKED) > detach(Shock) > > > > > cleanEx(); ..nameEx <- "Shoplift" > > ### * Shoplift > > flush(stderr()); flush(stdout()) > > ### Name: Shoplift > ### Title: Sales receipts versus shoplifting losses for a department store > ### Aliases: Shoplift > ### Keywords: datasets > > ### ** Examples > > str(Shoplift) `data.frame': 8 obs. of 2 variables: $ sales: num 8.4 7.1 9.3 12.3 10.8 8.1 6.5 7.8 $ loss : num 16.2 12.3 19.8 18.4 14.6 15.8 11.4 13.1 > attach(Shoplift) > summary(lm(loss~sales)) Call: lm(formula = loss ~ sales) Residuals: Min 1Q Median 3Q Max -2.6829 -1.2232 -0.7567 1.3339 4.0696 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.1050 4.0496 1.508 0.1824 sales 1.0350 0.4513 2.293 0.0617 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.316 on 6 degrees of freedom Multiple R-Squared: 0.4671, Adjusted R-squared: 0.3783 F-statistic: 5.259 on 1 and 6 DF, p-value: 0.06167 > detach(Shoplift) > > > > cleanEx(); ..nameEx <- "Short" > > ### * Short > > flush(stderr()); flush(stdout()) > > ### Name: Short > ### Title: James Short's measurements of the parallax of the sun > ### Aliases: Short > ### Keywords: datasets > > ### ** Examples > > str(Short) `data.frame': 158 obs. of 10 variables: $ Sample.1: num 8.50 8.50 7.33 8.64 9.27 ... $ Sample.2: num 8.65 8.35 8.71 8.31 8.36 ... $ Sample.3: num 8.50 8.80 8.40 8.82 9.02 ... $ Sample.4: num 8.70 9.66 8.50 8.65 10.33 ... $ Sample.5: num 8.43 9.09 8.50 8.44 9.71 ... $ Sample.6: num 8.63 10.16 8.50 8.31 10.80 ... $ Sample.7: num 8.54 8.56 8.54 8.74 8.91 ... $ Sample.8: num 8.54 8.58 8.54 8.94 9.24 ... $ Parallax: num 8.50 8.50 7.33 8.64 9.27 ... $ Sample : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Short) > hist(Parallax) > EDA(Parallax) [1] "Parallax" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 158.000 0.000 5.760 8.338 8.610 8.550 8.594 8.803 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 10.800 0.674 0.455 0.054 0.465 5.040 2.763 0.323 SW p-val 0.000 > sign.test(Parallax,md=8.798) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: Parallax s = 40, p-value = 3.966e-10 alternative hypothesis: true median is not equal to 8.798 95 percent confidence interval: 8.50 8.58 sample estimates: median of x 8.55 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9331 8.5 8.58 Interpolated CI 0.9500 8.5 8.58 Upper Achieved CI 0.9536 8.5 8.58 > t.test(Parallax,mu=8.798) One Sample t-test data: Parallax t = -3.5135, df = 157, p-value = 0.000578 alternative hypothesis: true mean is not equal to 8.798 95 percent confidence interval: 8.503618 8.715496 sample estimates: mean of x 8.609557 > detach(Short) > > > > cleanEx(); ..nameEx <- "Shuttle" > > ### * Shuttle > > flush(stderr()); flush(stdout()) > > ### Name: Shuttle > ### Title: Number of people riding shuttle versus number of automobiles in > ### the downtown area > ### Aliases: Shuttle > ### Keywords: datasets > > ### ** Examples > > str(Shuttle) `data.frame': 15 obs. of 2 variables: $ shuttle: int 160 180 240 280 440 370 490 620 850 840 ... $ autos : int 2460 2730 2560 2600 2290 2370 2410 2040 1820 1950 ... > attach(Shuttle) > model <- lm(autos~shuttle) > summary(model) Call: lm(formula = autos ~ shuttle) Residuals: Min 1Q Median 3Q Max -195.0352 -41.0558 -0.9788 82.3567 149.2866 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2837.23046 55.59622 51.03 2.30e-16 *** shuttle -1.15105 0.06872 -16.75 3.52e-10 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 109.5 on 13 degrees of freedom Multiple R-Squared: 0.9557, Adjusted R-squared: 0.9523 F-statistic: 280.5 on 1 and 13 DF, p-value: 3.515e-10 > detach(Shuttle) > remove(model) > > > > cleanEx(); ..nameEx <- "Simpson" > > ### * Simpson > > flush(stderr()); flush(stdout()) > > ### Name: Simpson > ### Title: Grade point averages of men and women participating in various > ### sports-an illustration of Simpson's paradox > ### Aliases: Simpson > ### Keywords: datasets > > ### ** Examples > > str(Simpson) `data.frame': 100 obs. of 15 variables: $ gpa : num 2.78 2.80 2.39 2.71 2.46 ... $ spor : int 3 3 2 3 2 3 3 2 3 1 ... $ gender : int 1 1 1 1 1 1 1 1 1 1 ... $ gpamale : num 2.78 2.80 2.39 2.71 2.46 ... $ sptmale : int 3 3 2 3 2 3 3 2 3 1 ... $ gpafemal: num 2.08 2.56 2.37 2.46 3.12 ... $ sptfemal: int 1 2 2 2 3 2 2 3 2 2 ... $ bbgpa : num 1.95 1.96 2.00 1.99 1.83 ... $ genderbb: int 1 1 1 1 1 1 1 1 1 1 ... $ sogpa : num 2.39 2.46 2.29 2.57 2.32 ... $ genderso: int 3 3 3 3 3 3 3 3 3 3 ... $ tkgpa : num 2.78 2.80 2.71 2.64 2.74 ... $ gendertk: int 5 5 5 5 5 5 5 5 5 5 ... $ gradept : num 1.95 1.96 2.00 1.99 1.83 ... $ gender2 : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Simpson) > par(mfrow=c(1,2)) > boxplot(gpa~gender,col=c("blue","pink"),names=c("Male","Female"), + main="GPA versus Gender",xlab="Gender",ylab="Grade Point Average") > boxplot(gradept~gender2,las=2,col=c("blue","pink"), + names=c("M-BBALL","F-BBALL","M-SOCC","F-SOCC","M-TRAC","F-TRAC"), + ylab="Grade Point Average",main="GPA vs Gender by Sports") > par(mfrow=c(1,1)) > detach(Simpson) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Situp" > > ### * Situp > > flush(stderr()); flush(stdout()) > > ### Name: Situp > ### Title: Maximum number of situps by participants in an exercise class > ### Aliases: Situp > ### Keywords: datasets > > ### ** Examples > > str(Situp) `data.frame': 20 obs. of 1 variable: $ number: int 24 31 54 62 36 28 37 55 18 27 ... > attach(Situp) > stem(number) The decimal point is 1 digit(s) to the right of the | 1 | 8 2 | 4789 3 | 1256779 4 | 12 5 | 45568 6 | 2 > hist(number,breaks=seq(0,70,10)) > hist(number,breaks=seq(0,70,10),right=FALSE,col="blue",prob=TRUE, + main="Problems 1.46 & 1.47") > lines(density(number),col="red",lwd=3) > detach(Situp) > > > > cleanEx(); ..nameEx <- "Skewed" > > ### * Skewed > > flush(stderr()); flush(stdout()) > > ### Name: Skewed > ### Title: Illustrates the Wilcoxon Rank Sum test > ### Aliases: Skewed > ### Keywords: datasets > > ### ** Examples > > str(Skewed) `data.frame': 21 obs. of 2 variables: $ C1: int 223 226 229 235 238 242 246 249 250 253 ... $ C2: int 210 214 217 225 226 229 229 231 234 238 ... > attach(Skewed) > boxplot(C1,C2) > wilcox.test(C1,C2) Warning in wilcox.test.default(C1, C2) : cannot compute exact p-value with ties Wilcoxon rank sum test with continuity correction data: C1 and C2 W = 266.5, p-value = 0.07156 alternative hypothesis: true mu is not equal to 0 > detach(Skewed) > > > > cleanEx(); ..nameEx <- "Skin" > > ### * Skin > > flush(stderr()); flush(stdout()) > > ### Name: Skin > ### Title: Survival times of closely and poorly matched skin grafts on burn > ### patients > ### Aliases: Skin > ### Keywords: datasets > > ### ** Examples > > str(Skin) `data.frame': 11 obs. of 2 variables: $ close: int 37 19 57 93 16 22 20 18 63 29 ... $ poor : int 29 13 15 26 11 17 26 21 43 15 ... > attach(Skin) > DIFF <- close-poor > stem(DIFF) The decimal point is 1 digit(s) to the right of the | -0 | 63 0 | 55684 2 | 00 4 | 2 6 | 7 > EDA(DIFF) [1] "DIFF" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 11.000 0.000 -6.000 5.000 16.182 8.000 16.182 20.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 67.000 21.363 456.364 6.441 15.000 73.000 0.290 1.177 SW p-val 0.031 > remove(DIFF) > detach(Skin) > > > > cleanEx(); ..nameEx <- "Slc" > > ### * Slc > > flush(stderr()); flush(stdout()) > > ### Name: Slc > ### Title: Sodium-lithium countertransport activity on 190 individuals from > ### six large English kindred > ### Aliases: Slc > ### Keywords: datasets > > ### ** Examples > > str(Slc) `data.frame': 190 obs. of 1 variable: $ SLC: num 0.467 0.430 0.192 0.192 0.293 ... > attach(Slc) > EDA(SLC) [1] "SLC" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 190.000 0.000 0.073 0.192 0.263 0.250 0.257 0.317 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 0.623 0.099 0.010 0.007 0.125 0.550 1.385 1.050 SW p-val 0.000 > detach(Slc) > > > > cleanEx(); ..nameEx <- "Smokyph" > > ### * Smokyph > > flush(stderr()); flush(stdout()) > > ### Name: Smokyph > ### Title: Water pH levels of 75 water samples taken in the Great Smoky > ### Mountains > ### Aliases: Smokyph > ### Keywords: datasets > > ### ** Examples > > str(Smokyph) `data.frame': 75 obs. of 5 variables: $ waterph: num 7.91 7.14 6.81 6.97 7.21 ... $ code : Factor w/ 2 levels "high","low": 2 2 2 2 2 2 2 2 2 2 ... $ elev : num 0.244 0.375 0.567 0.512 0.408 ... $ SRES1 : num 1.127 -0.551 -0.939 -0.661 -0.294 ... $ FITS1 : num 7.47 7.36 7.18 7.23 7.33 ... > attach(Smokyph) > t.test(waterph,mu=7) One Sample t-test data: waterph t = 2.7516, df = 74, p-value = 0.007452 alternative hypothesis: true mean is not equal to 7 95 percent confidence interval: 7.038511 7.240689 sample estimates: mean of x 7.1396 > sign.test(waterph,md=7) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: waterph s = 42, p-value = 0.2954 alternative hypothesis: true median is not equal to 7 95 percent confidence interval: 6.954832 7.085168 sample estimates: median of x 7.03 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9361 6.9600 7.0800 Interpolated CI 0.9500 6.9548 7.0852 Upper Achieved CI 0.9630 6.9500 7.0900 > tapply(waterph,code,mean) high low 7.039697 7.218095 > stripchart(waterph~code,method="stack",pch=19,col=c("red","blue")) > qqnorm(waterph[code=="low"]) > qqnorm(waterph[code=="high"]) > t.test(waterph[code=="low"],waterph[code=="high"]) Welch Two Sample t-test data: waterph[code == "low"] and waterph[code == "high"] t = 1.859, df = 70.875, p-value = 0.06718 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.01295770 0.36975424 sample estimates: mean of x mean of y 7.218095 7.039697 > t.test(waterph[code=="low"],waterph[code=="high"],conf.level=.90)$conf [1] 0.01845818 0.33833836 attr(,"conf.level") [1] 0.9 > detach(Smokyph) > > > > cleanEx(); ..nameEx <- "Snore" > > ### * Snore > > flush(stderr()); flush(stdout()) > > ### Name: Snore > ### Title: Snoring versus heart disease > ### Aliases: Snore > ### Keywords: datasets > > ### ** Examples > > str(Snore) `data.frame': 2 obs. of 5 variables: $ heart : Factor w/ 2 levels "no","yes": 2 1 $ Non : int 24 1355 $ occasion: int 35 603 $ nearly : int 21 192 $ every : int 30 224 > attach(Snore) > chisq.test(Snore[,2:5]) Pearson's Chi-squared test data: Snore[, 2:5] X-squared = 72.7821, df = 3, p-value = 1.082e-15 > detach(Snore) > > > > cleanEx(); ..nameEx <- "Snow" > > ### * Snow > > flush(stderr()); flush(stdout()) > > ### Name: Snow > ### Title: Concentration of microparticles in snowfields of Greenland and > ### Antarctica > ### Aliases: Snow > ### Keywords: datasets > > ### ** Examples > > str(Snow) `data.frame': 34 obs. of 4 variables: $ antarc : num 3.7 2 1.3 3.9 0.2 1.4 4.2 4.9 0.6 1.4 ... $ greenld: num 3.7 7.8 1.9 2 1.1 1.3 1.9 3.7 3.4 1.6 ... $ concent: num 3.7 2 1.3 3.9 0.2 1.4 4.2 4.9 0.6 1.4 ... $ site : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Snow) > boxplot(concent~site) > detach(Snow) > > > > cleanEx(); ..nameEx <- "Soccer" > > ### * Soccer > > flush(stderr()); flush(stdout()) > > ### Name: Soccer > ### Title: Weights of 25 soccer players > ### Aliases: Soccer > ### Keywords: datasets > > ### ** Examples > > str(Soccer) `data.frame': 25 obs. of 1 variable: $ weight: int 144 162 197 173 183 129 209 190 117 160 ... > attach(Soccer) > stem(weight,scale=2) The decimal point is 1 digit(s) to the right of the | 11 | 7 12 | 9 13 | 26 14 | 48 15 | 014479 16 | 0226 17 | 3579 18 | 34 19 | 07 20 | 9 > hist(weight,breaks=seq(110,210,10),col="orange", + main="Problem 1.46 \n Weights of Soccer Players",right=FALSE) > detach(Soccer) > > > > cleanEx(); ..nameEx <- "Social" > > ### * Social > > flush(stderr()); flush(stdout()) > > ### Name: Social > ### Title: Median income level for 25 social workers from North Carolina > ### Aliases: Social > ### Keywords: datasets > > ### ** Examples > > str(Social) `data.frame': 25 obs. of 1 variable: $ income: int 25200 26500 26700 27900 28000 25500 22200 24700 27000 26500 ... > attach(Social) > sign.test(income,md=27500,alternative="less") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: income s = 8, p-value = 0.05388 alternative hypothesis: true median is less than 27500 95 percent confidence interval: -Inf 27424.05 sample estimates: median of x 26500 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9461 -Inf 27400.00 Interpolated CI 0.9500 -Inf 27424.05 Upper Achieved CI 0.9784 -Inf 27600.00 > detach(Social) > > > > cleanEx(); ..nameEx <- "Sophomor" > > ### * Sophomor > > flush(stderr()); flush(stdout()) > > ### Name: Sophomor > ### Title: Grade point averages, SAT scores and final grade in college > ### algebra for 20 sophomores > ### Aliases: Sophomor > ### Keywords: datasets > > ### ** Examples > > str(Sophomor) `data.frame': 20 obs. of 4 variables: $ Student: int 1 2 3 4 5 6 7 8 9 10 ... $ GPA : num 2.6 2.1 3.5 1.7 2.2 2.9 2.3 3.2 2.3 2.8 ... $ SAT : int 510 460 680 390 420 510 370 550 420 470 ... $ Exam : int 84 77 94 45 71 89 65 90 82 87 ... > attach(Sophomor) > cor(Sophomor) Student GPA SAT Exam Student 1.00000000 0.03318292 0.00558619 0.06689427 GPA 0.03318292 1.00000000 0.90061435 0.86065205 SAT 0.00558619 0.90061435 1.00000000 0.82544464 Exam 0.06689427 0.86065205 0.82544464 1.00000000 > detach(Sophomor) > > > > cleanEx(); ..nameEx <- "South" > > ### * South > > flush(stderr()); flush(stdout()) > > ### Name: South > ### Title: Murder rates for 30 cities in the South > ### Aliases: South > ### Keywords: datasets > > ### ** Examples > > str(South) `data.frame': 31 obs. of 1 variable: $ rate: int 12 10 10 13 12 12 14 7 16 18 ... > attach(South) > boxplot(rate,col="yellow",main="Problem 1.83") > detach(South) > > > > cleanEx(); ..nameEx <- "Speed" > > ### * Speed > > flush(stderr()); flush(stdout()) > > ### Name: Speed > ### Title: Speed reading scores before and after a course on speed reading > ### Aliases: Speed > ### Keywords: datasets > > ### ** Examples > > str(Speed) `data.frame': 15 obs. of 4 variables: $ Before : int 57 80 64 72 90 59 76 98 70 57 ... $ After : int 60 90 62 79 95 58 80 99 75 64 ... $ differ : int 3 10 -2 7 5 -1 4 1 5 7 ... $ signrnks: num 6.5 13 -4 11.5 9.5 -1.5 8 1.5 9.5 11.5 ... > attach(Speed) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.7579, p-value = 0.001112 > t.test(After,Before,paired=TRUE,alternative="greater") Paired t-test data: After and Before t = 0.9904, df = 14, p-value = 0.1694 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: -2.490967 Inf sample estimates: mean of the differences 3.2 > wilcox.test(After,Before,paired=TRUE,alternative="greater") Warning in wilcox.test.default(After, Before, paired = TRUE, alternative = "greater") : cannot compute exact p-value with ties Wilcoxon signed rank test with continuity correction data: After and Before V = 100.5, p-value = 0.01144 alternative hypothesis: true mu is greater than 0 > detach(Speed) > > > > cleanEx(); ..nameEx <- "Spellers" > > ### * Spellers > > flush(stderr()); flush(stdout()) > > ### Name: Spellers > ### Title: Standardized spelling test scores for two fourth grade classes > ### Aliases: Spellers > ### Keywords: datasets > > ### ** Examples > > str(Spellers) `data.frame': 10 obs. of 2 variables: $ Fourth : int 105 109 115 112 124 107 121 112 104 119 $ Colleag: int 115 103 110 125 99 121 119 106 100 123 > attach(Spellers) > t.test(Fourth,Colleag,alternative="greater") Welch Two Sample t-test data: Fourth and Colleag t = 0.1851, df = 16.12, p-value = 0.4277 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: -5.897815 Inf sample estimates: mean of x mean of y 112.8 112.1 > detach(Spellers) > > > > cleanEx(); ..nameEx <- "Spelling" > > ### * Spelling > > flush(stderr()); flush(stdout()) > > ### Name: Spelling > ### Title: Spelling scores for 9 eighth graders before and after a 2-week > ### course of instruction > ### Aliases: Spelling > ### Keywords: datasets > > ### ** Examples > > str(Spelling) `data.frame': 9 obs. of 3 variables: $ Before: int 90 72 80 57 64 70 98 76 59 $ After : int 95 79 90 60 62 70 99 80 58 $ differ: int 5 7 10 3 -2 0 1 4 -1 > attach(Spelling) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.9642, p-value = 0.8411 > t.test(After,Before,paired=TRUE,alternative="greater") Paired t-test data: After and Before t = 2.286, df = 8, p-value = 0.02579 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 0.5596507 Inf sample estimates: mean of the differences 3 > detach(Spelling) > > > > cleanEx(); ..nameEx <- "Sports" > > ### * Sports > > flush(stderr()); flush(stdout()) > > ### Name: Sports > ### Title: Favorite sport by gender > ### Aliases: Sports > ### Keywords: datasets > > ### ** Examples > > str(Sports) `data.frame': 2 obs. of 4 variables: $ Football : num 33 38 $ Basketball: num 38 21 $ Baseball : num 24 15 $ Tennis : num 5 36 > attach(Sports) > chisq.test(Sports) Pearson's Chi-squared test data: Sports X-squared = 30.359, df = 3, p-value = 1.160e-06 > detach(Sports) > > > > cleanEx(); ..nameEx <- "Spouse" > > ### * Spouse > > flush(stderr()); flush(stdout()) > > ### Name: Spouse > ### Title: Convictions in spouse murder cases by gender > ### Aliases: Spouse > ### Keywords: datasets > > ### ** Examples > > str(Spouse) `data.frame': 4 obs. of 3 variables: $ result : Factor w/ 4 levels "acquitted","convicted",..: 3 4 2 1 $ husband: int 35 146 130 7 $ wife : int 35 87 69 31 > attach(Spouse) > Spouse result husband wife 1 not prosecuted 35 35 2 pleaded guilty 146 87 3 convicted 130 69 4 acquitted 7 31 > chisq.test(Spouse[,2:3]) Pearson's Chi-squared test data: Spouse[, 2:3] X-squared = 32.7652, df = 3, p-value = 3.61e-07 > detach(Spouse) > > > > cleanEx(); ..nameEx <- "Stable" > > ### * Stable > > flush(stderr()); flush(stdout()) > > ### Name: Stable > ### Title: Times of a 2-year old stallion on a one mile run > ### Aliases: Stable > ### Keywords: datasets > > ### ** Examples > > str(Stable) `data.frame': 9 obs. of 1 variable: $ time: num 104.6 98.8 101.4 98.2 99.7 ... > attach(Stable) > EDA(time) [1] "time" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 9.000 0.000 98.200 98.750 101.000 101.400 101.000 103.050 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 104.600 2.292 5.255 0.764 4.300 6.400 -1.654 0.192 SW p-val 0.505 > sign.test(time,md=98.5,alternative="greater") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: time s = 8, p-value = 0.01953 alternative hypothesis: true median is greater than 98.5 95 percent confidence interval: 98.74333 Inf sample estimates: median of x 101.4 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9102 98.8000 Inf Interpolated CI 0.9500 98.7433 Inf Upper Achieved CI 0.9805 98.7000 Inf > detach(Stable) > > > > cleanEx(); ..nameEx <- "Stamp" > > ### * Stamp > > flush(stderr()); flush(stdout()) > > ### Name: Stamp > ### Title: Thicknesses of 1872 Hidalgo stamps issued in Mexico > ### Aliases: Stamp > ### Keywords: datasets > > ### ** Examples > > str(Stamp) `data.frame': 485 obs. of 3 variables: $ thickness: num 0.060 0.064 0.064 0.065 0.066 ... $ thick : num 0.060 0.061 0.062 0.063 0.064 ... $ freq : int 1 0 0 0 2 1 1 0 1 7 ... > attach(Stamp) > hist(thickness,prob=TRUE,col="lightblue") > lines(density(thickness),lwd=2,col="blue") > t.test(thickness,conf.level=.99)$conf [1] 0.08426759 0.08778189 attr(,"conf.level") [1] 0.99 > detach(Stamp) > > > > cleanEx(); ..nameEx <- "Statclas" > > ### * Statclas > > flush(stderr()); flush(stdout()) > > ### Name: Statclas > ### Title: Grades for two introductory statistics classes > ### Aliases: Statclas > ### Keywords: datasets > > ### ** Examples > > str(Statclas) `data.frame': 36 obs. of 2 variables: $ X9am: int 60 66 66 66 67 67 68 72 74 77 ... $ X2pm: int 60 71 74 76 76 76 76 76 79 79 ... > attach(Statclas) > t.test(X9am,X2pm) Welch Two Sample t-test data: X9am and X2pm t = -0.7318, df = 64.571, p-value = 0.4669 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -5.593904 2.593904 sample estimates: mean of x mean of y 81.0 82.5 > detach(Statclas) > > > > cleanEx(); ..nameEx <- "Statelaw" > > ### * Statelaw > > flush(stderr()); flush(stdout()) > > ### Name: Statelaw > ### Title: Operating expenditures per resident for each of the state law > ### enforcement agencies > ### Aliases: Statelaw > ### Keywords: datasets > > ### ** Examples > > str(Statelaw) `data.frame': 50 obs. of 2 variables: $ State: Factor w/ 50 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ cost : int 5 4 8 3 59 4 9 3 11 8 ... > attach(Statelaw) > summary(cost) Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 1.000 3.000 5.500 8.957 11.000 59.000 4.000 > EDA(cost) [1] "cost" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 46.000 4.000 1.000 3.000 8.957 5.500 7.571 11.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 59.000 10.696 114.398 1.577 8.000 58.000 8.676 2.705 SW p-val 0.000 > sign.test(cost,md=8,alternative="less") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: cost s = 15, p-value = 0.05864 alternative hypothesis: true median is less than 8 95 percent confidence interval: -Inf 8 sample estimates: median of x 5.5 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9481 -Inf 8 Interpolated CI 0.9500 -Inf 8 Upper Achieved CI 0.9730 -Inf 8 > detach(Statelaw) > > > > cleanEx(); ..nameEx <- "Statisti" > > ### * Statisti > > flush(stderr()); flush(stdout()) > > ### Name: Statisti > ### Title: Test scores for two beginning statistics classes > ### Aliases: Statisti > ### Keywords: datasets > > ### ** Examples > > str(Statisti) `data.frame': 31 obs. of 2 variables: $ Class1: int 81 73 86 90 75 80 75 81 85 87 ... $ Class2: int 87 77 66 75 78 82 82 71 79 73 ... > attach(Statisti) > boxplot(Class1,Class2,names=c("Class 1","Class 2"),col=c("red","blue"), + main="Problem 1.87") > detach(Statisti) > > > > cleanEx(); ..nameEx <- "Step" > > ### * Step > > flush(stderr()); flush(stdout()) > > ### Name: Step > ### Title: STEP science test scores for a class of ability-grouped students > ### Aliases: Step > ### Keywords: datasets > > ### ** Examples > > str(Step) `data.frame': 12 obs. of 1 variable: $ score: int 58 60 82 80 67 70 65 73 75 77 ... > attach(Step) > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 12.000 0.000 58.000 65.500 71.417 71.500 71.417 79.250 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 82.000 8.140 66.265 2.350 13.750 24.000 -1.420 -0.165 SW p-val 0.621 > t.test(score,mu=80,alternative="less") One Sample t-test data: score t = -3.6526, df = 11, p-value = 0.001902 alternative hypothesis: true mean is less than 80 95 percent confidence interval: -Inf 75.63684 sample estimates: mean of x 71.41667 > detach(Step) > > > > cleanEx(); ..nameEx <- "Stress" > > ### * Stress > > flush(stderr()); flush(stdout()) > > ### Name: Stress > ### Title: Short-term memory test scores on 12 subjects before and after a > ### stressful situation > ### Aliases: Stress > ### Keywords: datasets > > ### ** Examples > > str(Stress) `data.frame': 12 obs. of 2 variables: $ Prestre : int 13 15 9 13 15 17 13 16 11 13 ... $ Poststre: int 10 14 7 15 11 14 13 14 9 14 ... > attach(Stress) > DIF <- Poststre -Prestre > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9467, p-value = 0.5888 > t.test(Poststre,Prestre,paired=TRUE,alternative="less") Paired t-test data: Poststre and Prestre t = -2.6018, df = 11, p-value = 0.01231 alternative hypothesis: true difference in means is less than 0 95 percent confidence interval: -Inf -0.4129949 sample estimates: mean of the differences -1.333333 > detach(Stress) > remove(DIF) > > > > cleanEx(); ..nameEx <- "Study" > > ### * Study > > flush(stderr()); flush(stdout()) > > ### Name: Study > ### Title: Number of hours studied per week by a sample of 50 freshmen > ### Aliases: Study > ### Keywords: datasets > > ### ** Examples > > str(Study) `data.frame': 50 obs. of 1 variable: $ hours: int 30 34 32 40 33 25 15 29 37 30 ... > attach(Study) > stem(hours) The decimal point is 1 digit(s) to the right of the | 0 | 5 1 | 05 2 | 0005558889 3 | 00000223445555556778899 4 | 00001123455 5 | 0 6 | 05 > EDA(hours) [1] "hours" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 50.000 0.000 5.000 28.750 34.060 35.000 33.978 40.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 65.000 10.655 113.527 1.507 11.250 60.000 1.373 0.013 SW p-val 0.068 > detach(Study) > > > > cleanEx(); ..nameEx <- "Submarin" > > ### * Submarin > > flush(stderr()); flush(stdout()) > > ### Name: Submarin > ### Title: Number of German submarines sunk by U.S. Navy in World War II > ### Aliases: Submarin > ### Keywords: datasets > > ### ** Examples > > str(Submarin) `data.frame': 16 obs. of 3 variables: $ Month : int 1 2 3 4 5 6 7 8 9 10 ... $ reported: int 3 2 4 2 5 5 9 12 8 13 ... $ actual : int 3 2 6 3 4 3 11 9 10 16 ... > attach(Submarin) > plot(reported,actual) > model <- lm(actual~reported) > abline(model) > anova(model) Analysis of Variance Table Response: actual Df Sum Sq Mean Sq F value Pr(>F) reported 1 368.58 368.58 58.36 2.333e-06 *** Residuals 14 88.42 6.32 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > summary(model) Call: lm(formula = actual ~ reported) Residuals: Min 1Q Median 3Q Max -4.2306 -2.0454 0.5228 1.0910 4.7304 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.7628 1.2198 0.625 0.542 reported 1.0390 0.1360 7.639 2.33e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.513 on 14 degrees of freedom Multiple R-Squared: 0.8065, Adjusted R-squared: 0.7927 F-statistic: 58.36 on 1 and 14 DF, p-value: 2.333e-06 > detach(Submarin) > > > > cleanEx(); ..nameEx <- "Subway" > > ### * Subway > > flush(stderr()); flush(stdout()) > > ### Name: Subway > ### Title: Time it takes a subway to travel from the airport to downtown > ### Aliases: Subway > ### Keywords: datasets > > ### ** Examples > > str(Subway) `data.frame': 30 obs. of 1 variable: $ time: num 34.4 41.6 39.9 40.1 40.4 39.7 37.6 39.2 40.1 38.8 ... > attach(Subway) > EDA(time) [1] "time" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 30.000 0.000 34.400 39.125 39.743 39.950 39.836 40.400 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 42.500 1.580 2.498 0.288 1.275 8.100 2.412 -1.039 SW p-val 0.019 > detach(Subway) > > > > cleanEx(); ..nameEx <- "Sunspot" > > ### * Sunspot > > flush(stderr()); flush(stdout()) > > ### Name: Sunspot > ### Title: Wolfer sunspot numbers from 1700 through 2000 > ### Aliases: Sunspot > ### Keywords: datasets > > ### ** Examples > > str(Sunspot) `data.frame': 301 obs. of 2 variables: $ year : int 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 ... $ sunspots: num 5 11 16 23 36 58 29 20 10 8 ... > attach(Sunspot) > plot(year,sunspots,type="l",main="Yearly Sunspots") # Using standard plot > library(lattice) > xyplot(sunspots ~ 1700:2000, xlab = "", type = "l",main="Yearly Sunspots") > xyplot(sunspots ~ 1700:2000, xlab = "", type = "l", aspect="xy", + main="Yearly Sunspots") > detach(Sunspot) > > > > cleanEx(); ..nameEx <- "Superbowl" > > ### * Superbowl > > flush(stderr()); flush(stdout()) > > ### Name: Superbowl > ### Title: Margin of victory in Superbowls I to XXXV > ### Aliases: Superbowl > ### Keywords: datasets > > ### ** Examples > > str(Superbowl) `data.frame': 35 obs. of 5 variables: $ Winning.team: Factor w/ 16 levels "Baltimore Colts",..: 6 6 11 7 1 4 9 9 13 13 ... $ winner.score: int 35 33 16 23 16 24 14 24 16 21 ... $ Losing.team : Factor w/ 19 levels "Atlanta Falcons",..: 8 14 2 11 5 10 19 11 11 5 ... $ loser.score : int 10 14 7 7 13 3 7 7 6 17 ... $ margin : int 25 19 9 16 3 21 7 17 10 4 ... > attach(Superbowl) > stem(margin) The decimal point is 1 digit(s) to the right of the | 0 | 13444 0 | 57779 1 | 000234 1 | 567777899 2 | 123 2 | 579 3 | 2 3 | 56 4 | 4 | 5 > detach(Superbowl) > > > > cleanEx(); ..nameEx <- "Supercar" > > ### * Supercar > > flush(stderr()); flush(stdout()) > > ### Name: Supercar > ### Title: Top speeds attained by five makes of supercars > ### Aliases: Supercar > ### Keywords: datasets > > ### ** Examples > > str(Supercar) `data.frame': 30 obs. of 7 variables: $ Acura : num 160 162 164 166 158 ... $ Ferrari: num 180 174 180 184 177 ... $ Lotus : num 167 163 160 165 160 ... $ Porsche: num 174 182 171 176 179 ... $ Viper : num 172 169 170 175 161 ... $ speed : num 160 162 164 166 158 ... $ car : int 1 1 1 1 1 1 2 2 2 2 ... > attach(Supercar) > boxplot(speed~car) > anova(lm(speed~as.factor(car))) Analysis of Variance Table Response: speed Df Sum Sq Mean Sq F value Pr(>F) as.factor(car) 4 1456.52 364.13 25.145 1.903e-08 *** Residuals 25 362.02 14.48 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Supercar) > > > > cleanEx(); ..nameEx <- "Tablrock" > > ### * Tablrock > > flush(stderr()); flush(stdout()) > > ### Name: Tablrock > ### Title: Ozone concentrations at Mt. Mitchell, North Carolina > ### Aliases: Tablrock > ### Keywords: datasets > > ### ** Examples > > str(Tablrock) `data.frame': 719 obs. of 16 variables: $ hour: Factor w/ 24 levels "00:00","01:00",..: 2 3 4 5 6 7 8 9 10 11 ... $ X03 : int 22 21 17 13 12 17 14 20 30 41 ... $ tmp : num 23.1 23.2 23.4 23.6 23.7 23.9 22.7 21.7 22.6 23.7 ... $ vdc : num 1.47 1.47 1.47 1.47 1.47 1.47 1.47 1.47 1.47 1.47 ... $ wd : int 203 22 90 50 39 0 236 178 89 76 ... $ ws : num 0.2 0.4 0.1 1.3 2.5 0 0.2 0.8 1.4 1.6 ... $ amb : num 17.9 17.4 17 16.2 15.6 16.1 17.4 20.5 22.7 24.5 ... $ dew : num 15.8 15.4 14.9 14.4 14.3 14.1 16 19.4 23.2 21.9 ... $ so2 : num 0 0 -0.1 -0.1 -0.1 -0.1 -0.1 0 0.2 0.4 ... $ no : num 0 0 0.1 0 0.1 0.1 0.8 0.4 0.4 0.2 ... $ no2 : num 0.4 0.2 0.1 -0.1 -0.1 0 0.9 0.6 1.3 0.8 ... $ nox : num 0.4 0.2 0.2 -0.1 0 0.1 1.7 0.9 1.7 0.9 ... $ co : num 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 ... $ co2 : num 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 ... $ gas : num -1.5 -1.5 -1.5 -1.5 -1.5 -1.5 -1.5 -1.4 -1.4 -1.5 ... $ air : num -0.06 -0.06 -0.06 -0.06 -0.06 -0.06 -0.06 -0.06 -0.06 -0.06 ... > attach(Tablrock) > EDA(X03) [1] "X03" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 629.000 90.000 0.000 11.000 23.693 20.000 22.183 33.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 254.000 19.276 371.554 0.769 22.000 254.000 40.229 4.357 SW p-val 0.000 > t.test(X03,conf.level=.99)$conf [1] 21.70741 25.67891 attr(,"conf.level") [1] 0.99 > detach(Tablrock) > > > > cleanEx(); ..nameEx <- "Teacher" > > ### * Teacher > > flush(stderr()); flush(stdout()) > > ### Name: Teacher > ### Title: Average teacher's salaries across the states in the 70s 80s and > ### 90s > ### Aliases: Teacher > ### Keywords: datasets > > ### ** Examples > > str(Teacher) `data.frame': 51 obs. of 4 variables: $ State : Factor w/ 51 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ X1973.74: int 9226 15667 10414 7820 13113 10131 11030 11304 NA 10018 ... $ X1983.84: int 18000 36564 21605 16929 26403 22895 22624 20925 27659 19545 ... $ X1993.94: int 27000 44700 31200 26600 40200 33100 47000 34500 41300 31100 ... > attach(Teacher) > boxplot(X1973.74,X1983.84,X1993.94, + names=c("1973-1974","1983-1984","1993-1994"),ylab="Average Salary") > detach(Teacher) > > > > cleanEx(); ..nameEx <- "Tenness" > > ### * Tenness > > flush(stderr()); flush(stdout()) > > ### Name: Tenness > ### Title: Tennessee self concept scores for 20 gifted high school students > ### Aliases: Tenness > ### Keywords: datasets > > ### ** Examples > > str(Tenness) `data.frame': 20 obs. of 1 variable: $ score: num 29.8 29.4 27.5 29.8 31 29.2 29.5 29 27 35.8 ... > attach(Tenness) > EDA(score) [1] "score" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 20.000 0.000 24.200 28.275 29.510 29.300 29.456 30.700 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 35.800 2.669 7.121 0.597 2.425 11.600 0.234 0.370 SW p-val 0.371 > t.test(score,mu=30,alternative="less") One Sample t-test data: score t = -0.8212, df = 19, p-value = 0.2109 alternative hypothesis: true mean is less than 30 95 percent confidence interval: -Inf 30.54177 sample estimates: mean of x 29.51 > sign.test(score,md=30,alternative="less") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: score s = 5, p-value = 0.02069 alternative hypothesis: true median is less than 30 95 percent confidence interval: -Inf 29.8 sample estimates: median of x 29.3 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9423 -Inf 29.8 Interpolated CI 0.9500 -Inf 29.8 Upper Achieved CI 0.9793 -Inf 29.8 > detach(Tenness) > > > > cleanEx(); ..nameEx <- "Tensile" > > ### * Tensile > > flush(stderr()); flush(stdout()) > > ### Name: Tensile > ### Title: Tensile strength of plastic bags from two production runs > ### Aliases: Tensile > ### Keywords: datasets > > ### ** Examples > > str(Tensile) `data.frame': 72 obs. of 4 variables: $ Run.1 : num 98.4 109.6 110.1 107.6 74.6 ... $ Run.2 : num 168 115 124 94 128 ... $ Tensile: num 98.4 109.6 110.1 107.6 74.6 ... $ Run : int 1 1 1 1 1 1 1 1 1 1 ... > attach(Tensile) > boxplot(Run.1,Run.2,names=c("Run 1","Run 2"),col=c("red","Blue")) > boxplot(Tensile~Run,names=c("Run 1","Run 2"),col=c("red","Blue")) > t.test(Tensile~Run) Welch Two Sample t-test data: Tensile by Run t = -3.4505, df = 64.136, p-value = 0.0009946 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -25.029593 -6.674665 sample estimates: mean in group 1 mean in group 2 102.3346 118.1868 > t.test(Run.1,Run.2) Welch Two Sample t-test data: Run.1 and Run.2 t = -3.4505, df = 64.136, p-value = 0.0009946 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -25.029593 -6.674665 sample estimates: mean of x mean of y 102.3346 118.1868 > detach(Tensile) > > > > cleanEx(); ..nameEx <- "Test1" > > ### * Test1 > > flush(stderr()); flush(stdout()) > > ### Name: Test1 > ### Title: Grades on the first test in a statistics class > ### Aliases: Test1 > ### Keywords: datasets > > ### ** Examples > > str(Test1) `data.frame': 25 obs. of 1 variable: $ test1: int 61 38 64 70 81 11 61 92 77 47 ... > attach(Test1) > EDA(test1) [1] "test1" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 25.000 0.000 11.000 59.500 68.440 76.000 69.652 82.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 98.000 23.475 551.090 4.695 22.500 87.000 0.185 -0.934 SW p-val 0.024 > detach(Test1) > > > > cleanEx(); ..nameEx <- "Thermal" > > ### * Thermal > > flush(stderr()); flush(stdout()) > > ### Name: Thermal > ### Title: Heat loss of thermal pane windows versus outside temperature > ### Aliases: Thermal > ### Keywords: datasets > > ### ** Examples > > str(Thermal) `data.frame': 12 obs. of 3 variables: $ temp: int -10 -10 -10 0 0 0 10 10 10 20 ... $ loss: int 58 62 54 39 41 36 22 26 20 10 ... $ x : int -10 0 10 20 30 40 NA NA NA NA ... > attach(Thermal) > model <- lm(loss~temp) > summary(model) Call: lm(formula = loss ~ temp) Residuals: Min 1Q Median 3Q Max -5.40 -2.20 0.10 2.35 6.20 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 40.60000 1.19331 34.02 1.14e-11 *** temp -1.52000 0.09743 -15.60 2.40e-08 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.774 on 10 degrees of freedom Multiple R-Squared: 0.9605, Adjusted R-squared: 0.9566 F-statistic: 243.4 on 1 and 10 DF, p-value: 2.397e-08 > detach(Thermal) > > > > cleanEx(); ..nameEx <- "Tiaa" > > ### * Tiaa > > flush(stderr()); flush(stdout()) > > ### Name: Tiaa > ### Title: 1999-2000 closing prices for TIAA-CREF stocks > ### Aliases: Tiaa > ### Keywords: datasets > > ### ** Examples > > str(Tiaa) `data.frame': 365 obs. of 4 variables: $ crefstk: num 179 179 179 176 178 ... $ crefgwt: num 79.7 79.7 79.7 77.4 78.6 ... $ tiaa : num 71.9 71.9 71.9 70.3 71.2 ... $ date : Factor w/ 365 levels "1/01/2000","1/02/2000",..: 198 199 200 201 202 203 204 205 206 207 ... > attach(Tiaa) > boxplot(crefstk,crefgwt) > detach(Tiaa) > > > > cleanEx(); ..nameEx <- "Ticket" > > ### * Ticket > > flush(stderr()); flush(stdout()) > > ### Name: Ticket > ### Title: Time to complete an airline ticket reservation > ### Aliases: Ticket > ### Keywords: datasets > > ### ** Examples > > str(Ticket) `data.frame': 20 obs. of 1 variable: $ time: int 40 45 29 58 48 39 30 50 33 42 ... > attach(Ticket) > EDA(time) [1] "time" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 20.000 0.000 27.000 32.250 42.350 41.000 42.056 50.750 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 63.000 10.693 114.345 2.391 18.500 36.000 -1.205 0.269 SW p-val 0.376 > detach(Ticket) > > > > cleanEx(); ..nameEx <- "Toaster" > > ### * Toaster > > flush(stderr()); flush(stdout()) > > ### Name: Toaster > ### Title: Consumer Reports (Oct 94) rating of toaster ovens versus the > ### cost > ### Aliases: Toaster > ### Keywords: datasets > > ### ** Examples > > str(Toaster) `data.frame': 17 obs. of 3 variables: $ toaster: Factor w/ 17 levels "Black&D SO2500G",..: 2 16 7 13 1 17 9 14 12 10 ... $ score : int 85 77 75 75 75 72 70 70 70 68 ... $ cost : int 85 50 130 48 92 60 56 70 41 70 ... > attach(Toaster) > plot(score,cost) > model <- lm(cost~score) > abline(model) > summary(model) Call: lm(formula = cost ~ score) Residuals: Min 1Q Median 3Q Max -33.058 -9.638 -4.441 8.605 60.989 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -45.2373 51.5966 -0.877 0.394 score 1.5233 0.7387 2.062 0.057 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 22.14 on 15 degrees of freedom Multiple R-Squared: 0.2209, Adjusted R-squared: 0.1689 F-statistic: 4.253 on 1 and 15 DF, p-value: 0.05695 > rm(model) > detach(Toaster) > > > > cleanEx(); ..nameEx <- "Tonsils" > > ### * Tonsils > > flush(stderr()); flush(stdout()) > > ### Name: Tonsils > ### Title: Size of tonsils collected from 1,398 children > ### Aliases: Tonsils > ### Keywords: datasets > > ### ** Examples > > str(Tonsils) `data.frame': 3 obs. of 3 variables: $ Size : Factor w/ 3 levels "Large","Normal",..: 2 1 3 $ Carrier : int 19 29 24 $ Non.carrier: int 497 560 269 > attach(Tonsils) > TON <- as.matrix(Tonsils[,2:3]) > rownames(TON) <- Size > TON Carrier Non.carrier Normal 19 497 Large 29 560 Very Large 24 269 > barplot(t(TON),beside=TRUE,legend=TRUE) > remove(TON) > detach(Tonsils) > > > > cleanEx(); ..nameEx <- "Tort" > > ### * Tort > > flush(stderr()); flush(stdout()) > > ### Name: Tort > ### Title: The number of torts, average number of months to process a tort, > ### and county population from the court files of the nation's largest > ### counties > ### Aliases: Tort > ### Keywords: datasets > > ### ** Examples > > str(Tort) `data.frame': 45 obs. of 5 variables: $ county : Factor w/ 45 levels "alameda, ca",..: 25 37 1 5 16 24 33 38 39 40 ... $ months : int 11 17 22 15 42 12 21 30 21 20 ... $ populat: int 2209567 690202 1307572 840585 705613 3485398 2484789 1534343 728921 1528527 ... $ torts : int 9914 3346 3258 2469 2364 21954 18297 7583 3467 5148 ... $ rate : int 449 485 249 294 335 630 736 494 476 337 ... > attach(Tort) > EDA(months) [1] "months" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 45.000 0.000 10.000 13.500 18.933 19.000 18.415 22.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 42.000 6.489 42.109 0.967 8.500 32.000 1.919 1.210 SW p-val 0.001 > detach(Tort) > > > > cleanEx(); ..nameEx <- "Toxic" > > ### * Toxic > > flush(stderr()); flush(stdout()) > > ### Name: Toxic > ### Title: Hazardous waste sites near minority communities > ### Aliases: Toxic > ### Keywords: datasets > > ### ** Examples > > str(Toxic) `data.frame': 51 obs. of 5 variables: $ state : Factor w/ 51 levels "alabama","alaska",..: 1 2 3 4 5 6 7 8 9 10 ... $ region : Factor w/ 4 levels "midwest","northeast",..: 3 4 4 3 4 4 2 2 2 3 ... $ sites : int 12 0 8 5 54 9 6 0 1 13 ... $ minority: int 10 0 8 4 53 5 4 0 1 12 ... $ percent : num 26.8 0 28.8 17.7 42.9 19.8 16.4 0 71.4 27.3 ... > attach(Toxic) > hist(minority,prob=TRUE) > lines(density(minority)) > sign.test(sites,conf.level=.98) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: sites s = 45, p-value = 5.795e-14 alternative hypothesis: true median is not equal to 0 98 percent confidence interval: 3.00000 12.31198 sample estimates: median of x 8 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9759 3 12.000 Interpolated CI 0.9800 3 12.312 Upper Achieved CI 0.9890 3 13.000 > boxplot(sites~region) > kruskal.test(sites~as.factor(region)) Kruskal-Wallis rank sum test data: sites by as.factor(region) Kruskal-Wallis chi-squared = 4.8048, df = 3, p-value = 0.1867 > detach(Toxic) > > > > cleanEx(); ..nameEx <- "Track" > > ### * Track > > flush(stderr()); flush(stdout()) > > ### Name: Track > ### Title: National Olympic records for women in several races > ### Aliases: Track > ### Keywords: datasets > > ### ** Examples > > str(Track) `data.frame': 55 obs. of 8 variables: $ country : Factor w/ 55 levels "argentina","australia",..: 1 2 3 4 5 6 7 8 9 10 ... $ X100m : num 11.6 11.2 11.4 11.4 11.5 ... $ X200m : num 22.9 22.4 23.1 23.0 23.1 ... $ X400m : num 54.5 51.1 50.6 52.0 53.3 ... $ X800m : num 2.15 1.98 1.99 2.00 2.16 ... $ X1500m : num 4.43 4.13 4.22 4.14 4.58 ... $ X3000m : num 9.79 9.08 9.34 8.88 9.81 ... $ marathon: num 179 152 159 158 170 ... > attach(Track) > cor(Track[,2:8]) X100m X200m X400m X800m X1500m X3000m marathon X100m 1.0000000 0.9527911 0.8346918 0.7276888 0.7283709 0.7138310 0.6863358 X200m 0.9527911 1.0000000 0.8569621 0.7240597 0.6983643 0.6844756 0.6855745 X400m 0.8346918 0.8569621 1.0000000 0.8984052 0.7878417 0.7525889 0.7054241 X800m 0.7276888 0.7240597 0.8984052 1.0000000 0.9016138 0.8511240 0.7792922 X1500m 0.7283709 0.6983643 0.7878417 0.9016138 1.0000000 0.9550566 0.8779334 X3000m 0.7138310 0.6844756 0.7525889 0.8511240 0.9550566 1.0000000 0.8858136 marathon 0.6863358 0.6855745 0.7054241 0.7792922 0.8779334 0.8858136 1.0000000 > pairs(Track[,2:8]) > detach(Track) > > > > cleanEx(); ..nameEx <- "Track15" > > ### * Track15 > > flush(stderr()); flush(stdout()) > > ### Name: Track15 > ### Title: Olympic winning times for the men's 1500-meter run > ### Aliases: Track15 > ### Keywords: datasets > > ### ** Examples > > str(Track15) `data.frame': 26 obs. of 2 variables: $ Year : int 1896 1900 1904 1908 1912 1916 1920 1924 1928 1932 ... $ X1500m: num 273 246 245 243 237 ... > attach(Track15) > plot(Year,X1500m,type="l",lwd=2,lty=2,col="red",xlab="Year", + ylab="1500m Time (seconds)",main="Problem 1.36") > detach(Track15) > > > > cleanEx(); ..nameEx <- "Treatments" > > ### * Treatments > > flush(stderr()); flush(stdout()) > > ### Name: Treatments > ### Title: Illustrates analysis of variance for three treatment groups > ### Aliases: Treatments > ### Keywords: datasets > > ### ** Examples > > str(Treatments) `data.frame': 24 obs. of 5 variables: $ treat1 : int 21 24 31 42 38 31 36 34 NA NA ... $ treat2 : int 41 44 38 37 42 48 39 32 NA NA ... $ treat3 : int 35 37 33 46 42 38 37 30 NA NA ... $ Treatmnt: int 21 24 31 42 38 31 36 34 41 44 ... $ Group : int 1 1 1 1 1 1 1 1 2 2 ... > attach(Treatments) > anova(lm(Treatmnt~as.factor(Group))) Analysis of Variance Table Response: Treatmnt Df Sum Sq Mean Sq F value Pr(>F) as.factor(Group) 2 262.75 131.37 4.0497 0.03255 * Residuals 21 681.25 32.44 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > detach(Treatments) > > > > cleanEx(); ..nameEx <- "Trees" > > ### * Trees > > flush(stderr()); flush(stdout()) > > ### Name: Trees > ### Title: Number of trees in 20 grids > ### Aliases: Trees > ### Keywords: datasets > > ### ** Examples > > str(Trees) `data.frame': 20 obs. of 1 variable: $ number: int 81 96 87 83 99 64 77 63 93 84 ... > attach(Trees) > stem(number) The decimal point is 1 digit(s) to the right of the | 6 | 348 7 | 047 8 | 1134467 9 | 23469 10 | 29 > hist(number,breaks=seq(60,110,10),right=FALSE,col="green",main="Problem 1.50") > detach(Trees) > > > > cleanEx(); ..nameEx <- "Trucks" > > ### * Trucks > > flush(stderr()); flush(stdout()) > > ### Name: Trucks > ### Title: Miles per gallon for standard 4-wheel drive trucks manufactured > ### by Chevrolet, Dodge and Ford > ### Aliases: Trucks > ### Keywords: datasets > > ### ** Examples > > str(Trucks) `data.frame': 15 obs. of 5 variables: $ chevy : num 15.2 15.4 14.8 14.4 14.7 NA NA NA NA NA ... $ dodge : num 14.8 14.4 14.3 14.1 14.4 NA NA NA NA NA ... $ ford : num 15.1 14.3 14.6 13.9 14.6 NA NA NA NA NA ... $ gas.mileage: num 15.2 15.4 14.8 14.4 14.7 14.8 14.4 14.3 14.1 14.4 ... $ truck : Factor w/ 3 levels "chevy","dodge",..: 1 1 1 1 1 2 2 2 2 2 ... > attach(Trucks) > anova(lm(gas.mileage~truck)) Analysis of Variance Table Response: gas.mileage Df Sum Sq Mean Sq F value Pr(>F) truck 2 0.70 0.35 2.5 0.1237 Residuals 12 1.68 0.14 > detach(Trucks) > > > > cleanEx(); ..nameEx <- "Tv" > > ### * Tv > > flush(stderr()); flush(stdout()) > > ### Name: Tv > ### Title: Percent of students that watch more than 6 hours of TV per day > ### versus national math test scores > ### Aliases: Tv > ### Keywords: datasets > > ### ** Examples > > str(Tv) `data.frame': 53 obs. of 3 variables: $ State : Factor w/ 53 levels "Alabama","Alaska",..: 1 2 3 4 5 6 7 9 10 11 ... $ percent: int 18 NA 12 20 11 9 12 18 19 17 ... $ test : int 253 NA 258 256 256 267 270 262 255 258 ... > attach(Tv) > plot(percent,test,col="blue") > cor(percent,test,use="complete.obs") [1] -0.8619163 > detach(Tv) > > > > cleanEx(); ..nameEx <- "Twin" > > ### * Twin > > flush(stderr()); flush(stdout()) > > ### Name: Twin > ### Title: Intelligence test scores for identical twins in which one twin > ### is given a drug > ### Aliases: Twin > ### Keywords: datasets > > ### ** Examples > > str(Twin) `data.frame': 9 obs. of 3 variables: $ TwinA : int 83 74 67 64 70 67 81 64 72 $ TwinB : int 78 74 63 66 68 63 77 65 70 $ differ: int 5 0 4 -2 2 4 4 -1 2 > attach(Twin) > qqnorm(differ) > qqline(differ) > shapiro.test(differ) Shapiro-Wilk normality test data: differ W = 0.9045, p-value = 0.2792 > t.test(TwinA,TwinB,paired=TRUE) Paired t-test data: TwinA and TwinB t = 2.4, df = 8, p-value = 0.04318 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.07832989 3.92167011 sample estimates: mean of the differences 2 > detach(Twin) > > > > cleanEx(); ..nameEx <- "Undergrad" > > ### * Undergrad > > flush(stderr()); flush(stdout()) > > ### Name: Undergrad > ### Title: Data set describing a sample of undergraduate students > ### Aliases: Undergrad > ### Keywords: datasets > > ### ** Examples > > str(Undergrad) `data.frame': 100 obs. of 6 variables: $ Gender: Factor w/ 2 levels "Female","Male": 1 1 2 1 1 2 2 1 1 2 ... $ Major : Factor w/ 11 levels "Accounting","Biology",..: 9 2 10 10 8 4 9 6 5 4 ... $ Class : Factor w/ 4 levels "Freshman","Junior",..: 4 4 3 4 3 1 4 2 1 4 ... $ GPA : num 3.1 1.9 3.2 2.6 2.8 2.1 3.4 2.7 2.8 3.3 ... $ SAT : int 1230 870 1180 1190 770 850 1440 920 990 1060 ... $ Drops : int 0 1 4 2 4 0 0 2 0 3 ... > attach(Undergrad) > stripchart(GPA~Class,method="stack",col=c("blue","red","green","lightblue"), + pch=19,main="GPA versus Class") > stripchart(GPA~Gender,method="stack",col=c("red","blue"),pch=19, + main="GPA versus Gender") > stripchart(SAT~Drops,method="stack",col=c("blue","red","green","lightblue"), + pch=19,main="SAT versus Drops") > stripchart(Drops~Gender,method="stack",col=c("red","blue"),pch=19, + main="Drops versus Gender") > detach(Undergrad) > > > > cleanEx(); ..nameEx <- "Vacation" > > ### * Vacation > > flush(stderr()); flush(stdout()) > > ### Name: Vacation > ### Title: Number of days of paid holidays and vacation leave for sample of > ### 35 textile workers > ### Aliases: Vacation > ### Keywords: datasets > > ### ** Examples > > str(Vacation) `data.frame': 35 obs. of 1 variable: $ number: int 23 12 10 34 25 16 27 18 28 13 ... > attach(Vacation) > EDA(number) [1] "number" Size (n) Missing Minimum 1st Qu Mean Median TrMean 3rd Qu 35.000 0.000 6.000 13.000 20.514 19.000 20.303 26.000 Max. Stdev. Var. SE Mean I.Q.R. Range Kurtosis Skewness 42.000 9.131 83.375 1.543 13.000 36.000 -0.454 0.625 SW p-val 0.137 > t.test(number,mu=24) One Sample t-test data: number t = -2.2584, df = 34, p-value = 0.03045 alternative hypothesis: true mean is not equal to 24 95 percent confidence interval: 17.37768 23.65089 sample estimates: mean of x 20.51429 > detach(Vacation) > > > > cleanEx(); ..nameEx <- "Vaccine" > > ### * Vaccine > > flush(stderr()); flush(stdout()) > > ### Name: Vaccine > ### Title: Reported serious reactions due to vaccines in 11 southern states > ### Aliases: Vaccine > ### Keywords: datasets > > ### ** Examples > > str(Vaccine) `data.frame': 11 obs. of 2 variables: $ State : Factor w/ 11 levels "Alabama","Arkansas",..: 1 2 3 4 5 6 7 8 9 10 ... $ number: num 3.9 27.8 5.0 73.5 24.8 ... > attach(Vaccine) > fn <- fivenum(number) > fn [1] 3.9 10.2 24.8 45.1 138.8 > iqr <- IQR(number) > ll <- fn[2]-1.5*iqr > ul <- fn[4]+1.5*iqr > limits <- c(ll,ul) > limits [1] -42.15 97.45 > boxplot(number) > detach(Vaccine) > > > > cleanEx(); ..nameEx <- "Vehicle" > > ### * Vehicle > > flush(stderr()); flush(stdout()) > > ### Name: Vehicle > ### Title: Fatality ratings for foreign and domestic vehicles > ### Aliases: Vehicle > ### Keywords: datasets > > ### ** Examples > > str(Vehicle) `data.frame': 2 obs. of 6 variables: $ make: Factor w/ 2 levels "domestic","foreign": 2 1 $ A : int 11 30 $ B : int 0 9 $ C : int 10 38 $ D : int 4 7 $ F : int 12 30 > attach(Vehicle) > Vehicle make A B C D F 1 foreign 11 0 10 4 12 2 domestic 30 9 38 7 30 > chisq.test(Vehicle[,2:6]) Warning in chisq.test(Vehicle[, 2:6]) : Chi-squared approximation may be incorrect Pearson's Chi-squared test data: Vehicle[, 2:6] X-squared = 4.6026, df = 4, p-value = 0.3306 > detach(Vehicle) > > > > cleanEx(); ..nameEx <- "Verbal" > > ### * Verbal > > flush(stderr()); flush(stdout()) > > ### Name: Verbal > ### Title: Verbal test scores and number of library books checked out for > ### 15 eighth graders > ### Aliases: Verbal > ### Keywords: datasets > > ### ** Examples > > str(Verbal) `data.frame': 15 obs. of 4 variables: $ number: int 12 15 3 7 10 5 22 9 13 7 ... $ verbal: int 77 85 48 59 75 41 94 72 80 70 ... $ SRES1 : num 0.474 0.606 -0.771 -0.485 0.909 ... $ FITS1 : num 73.9 81.1 52.5 62.0 69.2 ... > attach(Verbal) > model <- lm(verbal~number) > summary(model) Call: lm(formula = verbal ~ number) Residuals: Min 1Q Median 3Q Max -16.261 -3.886 3.059 4.751 7.974 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 45.3464 4.0217 11.276 4.39e-08 *** number 2.3828 0.2751 8.662 9.27e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.695 on 13 degrees of freedom Multiple R-Squared: 0.8523, Adjusted R-squared: 0.841 F-statistic: 75.03 on 1 and 13 DF, p-value: 9.265e-07 > detach(Verbal) > remove(model) > > > > cleanEx(); ..nameEx <- "Victoria" > > ### * Victoria > > flush(stderr()); flush(stdout()) > > ### Name: Victoria > ### Title: Number of sunspots versus mean annual level of Lake Victoria > ### Nyanza from 1902 to 1921 > ### Aliases: Victoria > ### Keywords: datasets > > ### ** Examples > > str(Victoria) `data.frame': 20 obs. of 3 variables: $ year : int 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 ... $ level : int -10 13 18 15 29 21 10 8 1 -7 ... $ sunspot: int 5 24 42 63 54 62 49 44 19 6 ... > attach(Victoria) > plot(sunspot,level) > model <- lm(level~sunspot) > abline(model) > cor(sunspot,level) [1] 0.8791223 > model Call: lm(formula = level ~ sunspot) Coefficients: (Intercept) sunspot -8.0418 0.4128 > detach(Victoria) > > > > cleanEx(); ..nameEx <- "Viscosit" > > ### * Viscosit > > flush(stderr()); flush(stdout()) > > ### Name: Viscosit > ### Title: Viscosity measurements of a substance on two different days > ### Aliases: Viscosit > ### Keywords: datasets > > ### ** Examples > > str(Viscosit) `data.frame': 11 obs. of 2 variables: $ first : num 35.4 38.3 34 36.2 37.2 32.8 36 35.2 36 31.3 ... $ second: num 37 38.6 35.1 37.1 36.2 36.8 37.6 34.8 35.8 38.2 ... > attach(Viscosit) > t.test(first,second) Welch Two Sample t-test data: first and second t = -1.2578, df = 19.906, p-value = 0.223 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -2.7072161 0.6708524 sample estimates: mean of x mean of y 35.28182 36.30000 > detach(Viscosit) > > > > cleanEx(); ..nameEx <- "Visual" > > ### * Visual > > flush(stderr()); flush(stdout()) > > ### Name: Visual > ### Title: Visual acuity of a group of subjects tested under a specified > ### dose of a drug > ### Aliases: Visual > ### Keywords: datasets > > ### ** Examples > > str(Visual) `data.frame': 18 obs. of 1 variable: $ visual: num 0.36 0.41 0.55 0.33 0.28 ... > attach(Visual) > stem(visual) The decimal point is 1 digit(s) to the left of the | 1 | 3479 2 | 3455578 3 | 34567 4 | 1 5 | 5 > fivenum(visual) [1] 0.13 0.23 0.26 0.35 0.55 > boxplot(visual) > detach(Visual) > > > > cleanEx(); ..nameEx <- "Vocab" > > ### * Vocab > > flush(stderr()); flush(stdout()) > > ### Name: Vocab > ### Title: Reading scores before and after vocabulary training for 14 > ### employees who did not complete high school > ### Aliases: Vocab > ### Keywords: datasets > > ### ** Examples > > str(Vocab) `data.frame': 14 obs. of 2 variables: $ First : int 84 55 43 64 72 65 72 52 49 80 ... $ Second: int 86 52 50 72 70 67 80 50 62 81 ... > attach(Vocab) > DIF <- Second - First > qqnorm(DIF) > qqline(DIF) > shapiro.test(DIF) Shapiro-Wilk normality test data: DIF W = 0.9049, p-value = 0.1327 > t.test(Second,First,paired=TRUE) Paired t-test data: Second and First t = 2.2958, df = 13, p-value = 0.03896 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.2275911 7.4866946 sample estimates: mean of the differences 3.857143 > detach(Vocab) > remove(DIF) > > > > cleanEx(); ..nameEx <- "Wastewat" > > ### * Wastewat > > flush(stderr()); flush(stdout()) > > ### Name: Wastewat > ### Title: Volume of injected waste water from Rocky Mountain Arsenal and > ### number of earthquakes near Denver > ### Aliases: Wastewat > ### Keywords: datasets > > ### ** Examples > > str(Wastewat) `data.frame': 44 obs. of 4 variables: $ gallons: num 4.2 7.2 8.4 8 5.2 6 5 5.6 4 3.6 ... $ number : int NA 2 12 35 23 29 24 8 6 20 ... $ ln.no. : num NA 0.693 2.485 3.555 3.135 ... $ index : int 1 2 3 4 5 6 7 8 9 10 ... > attach(Wastewat) > model <- lm(number~gallons) > summary(model) Call: lm(formula = number ~ gallons) Residuals: Min 1Q Median 3Q Max -28.8813 -8.9611 -0.3002 3.1761 59.1511 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.5895 3.4834 1.030 0.309 gallons 3.7905 0.7843 4.833 1.91e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 14.33 on 41 degrees of freedom Multiple R-Squared: 0.363, Adjusted R-squared: 0.3474 F-statistic: 23.36 on 1 and 41 DF, p-value: 1.915e-05 > detach(Wastewat) > remove(model) > > > > cleanEx(); ..nameEx <- "Weather94" > > ### * Weather94 > > flush(stderr()); flush(stdout()) > > ### Name: Weather94 > ### Title: Weather casualties in 1994 > ### Aliases: Weather94 > ### Keywords: datasets > > ### ** Examples > > str(Weather94) `data.frame': 11 obs. of 2 variables: $ Weather.Type: Factor w/ 11 levels "Extreme Temp",..: 2 8 6 10 5 1 11 9 4 3 ... $ Number : int 59 32 69 69 9 81 31 17 12 3 ... > attach(Weather94) > names(Number) <- Weather.Type > barplot(Number,col="lightblue",las=2,cex.names=.65,main="Problem 1.30") > # las=2 places bar names vertically > detach(Weather94) > > > > cleanEx(); ..nameEx <- "Wheat" > > ### * Wheat > > flush(stderr()); flush(stdout()) > > ### Name: Wheat > ### Title: Price of a bushel of wheat versus the national weekly earnings > ### of production workers > ### Aliases: Wheat > ### Keywords: datasets > > ### ** Examples > > str(Wheat) `data.frame': 19 obs. of 3 variables: $ year : int 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ... $ earnings: num 235 255 267 281 293 ... $ price : num 3.91 3.65 3.55 3.54 3.39 ... > attach(Wheat) > par(mfrow=c(1,2)) > plot(year,earnings) > plot(year,price) > par(mfrow=c(1,1)) > detach(Wheat) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Windmill" > > ### * Windmill > > flush(stderr()); flush(stdout()) > > ### Name: Windmill > ### Title: Direct current produced by different wind velocities > ### Aliases: Windmill > ### Keywords: datasets > > ### ** Examples > > str(Windmill) `data.frame': 25 obs. of 7 variables: $ velocity : num 2.45 2.7 2.9 3.05 3.4 3.6 3.95 4.1 4.6 5 ... $ output : num 0.123 0.500 0.653 0.558 1.057 ... $ SRES1 : num -2.716 -1.271 -0.795 -1.378 0.471 ... $ FITS1 : num 0.722 0.782 0.830 0.866 0.951 ... $ X1.velocity: num 0.408 0.370 0.345 0.328 0.294 ... $ SRES2 : num -0.313 1.052 0.750 -1.668 1.307 ... $ FITS2 : num 0.148 0.411 0.588 0.705 0.939 ... > attach(Windmill) > summary(lm(output~velocity)) Call: lm(formula = output ~ velocity) Residuals: Min 1Q Median 3Q Max -0.59869 -0.14099 0.06059 0.17262 0.32184 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.13088 0.12599 1.039 0.31 velocity 0.24115 0.01905 12.659 7.55e-12 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2361 on 23 degrees of freedom Multiple R-Squared: 0.8745, Adjusted R-squared: 0.869 F-statistic: 160.3 on 1 and 23 DF, p-value: 7.546e-12 > detach(Windmill) > > > > cleanEx(); ..nameEx <- "Window" > > ### * Window > > flush(stderr()); flush(stdout()) > > ### Name: Window > ### Title: Wind leakage for storm windows exposed to a 50 mph wind > ### Aliases: Window > ### Keywords: datasets > > ### ** Examples > > str(Window) `data.frame': 9 obs. of 2 variables: $ Window : int 1 2 3 4 5 6 7 8 9 $ Leakage: num 0.13 0.17 0.13 0.18 0.14 ... > attach(Window) > sign.test(Leakage,md=.125,alternative="greater") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: Leakage s = 7, p-value = 0.08984 alternative hypothesis: true median is greater than 0.125 95 percent confidence interval: 0.1243333 Inf sample estimates: median of x 0.14 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9102 0.1300 Inf Interpolated CI 0.9500 0.1243 Inf Upper Achieved CI 0.9805 0.1200 Inf > detach(Window) > > > > cleanEx(); ..nameEx <- "Wins" > > ### * Wins > > flush(stderr()); flush(stdout()) > > ### Name: Wins > ### Title: Baseball team wins versus 7 independent variables for National > ### league teams in 1990 > ### Aliases: Wins > ### Keywords: datasets > > ### ** Examples > > str(Wins) `data.frame': 12 obs. of 9 variables: $ team : Factor w/ 12 levels "Atlanta","Chicago",..: 1 2 3 4 5 6 7 8 9 12 ... $ wins : int 65 77 91 75 86 85 91 77 95 70 ... $ batavg : num 0.25 0.263 0.265 0.242 0.262 0.25 0.256 0.255 0.259 0.256 ... $ rbi : int 636 649 644 536 669 607 734 619 693 554 ... $ stole : int 92 151 166 179 141 235 110 108 137 221 ... $ strkout: int 1010 869 913 997 952 1024 851 915 914 844 ... $ caught : int 55 50 66 83 65 99 33 35 52 74 ... $ errors : int 158 124 102 131 130 110 132 117 134 130 ... $ era : num 4.58 4.34 3.39 3.61 3.72 ... > attach(Wins) > plot(era,wins) > model <- lm(wins~era) > abline(model) > summary(model) Call: lm(formula = wins ~ era) Residuals: Min 1Q Median 3Q Max -9.765 -4.277 1.930 4.236 8.694 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 143.500 19.398 7.398 2.32e-05 *** era -16.469 5.086 -3.238 0.0089 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.752 on 10 degrees of freedom Multiple R-Squared: 0.5119, Adjusted R-squared: 0.4631 F-statistic: 10.49 on 1 and 10 DF, p-value: 0.008895 > detach(Wins) > remove(model) > > > > cleanEx(); ..nameEx <- "Wool" > > ### * Wool > > flush(stderr()); flush(stdout()) > > ### Name: Wool > ### Title: Strength tests of two types of wool fabric > ### Aliases: Wool > ### Keywords: datasets > > ### ** Examples > > str(Wool) `data.frame': 10 obs. of 2 variables: $ Type.1: int 138 127 148 134 125 136 152 110 137 160 $ Type.2: int 134 137 135 140 130 134 120 157 162 114 > attach(Wool) > t.test(Type.1,Type.2,var.equal=TRUE) Two Sample t-test data: Type.1 and Type.2 t = 0.0618, df = 18, p-value = 0.9514 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -13.20869 14.00869 sample estimates: mean of x mean of y 136.7 136.3 > detach(Wool) > > > > cleanEx(); ..nameEx <- "Yearsunspot" > > ### * Yearsunspot > > flush(stderr()); flush(stdout()) > > ### Name: Yearsunspot > ### Title: Monthly sunspot activity from 1974 to 2000 > ### Aliases: Yearsunspot > ### Keywords: datasets > > ### ** Examples > > str(Yearsunspot) `data.frame': 252 obs. of 24 variables: $ X1979: num 167 138 138 102 134 ... $ X1980: num 160 155 126 164 180 ... $ X1981: num 114 141 136 156 128 ... $ X1982: num 111.2 163.6 153.8 122.0 82.2 ... $ X1983: num 84.3 51 66.5 80.7 99.2 91.1 82.2 71.8 50.3 55.8 ... $ X1984: num 57 85.4 83.5 69.7 76.4 46.1 37.4 25.5 15.7 12 ... $ X1985: num 16.5 15.9 17.2 16.2 27.5 24.2 30.7 11.1 3.9 18.6 ... $ X1986: num 2.5 23.2 15.1 18.5 13.7 1.1 18.1 7.4 3.8 35.5 ... $ X1987: num 10.4 2.4 14.8 39.3 30.6 17.5 33 38.6 33.5 60.5 ... $ X1988: num 59.0 40.0 76.2 88.0 60.1 ... $ X1989: num 161 165 131 131 138 ... $ X1990: num 177 130 140 140 132 ... $ X1991: num 137 168 142 140 121 ... $ X1992: num 150.0 161.1 106.7 99.8 73.8 ... $ X1993: num 59.3 91 69.8 62.2 61.3 49.8 57.9 42.2 22.4 56.4 ... $ X1994: num 57.8 35.5 31.7 16.1 17.8 28 35.1 22.5 25.7 43.8 ... $ X1995: num 24.2 29.9 31.1 14 14.5 15.6 14.5 14.3 11.8 21.1 ... $ X1996: num 11.5 4.4 9.2 4.8 5.5 11.8 8.2 14.4 1.6 0.9 ... $ X1997: num 5.7 7.6 8.7 15.5 18.5 12.7 10.4 24.4 51.3 22.8 ... $ X1998: num 31.9 40.3 54.8 53.4 56.3 70.6 66.2 91.7 92.9 55.6 ... $ X1999: num 62.0 66.3 68.8 63.7 106.4 ... $ X2000: num 90.2 112.3 138.2 NA NA ... $ SSN : num 167 138 138 102 134 ... $ year : int 79 79 79 79 79 79 79 79 79 79 ... > attach(Yearsunspot) > boxplot(SSN~year,main="Exercise 2.7",col="lightblue") > detach(Yearsunspot) > > > > cleanEx(); ..nameEx <- "normarea" > > ### * normarea > > flush(stderr()); flush(stdout()) > > ### Name: normarea > ### Title: Normal Area > ### Aliases: normarea > ### Keywords: distribution > > ### ** Examples > > normarea(70,130,100,15) > # Finds and P(70 < X < 130) given X is N(100,15). > > > > cleanEx(); ..nameEx <- "nsize" > > ### * nsize > > flush(stderr()); flush(stdout()) > > ### Name: nsize > ### Title: Required Sample Size > ### Aliases: nsize > ### Keywords: univar > > ### ** Examples > > nsize(b=.03, p=708/1200, conf.level=.90, type="pi") The required sample size (n) to estimate the population proportion of successes with a 0.9 confidence interval so that the margin of error is no more than 0.03 is 728 . > # Returns the required sample size (n) to estimate the population > # proportion of successes with a 0.9 confidence interval > # so that the margin of error is no more than 0.03 when the > # estimate of the population propotion of successes is 708/1200. > # This is problem 5.38 on page 257 of Kitchen's BSDA. > > nsize(b=.15, sigma=.31, conf.level=.90, type="mu") The required sample size (n) to estimate the population mean with a 0.9 confidence interval so that the margin of error is no more than 0.15 is 12 . > # Returns the required sample size (n) to estimate the population > # mean with a 0.9 confidence interval so that the margin > # of error is no more than 0.15. This is Example 5.17 on page > # 261 of Kitchen's BSDA. > > > > cleanEx(); ..nameEx <- "ntester" > > ### * ntester > > flush(stderr()); flush(stdout()) > > ### Name: ntester > ### Title: Normality Tester > ### Aliases: ntester > ### Keywords: distribution > > ### ** Examples > > ntester(rexp(50,1)) > # Q-Q plot of random exponential data in center plot > # surrounded by 8 Q-Q plots of randomly generated > # standard normal data of size 50. > > > > cleanEx(); ..nameEx <- "sign.test" > > ### * sign.test > > flush(stderr()); flush(stdout()) > > ### Name: sign.test > ### Title: Sign Test > ### Aliases: sign.test > ### Keywords: htest > > ### ** Examples > > x <- c(7.8, 6.6, 6.5, 7.4, 7.3, 7., 6.4, 7.1, 6.7, 7.6, 6.8) > sign.test(x,md=6.5) Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: x s = 9, p-value = 0.02148 alternative hypothesis: true median is not equal to 6.5 95 percent confidence interval: 6.571273 7.457455 sample estimates: median of x 7 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9346 6.6000 7.4000 Interpolated CI 0.9500 6.5713 7.4575 Upper Achieved CI 0.9883 6.5000 7.6000 > # Computes two-sided sign-test for the null hypothesis > # that the population median for 'x' is 6.5. The alternative > # hypothesis is that the median is not 6.5. An interpolated 95 > # confidence interval for the population median will be computed. > > reaction <- c(14.3, 13.7, 15.4, 14.7, 12.4, 13.1, 9.2, 14.2, + 14.4, 15.8, 11.3, 15.0) > sign.test(reaction, md=15, alternative="less") Warning in return(rval, Confidence.Intervals) : multi-argument returns are deprecated $rval One-sample Sign-Test data: reaction s = 2, p-value = 0.03271 alternative hypothesis: true median is less than 15 95 percent confidence interval: -Inf 14.82845 sample estimates: median of x 14.25 $Confidence.Intervals Conf.Level L.E.pt U.E.pt Lower Achieved CI 0.9270 -Inf 14.7000 Interpolated CI 0.9500 -Inf 14.8285 Upper Achieved CI 0.9807 -Inf 15.0000 > # Data from Example 6.11 page 330 of Kitchens BSDA. > # Computes one-sided sign-test for the null hypothesis > # that the population median is 15. The alternative > # hypothesis is that the median is less than 15. > # An interpolated upper 95 > # median will be computed. > > > > cleanEx(); ..nameEx <- "tsum.test" > > ### * tsum.test > > flush(stderr()); flush(stdout()) > > ### Name: tsum.test > ### Title: T summary test > ### Aliases: tsum.test > ### Keywords: htest > > ### ** Examples > > tsum.test(mean.x=5.6, s.x=2.1, n.x=16, mu=4.9, alternative="greater") One-sample t-Test data: Summarized x t = 1.3333, df = 15, p-value = 0.1012 alternative hypothesis: true mean is greater than 4.9 95 percent confidence interval: 4.679649 NA sample estimates: mean of x 5.6 > # Problem 6.31 on page 324 of BSDA states: The chamber of commerce > # of a particular city claims that the mean carbon dioxide > # level of air polution is no greater than 4.9 ppm. A random > # sample of 16 readings resulted in a sample mean of 5.6 ppm, > # and s=2.1 ppm. One-sided one-sample t-test. The null > # hypothesis is that the population mean for 'x' is 4.9. > # The alternative hypothesis states that it is greater than 4.9. > > x <- rnorm(12) > tsum.test(mean(x), sd(x), n.x=12) One-sample t-Test data: Summarized x t = 1.1478, df = 11, p-value = 0.2754 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.2464740 0.7837494 sample estimates: mean of x 0.2686377 > # Two-sided one-sample t-test. The null hypothesis is that > # the population mean for 'x' is zero. The alternative > # hypothesis states that it is either greater or less > # than zero. A confidence interval for the population mean > # will be computed. Note: above returns same answer as: > t.test(x) One Sample t-test data: x t = 1.1478, df = 11, p-value = 0.2754 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.2464740 0.7837494 sample estimates: mean of x 0.2686377 > > x <- c(7.8, 6.6, 6.5, 7.4, 7.3, 7.0, 6.4, 7.1, 6.7, 7.6, 6.8) > y <- c(4.5, 5.4, 6.1, 6.1, 5.4, 5.0, 4.1, 5.5) > tsum.test(mean(x), s.x=sd(x), n.x=11 ,mean(y), s.y=sd(y), n.y=8, mu=2) Standard Two-Sample t-Test data: Summarized x and y t = -0.9116, df = 17, p-value = 0.3747 alternative hypothesis: true difference in means is not equal to 2 95 percent confidence interval: 1.190255 2.321108 sample estimates: mean of x mean of y 7.018182 5.262500 > # Two-sided standard two-sample t-test. The null hypothesis > # is that the population mean for 'x' less that for 'y' is 2. > # The alternative hypothesis is that this difference is not 2. > # A confidence interval for the true difference will be computed. > # Note: above returns same answer as: > t.test(x, y) Welch Two Sample t-test data: x and y t = 6.1281, df = 11.303, p-value = 6.617e-05 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 1.127160 2.384203 sample estimates: mean of x mean of y 7.018182 5.262500 > > tsum.test(mean(x), s.x=sd(x), n.x=11, mean(y), s.y=sd(y), n.y=8, conf.level=0.90) Standard Two-Sample t-Test data: Summarized x and y t = 6.5511, df = 17, p-value = 4.941e-06 alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval: 1.289471 2.221893 sample estimates: mean of x mean of y 7.018182 5.262500 > # Two-sided standard two-sample t-test. The null hypothesis > # is that the population mean for 'x' less that for 'y' is zero. > # The alternative hypothesis is that this difference is not > # zero. A 90% confidence interval for the true difference will > # be computed. Note: above returns same answer as: > t.test(x, y, conf.level=0.90) Welch Two Sample t-test data: x and y t = 6.1281, df = 11.303, p-value = 6.617e-05 alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval: 1.242424 2.268940 sample estimates: mean of x mean of y 7.018182 5.262500 > > > > > cleanEx(); ..nameEx <- "z.test" > > ### * z.test > > flush(stderr()); flush(stdout()) > > ### Name: z.test > ### Title: Z-test > ### Aliases: z.test > ### Keywords: htest > > ### ** Examples > > x <- rnorm(12) > z.test(x,sigma.x=1) One-sample z-Test data: x z = 0.9306, p-value = 0.3521 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.2971552 0.8344306 sample estimates: mean of x 0.2686377 > # Two-sided one-sample z-test where the assumed value for > # sigma.x is one. The null hypothesis is that the population > # mean for 'x' is zero. The alternative hypothesis states > # that it is either greater or less than zero. A confidence > # interval for the population mean will be computed. > > x <- c(7.8, 6.6, 6.5, 7.4, 7.3, 7., 6.4, 7.1, 6.7, 7.6, 6.8) > y <- c(4.5, 5.4, 6.1, 6.1, 5.4, 5., 4.1, 5.5) > z.test(x, sigma.x=0.5, y, sigma.y=0.5, mu=2) Two-sample z-Test data: x and y z = -1.0516, p-value = 0.293 alternative hypothesis: true difference in means is not equal to 2 95 percent confidence interval: 1.300323 2.211040 sample estimates: mean of x mean of y 7.018182 5.262500 > # Two-sided standard two-sample z-test where both sigma.x > # and sigma.y are both assumed to equal 0.5. The null hypothesis > # is that the population mean for 'x' less that for 'y' is 2. > # The alternative hypothesis is that this difference is not 2. > # A confidence interval for the true difference will be computed. > > z.test(x, sigma.x=0.5, y, sigma.y=0.5, conf.level=0.90) Two-sample z-Test data: x and y z = 7.5568, p-value = 4.13e-14 alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval: 1.373533 2.137831 sample estimates: mean of x mean of y 7.018182 5.262500 > # Two-sided standard two-sample z-test where both sigma.x and > # sigma.y are both assumed to equal 0.5. The null hypothesis > # is that the population mean for 'x' less that for 'y' is zero. > # The alternative hypothesis is that this difference is not > # zero. A 90% confidence interval for the true difference will > # be computed. > > > > > cleanEx(); ..nameEx <- "zsum.test" > > ### * zsum.test > > flush(stderr()); flush(stdout()) > > ### Name: zsum.test > ### Title: Z summary test > ### Aliases: zsum.test > ### Keywords: htest > > ### ** Examples > > x <- rnorm(12) > zsum.test(mean(x),sigma.x=1,n.x=12) One-sample z-Test data: Summarized x z = 0.9306, p-value = 0.3521 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.2971552 0.8344306 sample estimates: mean of x 0.2686377 > # Two-sided one-sample z-test where the assumed value for > # sigma.x is one. The null hypothesis is that the population > # mean for 'x' is zero. The alternative hypothesis states > # that it is either greater or less than zero. A confidence > # interval for the population mean will be computed. > # Note: returns same answer as: > z.test(x,sigma.x=1) One-sample z-Test data: x z = 0.9306, p-value = 0.3521 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: -0.2971552 0.8344306 sample estimates: mean of x 0.2686377 > > x <- c(7.8, 6.6, 6.5, 7.4, 7.3, 7.0, 6.4, 7.1, 6.7, 7.6, 6.8) > y <- c(4.5, 5.4, 6.1, 6.1, 5.4, 5.0, 4.1, 5.5) > zsum.test(mean(x), sigma.x=0.5, n.x=11 ,mean(y), sigma.y=0.5, n.y=8, mu=2) Two-sample z-Test data: Summarized x and y z = -1.0516, p-value = 0.293 alternative hypothesis: true difference in means is not equal to 2 95 percent confidence interval: 1.300323 2.211040 sample estimates: mean of x mean of y 7.018182 5.262500 > # Two-sided standard two-sample z-test where both sigma.x > # and sigma.y are both assumed to equal 0.5. The null hypothesis > # is that the population mean for 'x' less that for 'y' is 2. > # The alternative hypothesis is that this difference is not 2. > # A confidence interval for the true difference will be computed. > # Note: returns same answer as: > z.test(x, sigma.x=0.5, y, sigma.y=0.5) Two-sample z-Test data: x and y z = 7.5568, p-value = 4.13e-14 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 1.300323 2.211040 sample estimates: mean of x mean of y 7.018182 5.262500 > > zsum.test(mean(x), sigma.x=0.5, n.x=11, mean(y), sigma.y=0.5, n.y=8, conf.level=0.90) Two-sample z-Test data: Summarized x and y z = 7.5568, p-value = 4.13e-14 alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval: 1.373533 2.137831 sample estimates: mean of x mean of y 7.018182 5.262500 > # Two-sided standard two-sample z-test where both sigma.x and > # sigma.y are both assumed to equal 0.5. The null hypothesis > # is that the population mean for 'x' less that for 'y' is zero. > # The alternative hypothesis is that this difference is not > # zero. A 90% confidence interval for the true difference will > # be computed. Note: returns same answer as: > z.test(x, sigma.x=0.5, y, sigma.y=0.5, conf.level=0.90) Two-sample z-Test data: x and y z = 7.5568, p-value = 4.13e-14 alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval: 1.373533 2.137831 sample estimates: mean of x mean of y 7.018182 5.262500 > > > > ### *