R lab exam #3 consule - answers PDF

Title R lab exam #3 consule - answers
Author Melissa Rosenberg
Course Experimental Design and Biostatistics
Institution The University of Tampa
Pages 10
File Size 63 KB
File Type PDF
Total Downloads 35
Total Views 140

Summary

answers...


Description

> getwd() [1] "/Users/melissar" > setwd("/Users/melissar/documents") > library(psych) > library(moments) > library(doBy) > hamster class(hamster$bp) [1] "integer" > hamster1 anova(hamster1) Analysis of Variance Table Response: bp Df Sum Sq Mean Sq F value Pr(>F) age 1 1484 1484.03 5.5629 0.02296 * Residuals 43 11471 266.77 --Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > summary(hamster1) Df Sum Sq Mean Sq F value Pr(>F) age 1 1484 1484.0 5.563 0.023 * Residuals 43 11471 266.8 --Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > plot(hamster1) Hit to see next plot: anova(hamster1) Hit to see next plot: anova(hamster1) Hit to see next plot: # anova(hamster1) Hit to see next plot: # anova(hamster1) > summary(hamster1) Df Sum Sq Mean Sq F value Pr(>F) age 1 1484 1484.0 5.563 0.023 * Residuals 43 11471 266.8 --Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > TukeyHSD(hamster1) Error in TukeyHSD.aov(hamster1) : no factors in the fitted model In addition: Warning message: In replications(paste("~", xx), data = mf) : non-factors ignored: age > boxplot(bp~age,hamster) > hist(hamster) Error in hist.default(hamster) : 'x' must be numeric > hist(hamster,xlab="age")

Error in hist.default(hamster, xlab = "age") : 'x' must be numeric > hist(hamster,xlab="bp") Error in hist.default(hamster, xlab = "bp") : 'x' must be numeric > hist(hamster$age,xlab="bp") > bartlett.test(bp~age,hamster) Bartlett test of homogeneity of variances data: bp by age Bartlett's K-squared = 4.7292, df = 2, p-value = 0.09399 > residuals.model shapiro.test(residuals.model) Error in shapiro.test(residuals.model) : is.numeric(x) is not TRUE > hamster$bp shapiro.test(residuals.model) Error in shapiro.test(residuals.model) : is.numeric(x) is not TRUE > means means means 1 2 3 NA NA NA > hamster1 Call: aov(formula = bp ~ age, data = hamster) Terms: age Residuals Sum of Squares 1484.033 11471.211 Deg. of Freedom 1 43 Residual standard error: 16.33317 Estimated effects may be unbalanced > residuals.model TukeyHSD(hamster1) Error in TukeyHSD.aov(hamster1) : no factors in the fitted model

In addition: Warning message: In replications(paste("~", xx), data = mf) : non-factors ignored: age > hamster$bp class(hamster$bp) [1] "factor" > TukeyHSD(hamster1) Error in TukeyHSD.aov(hamster1) : no factors in the fitted model In addition: Warning message: In replications(paste("~", xx), data = mf) : non-factors ignored: age > shapiro.test(residuals.model) Error in shapiro.test(residuals.model) : is.numeric(x) is not TRUE > residuals.model shapiro.test(residuals.model) Error in shapiro.test(residuals.model) : is.numeric(x) is not TRUE > means means 1 2 3 NA NA NA > class(hamster$age) [1] "integer" 2019-11-27 21:54:28.801 R[51397:18447931] warning: determined it was necessary to configure to support remote view vibrancy > hamster$bp class(hamster$age) [1] "integer" > hamster$bp class(hamster$bp) [1] "integer" > hamster$bp hamster$age class(hamster$age) [1] "factor" > TukeyHSD(hamster1) Error in TukeyHSD.aov(hamster1) : no factors in the fitted model In addition: Warning message: In replications(paste("~", xx), data = mf) : non-factors ignored: age

> residuals.model shapiro.test(residuals.model) Error in shapiro.test(residuals.model) : is.numeric(x) is not TRUE > means means 123 123 > sds sds 123 000 > ns ses ses 123 000 > b arrows(b,means+ses,b,means-ses,angle=90,code=3) Warning messages: 1: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped 2: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped 3: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped > arrows(b,means+ses,b,means-ses,angle=90,code=3) Warning messages: 1: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped 2: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) :

