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) > > >