zero-length arrow is of indeterminate angle and so skipped 3: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped > b arrows(b,means+ses,b,means-ses,angle=90,code=3) Warning messages: 1: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped 2: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped 3: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped > box(bty="l") > box(bty="l") > b arrows(b,means+ses,b,means-ses,angle=90,code=3)box(bty="l") Error: unexpected symbol in "arrows(b,means+ses,b,means-ses,angle=90,code=3)box" > b arrows(b,means+ses,b,means-ses,angle=90,code=3)box(bty="l") Error: unexpected symbol in "arrows(b,means+ses,b,means-ses,angle=90,code=3)box" > b arrows(b,means+ses,b,means-ses,angle=90,code=3)box(bty="l") Error: unexpected symbol in "arrows(b,means+ses,b,means-ses,angle=90,code=3)box" objc[51397]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff9d0f53d8) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollab orationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOver ride (0x108df9f50). One of the two will be used. Which one is undefined. > arrows(b,means+ses,b,means-ses,angle=90,code=3) Warning messages: 1: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped 2: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped 3: In arrows(b, means + ses, b, means - ses, angle = 90, code = 3) : zero-length arrow is of indeterminate angle and so skipped > box(bty="l") > bhogs bhogs class(bhogs$season) [1] "integer" > bhogs$season bhogs1 anova(bhogs1) Error in if (ssr < 1e-10 * mss) warning("ANOVA F-tests on an essentially perfect fit are unreliable") : missing value where TRUE/FALSE needed In addition: Warning message: In Ops.factor(object$residuals, 2) : ‘^’ not meaningful for factors > summary(bhogs1) Error in levels(x)[x] : only 0's may be mixed with negative subscripts > bhogs$season bhogs1 anova(bhogs1) Analysis of Variance Table Response: season Df Sum Sq Mean Sq F value Pr(>F) tlevels 1 14.288 14.2877 22.451 0.0001115 *** Residuals 21 13.364 0.6364 --Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > TukeyHSD(bhogs1) Error in TukeyHSD.aov(bhogs1) : no factors in the fitted model In addition: Warning message: In replications(paste("~", xx), data = mf) : non-factors ignored: tlevels > print(model.tables(bhogs1,"means"),digits=2) Tables of means Grand mean 2.434783 tlevels tlevels 20 25 30 35 40 50 55 60 70 72 90 100 105 190 210 220 230 1.7 1.8 1.8 1.9 2.0 2.1 2.1 2.2 2.3 2.3 2.6 2.7 2.7 3.8 4.0 4.1 4.2 Warning message: In replications(paste("~", xx), data = mf) : non-factors ignored: tlevels > bhogs1 anova(bhogs1) Analysis of Variance Table Response: tlevels Df Sum Sq Mean Sq F value Pr(>F) season 1 50823 50823 22.451 0.0001115 *** Residuals 21 47538 2264 --Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > TukeyHSD(bhogs1) Error in TukeyHSD.aov(bhogs1) : no factors in the fitted model In addition: Warning message: In replications(paste("~", xx), data = mf) : non-factors ignored: season > print(model.tables(bhogs1,"means"),digits=2) Tables of means Grand mean 79.65217 season season 1 2 3 4 18 61 104 147 Warning message: In replications(paste("~", xx), data = mf) : non-factors ignored: season > boxplot(season~tlevels,bhogs) > hist(bhogs$season,xlab="tlevels") > bartlett.test(season~tlevels,bhogs) Error in bartlett.test.default(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, : there must be at least 2 observations in each group > bartlett.test(tlevels~season,bhogs) Bartlett test of homogeneity of variances data: tlevels by season Bartlett's K-squared = 6.4647, df = 3, p-value = 0.09107 > residuals.model shapiro.test(residuals.bhogs1) Error: object 'residuals.bhogs1' not found > shapiro.test(residuals.model) Shapiro-Wilk normality test

data: residuals.model W = 0.96146, p-value = 0.4934 > means means 1 2 3 4 46.66667 40.00000 60.33333 190.00000 > sds sds 1 2 3 4 25.03331 15.16575 28.26069 52.44044 > ns ses ses 1 2 3 4 10.219806 6.191392 11.537379 23.452079 > b arrows(b,means+ses,b,means-ses,angle=90,code=3) > box(bty="l") > plots(bhogs1) Error in plots(bhogs1) : could not find function "plots" In addition: Warning messages: 1: "symbols" is not a graphical parameter 2: "symbols" is not a graphical parameter 3: "symbols" is not a graphical parameter 4: "symbols" is not a graphical parameter > plot(bhogs1) Hit to see next plot: anova(bhogs1) Hit to see next plot: anova(bhogs1) Hit to see next plot: anova(bhogs1) Hit to see next plot: anova(bhogs1) > TukeyHSD(bhogs1) Error in TukeyHSD.aov(bhogs1) : no factors in the fitted model In addition: Warning message:

In replications(paste("~", xx), data = mf) : non-factors ignored: season > Bartlett test of homogeneity of variances data: bp by age Bartlett's K-squared = 4.7292, df = 2, p-value = 0.09399 > residuals.model shapiro.test(residuals.model) Error in shapiro.test(residuals.model) : is.numeric(x) is not TRUE > means means 1 2 3 122.2000 113.1333 108.1333 > sds sds 1 2 3 21.62406 13.20642 13.20642 > ns ses ses 1 2 3 5.583308 3.409883 3.409883 > b arrows(b,means+ses,b,means-ses,angle=90,code=3) > box(bty="l") >...


Similar Free PDFs