### MANOVA

# Note, this is a complete, lengthy example, with assumptions tests,
# Followup univariates
# Posthocs
# Plots of effects
### 1. Read the data
setwd("H:/data/User/Classes/multiv_13/YTs/YTSplit/Week 02 wmv - 2016/Wk02.R")
getwd()
## [1] "H:/data/User/Classes/multiv_13/YTs/YTSplit/Week 02 wmv - 2016/Wk02.R"
man2way<- read.csv("Class02_homework_2013.csv")
#IVS: DogOwner*SarcasmLevel
#DVs; Trust, Cynicism,Conservatism,Hypertensive,Funny,Honest


#A. Assumptions checks

#We already know these data are non-normal (from main lecture), so I'm just going to plot
#histogram with normal curve and then Blom transform


#Obtain multivariate normality
#install.packages("MVN")
library(MVN)
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
## sROC 0.1-2 loaded
mvn(man2way[ ,5:10], subset = NULL, mvnTest = "mardia", covariance = TRUE, 
tol = 1e-25, alpha = 0.5,
scale = FALSE, desc = TRUE, transform = "none", R = 1000,
univariateTest = "SW",
univariatePlot = "histogram", multivariatePlot = "qq",
multivariateOutlierMethod = "quan", bc = FALSE, bcType = "rounded",
showOutliers = TRUE, showNewData = FALSE)

## $multivariateNormality
## Test Statistic p value Result
## 1 Mardia Skewness 846.474888383111 1.25792629704313e-141 NO
## 2 Mardia Kurtosis -8.40161582745658 0 NO
## 3 MVN <NA> <NA> NO
##
## $univariateNormality
## Test Variable Statistic p value Normality
## 1 Shapiro-Wilk Trust 0.9251 <0.001 NO
## 2 Shapiro-Wilk Cynicism 0.9240 <0.001 NO
## 3 Shapiro-Wilk Conservatism 0.9773 <0.001 NO
## 4 Shapiro-Wilk Hypertensive 0.9803 <0.001 NO
## 5 Shapiro-Wilk Funny 0.9490 <0.001 NO
## 6 Shapiro-Wilk Honest 0.9659 <0.001 NO
##
## $Descriptives
## n Mean Std.Dev Median Min Max 25th 75th Skew
## Trust 600 18.59833 4.598069 18 10 31 15.00 21 0.8689855
## Cynicism 600 15.54000 4.608014 15 8 25 11.00 20 0.3388106
## Conservatism 600 16.11000 2.720337 16 10 23 14.00 18 0.1108066
## Hypertensive 600 17.60667 5.096919 18 8 29 13.75 21 0.1191834
## Funny 600 13.29167 8.218628 13 0 31 6.00 19 0.3691950
## Honest 600 17.96833 3.265236 18 9 25 16.00 21 -0.4466829
## Kurtosis
## Trust 0.2177091
## Cynicism -1.2294607
## Conservatism -0.7086546
## Hypertensive -0.5699631
## Funny -0.9019649
## Honest -0.5090782
##
## $multivariateOutliers
## Observation Mahalanobis Distance Outlier
## 506 506 67.218 TRUE
## 562 562 62.403 TRUE
## 502 502 62.167 TRUE
<list truncated for space>

#Obtain Box M
#install.packages("heplots")
library(heplots)
## Loading required package: car
## Loading required package: carData
man2way$DogOwner<-factor(man2way$DogOwner)
man2way$SarcasmLevel<-factor(man2way$SarcasmLevel)
boxM(cbind(Trust, Cynicism,Conservatism,Hypertensive,Funny,Honest) ~ DogOwner*SarcasmLevel,
data=man2way)
## 
## Box's M-test for Homogeneity of Covariance Matrices
##
## data: Y
## Chi-Sq (approx.) = 235.7, df = 105, p-value = 4.881e-12
#Obtain Levene's test
library(car)
leveneTest(lm(Trust ~ DogOwner:SarcasmLevel, data=man2way))
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 1.4728 0.1967
## 594
leveneTest(lm(Cynicism ~ DogOwner:SarcasmLevel, data=man2way))
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 7.0378 2.102e-06 ***
## 594
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
leveneTest(lm(Conservatism ~ DogOwner:SarcasmLevel, data=man2way))
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 7.1384 1.689e-06 ***
## 594
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
leveneTest(lm(Hypertensive ~ DogOwner:SarcasmLevel, data=man2way))
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 5.6526 4.202e-05 ***
## 594
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
leveneTest(lm(Funny ~ DogOwner:SarcasmLevel, data=man2way))
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 1.2835 0.2693
## 594
leveneTest(lm(Honest ~ DogOwner:SarcasmLevel, data=man2way))
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 1.9276 0.0879 .
## 594
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Obtain residuals for Residual SSCP, and run the omnibus MANOVA

Y <- (cbind(man2way$Trust,man2way$Cynicism,man2way$Conservatism,man2way$Hypertensive,
man2way$Funny,man2way$Honest))
manfit <- manova(Y ~ man2way$DogOwner*man2way$SarcasmLevel)
summary(manfit) # ANOVA table of Pillai's trace
##                                        Df Pillai approx F num Df den Df
## man2way$DogOwner 1 0.8438 530.29 6 589
## man2way$SarcasmLevel 2 1.5878 378.79 12 1180
## man2way$DogOwner:man2way$SarcasmLevel 2 1.5954 387.77 12 1180
## Residuals 594
## Pr(>F)
## man2way$DogOwner < 2.2e-16 ***
## man2way$SarcasmLevel < 2.2e-16 ***
## man2way$DogOwner:man2way$SarcasmLevel < 2.2e-16 ***
## Residuals
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(manfit, test = "Wilks") # ANOVA table of Wilks' lambda
##                                        Df    Wilks approx F num Df den Df
## man2way$DogOwner 1 0.156202 530.29 6 589
## man2way$SarcasmLevel 2 0.011005 837.61 12 1178
## man2way$DogOwner:man2way$SarcasmLevel 2 0.026536 504.46 12 1178
## Residuals 594
## Pr(>F)
## man2way$DogOwner < 2.2e-16 ***
## man2way$SarcasmLevel < 2.2e-16 ***
## man2way$DogOwner:man2way$SarcasmLevel < 2.2e-16 ***
## Residuals
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(manfit, test = "Hotelling-Lawley") # ANOVA table of Hotelling's Trace
##                                        Df Hotelling-Lawley approx F num Df
## man2way$DogOwner 1 5.402 530.29 6
## man2way$SarcasmLevel 2 35.456 1737.32 12
## man2way$DogOwner:man2way$SarcasmLevel 2 13.246 649.07 12
## Residuals 594
## den Df Pr(>F)
## man2way$DogOwner 589 < 2.2e-16 ***
## man2way$SarcasmLevel 1176 < 2.2e-16 ***
## man2way$DogOwner:man2way$SarcasmLevel 1176 < 2.2e-16 ***
## Residuals
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary.aov(manfit)             # univariate ANOVA tables
##  Response 1 :
## Df Sum Sq Mean Sq F value Pr(>F)
## man2way$DogOwner 1 287.0 287.0 87.322 < 2.2e-16 ***
## man2way$SarcasmLevel 2 7392.9 3696.5 1124.507 < 2.2e-16 ***
## man2way$DogOwner:man2way$SarcasmLevel 2 3031.7 1515.8 461.136 < 2.2e-16 ***
## Residuals 594 1952.6 3.3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response 2 :
## Df Sum Sq Mean Sq F value Pr(>F)
## man2way$DogOwner 1 4363.2 4363.2 1651.32 < 2.2e-16 ***
## man2way$SarcasmLevel 2 4131.4 2065.7 781.79 < 2.2e-16 ***
## man2way$DogOwner:man2way$SarcasmLevel 2 2654.9 1327.5 502.40 < 2.2e-16 ***
## Residuals 594 1569.5 2.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response 3 :
## Df Sum Sq Mean Sq F value Pr(>F)
## man2way$DogOwner 1 123.31 123.31 39.9179 5.198e-10
## man2way$SarcasmLevel 2 2469.20 1234.60 399.6761 < 2.2e-16
## man2way$DogOwner:man2way$SarcasmLevel 2 5.36 2.68 0.8674 0.4206
## Residuals 594 1834.87 3.09
##
## man2way$DogOwner ***
## man2way$SarcasmLevel ***
## man2way$DogOwner:man2way$SarcasmLevel
## Residuals
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response 4 :
## Df Sum Sq Mean Sq F value Pr(>F)
## man2way$DogOwner 1 92.8 92.8 25.718 5.288e-07
## man2way$SarcasmLevel 2 10418.5 5209.2 1443.243 < 2.2e-16
## man2way$DogOwner:man2way$SarcasmLevel 2 2905.9 1453.0 402.549 < 2.2e-16
## Residuals 594 2144.0 3.6
##
## man2way$DogOwner ***
## man2way$SarcasmLevel ***
## man2way$DogOwner:man2way$SarcasmLevel ***
## Residuals
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response 5 :
## Df Sum Sq Mean Sq F value Pr(>F)
## man2way$DogOwner 1 389 388.8 109.89 < 2.2e-16 ***
## man2way$SarcasmLevel 2 35431 17715.3 5006.86 < 2.2e-16 ***
## man2way$DogOwner:man2way$SarcasmLevel 2 2539 1269.5 358.79 < 2.2e-16 ***
## Residuals 594 2102 3.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response 6 :
## Df Sum Sq Mean Sq F value Pr(>F)
## man2way$DogOwner 1 506.0 506.00 192.633 < 2.2e-16 ***
## man2way$SarcasmLevel 2 272.7 136.35 51.908 < 2.2e-16 ***
## man2way$DogOwner:man2way$SarcasmLevel 2 4047.4 2023.70 770.418 < 2.2e-16 ***
## Residuals 594 1560.3 2.63
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
resmat<-as.data.frame(residuals(manfit))
library(MASS)
library(corrr)
corr_rm<-correlate(resmat)
## 
## Correlation method: 'pearson'
## Missing treated using: 'pairwise.complete.obs'
corr_rm
## # A tibble: 6 x 7
## rowname V1 V2 V3 V4 V5 V6
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 V1 NA 0.429 0.198 -0.0385 -0.0426 0.0131
## 2 V2 0.429 NA 0.285 0.0189 0.0554 0.0444
## 3 V3 0.198 0.285 NA 0.0779 -0.0472 0.0354
## 4 V4 -0.0385 0.0189 0.0779 NA 0.594 0.539
## 5 V5 -0.0426 0.0554 -0.0472 0.594 NA 0.500
## 6 V6 0.0131 0.0444 0.0354 0.539 0.500 NA
#We see significant interactions for three DVs. So, we do simple effects
#use subset(data, condition) to divide the original dataset
#SarcasmLevel1
datavs1 <- subset(man2way, SarcasmLevel == '1')
#SarcasmLevel2
datavs2 <- subset(man2way, SarcasmLevel == '2')
#SarcasmLevel3
datavs3 <- subset(man2way, SarcasmLevel == '3')

#run ANOVA on the treatment subsets to investigate the impacts of TreatFreq
#within each level of VolunStatus
#For Trust
#vs=1
anova(lm(Trust ~ DogOwner, datavs1))
## Analysis of Variance Table
##
## Response: Trust
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 2971.16 2971.16 834.98 < 2.2e-16 ***
## Residuals 196 697.43 3.56
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=2
anova(lm(Trust ~ DogOwner, datavs2))
## Analysis of Variance Table
##
## Response: Trust
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 64.34 64.337 20.194 1.183e-05 ***
## Residuals 200 637.19 3.186
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=3
anova(lm(Trust ~ DogOwner, datavs3))
## Analysis of Variance Table
##
## Response: Trust
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 283.22 283.220 90.746 < 2.2e-16 ***
## Residuals 198 617.96 3.121
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#For Cynicism
#vs=1
anova(lm(Cynicism ~ DogOwner, datavs1))
## Analysis of Variance Table
##
## Response: Cynicism
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 4.55 4.5455 1.3484 0.247
## Residuals 196 660.71 3.3710
#vs=2
anova(lm(Cynicism ~ DogOwner, datavs2))
## Analysis of Variance Table
##
## Response: Cynicism
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 4842.2 4842.2 2213 < 2.2e-16 ***
## Residuals 200 437.6 2.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=3
anova(lm(Cynicism ~ DogOwner, datavs3))
## Analysis of Variance Table
##
## Response: Cynicism
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 2171.41 2171.41 912.45 < 2.2e-16 ***
## Residuals 198 471.19 2.38
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#For Conservatism
#vs=1
anova(lm(Conservatism ~ DogOwner, datavs1))
## Analysis of Variance Table
##
## Response: Conservatism
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 46.55 46.545 14.297 0.0002072 ***
## Residuals 196 638.10 3.256
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=2
anova(lm(Conservatism ~ DogOwner, datavs2))
## Analysis of Variance Table
##
## Response: Conservatism
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 61.0 60.995 15.44 0.0001173 ***
## Residuals 200 790.1 3.950
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=3
anova(lm(Conservatism ~ DogOwner, datavs3))
## Analysis of Variance Table
##
## Response: Conservatism
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 21.13 21.1250 10.285 0.001564 **
## Residuals 198 406.67 2.0539
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#For Hypertensive
#vs=1
anova(lm(Hypertensive ~ DogOwner, datavs1))
## Analysis of Variance Table
##
## Response: Hypertensive
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 293.34 293.338 80.501 2.359e-16 ***
## Residuals 196 714.20 3.644
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=2
anova(lm(Hypertensive ~ DogOwner, datavs2))
## Analysis of Variance Table
##
## Response: Hypertensive
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 248.40 248.396 65.417 5.739e-14 ***
## Residuals 200 759.43 3.797
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=3
anova(lm(Hypertensive ~ DogOwner, datavs3))
## Analysis of Variance Table
##
## Response: Hypertensive
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 2457.01 2457.01 725.72 < 2.2e-16 ***
## Residuals 198 670.35 3.39
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#For Funny
#vs=1
anova(lm(Funny ~ DogOwner, datavs1))
## Analysis of Variance Table
##
## Response: Funny
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 184.25 184.247 56.026 2.365e-12 ***
## Residuals 196 644.57 3.289
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=2
anova(lm(Funny ~ DogOwner, datavs2))
## Analysis of Variance Table
##
## Response: Funny
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 20.28 20.2772 5.367 0.02153 *
## Residuals 200 755.62 3.7781
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=3
anova(lm(Funny ~ DogOwner, datavs3))
## Analysis of Variance Table
##
## Response: Funny
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 2723.2 2723.22 768.64 < 2.2e-16 ***
## Residuals 198 701.5 3.54
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#For Honest
#vs=1
anova(lm(Honest ~ DogOwner, datavs1))
## Analysis of Variance Table
##
## Response: Honest
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 1040.99 1040.99 334.67 < 2.2e-16 ***
## Residuals 196 609.66 3.11
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=2
anova(lm(Honest ~ DogOwner, datavs2))
## Analysis of Variance Table
##
## Response: Honest
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 174.97 174.970 73.652 2.591e-15 ***
## Residuals 200 475.13 2.376
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#vs=3
anova(lm(Honest ~ DogOwner, datavs3))
## Analysis of Variance Table
##
## Response: Honest
## Df Sum Sq Mean Sq F value Pr(>F)
## DogOwner 1 3337.4 3337.4 1389.7 < 2.2e-16 ***
## Residuals 198 475.5 2.4
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Because we did dichotomous comparisons at each level of Sarcasm Level, we don't need to do further
#posthocs -- just inspect the means
#If we had sliced the interaction the other way, we'd have had to do followup posthocs between
#the three levels of locale for each gender (for each DV). See main slides for an example

#Plotting the interaction for each DV
#This is a nice, SPSS like package for plotting
#It is a bit buggy, because some sub-packages aren't loading right; hence all the extra install /
#library calls
#A nice surprise is that it also gives SPSS like output, including -- surprisingly --
#Bonferroni-style simple effects post hocs!

#If the plotted dots make it too difficult to see the mean differences, you can set
#"show.dots=FALSE" instead

#install.packages("rlang")
#install.packages('TMB', type='source')
#install.packages("CGPfunctions")
library(rlang)
library(CGPfunctions)
## Registered S3 methods overwritten by 'lme4':
## method from
## cooks.distance.influence.merMod car
## influence.merMod car
## dfbeta.influence.merMod car
## dfbetas.influence.merMod car
library(TMB)

Plot2WayANOVA(Trust~SarcasmLevel*DogOwner,
dataframe = man2way,
confidence=.95,
plottype = "line",
xlab = "Sarcasm Level",
ylab = "Trust",
title = NULL,
subtitle = NULL,
interact.line.size = 1,
ci.line.size = 1,
mean.label = FALSE,
mean.ci = TRUE,
mean.size = 1,
mean.shape = 16,
mean.color = "darkred",
mean.label.size = 3,
mean.label.color = "black",
offset.style = "none",
overlay.type = NULL,
posthoc.method = "bonferroni",
show.dots = FALSE,
PlotSave = FALSE)
## 
## --- WARNING! ---
## You have an unbalanced design. Using Type II sum of
## squares, to calculate factor effect sizes eta and omega.
## Your two factors account for 0.846 of the type II sum of
## squares.
##                                        term    sumsq   meansq  df statistic
## SarcasmLevel SarcasmLevel 7392.903 3696.451 2 1124.507
## DogOwner DogOwner 287.042 287.042 1 87.322
## SarcasmLevel:DogOwner SarcasmLevel:DogOwner 3031.672 1515.836 2 461.136
## ...4 Residuals 1952.582 3.287 594 NA
## p.value etasq partial.etasq omegasq partial.omegasq
## SarcasmLevel 0 0.584 0.791 0.583 0.789
## DogOwner 0 0.023 0.128 0.022 0.126
## SarcasmLevel:DogOwner 0 0.239 0.608 0.239 0.605
## ...4 NA NA NA NA NA
## epsilonsq cohens.f power
## SarcasmLevel 0.583 1.946 1
## DogOwner 0.022 0.383 1
## SarcasmLevel:DogOwner 0.239 1.246 1
## ...4 NA NA NA
## 
## Measures of overall model fit
## # A tibble: 1 x 5
## logLik AIC BIC deviance nobs
## <dbl> <dbl> <dbl> <dbl> <int>
## 1 -1205. 2425. 2455. 1953. 600
## 
## Table of group means
## # A tibble: 6 x 15
## # Groups: SarcasmLevel [3]
## SarcasmLevel DogOwner TheMean TheSD TheSEM CIMuliplier LowerBoundCI
## <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 27.2 2.07 0.208 1.98 26.7
## 2 1 2 19.4 1.68 0.169 1.98 19.1
## 3 2 1 17.2 1.72 0.171 1.98 16.9
## 4 2 2 18.3 1.85 0.184 1.98 18.0
## 5 3 1 13.6 1.69 0.169 1.98 13.3
## 6 3 2 16.0 1.84 0.184 1.98 15.6
## # ... with 8 more variables: UpperBoundCI <dbl>, LowerBoundSEM <dbl>,
## # UpperBoundSEM <dbl>, LowerBoundSD <dbl>, UpperBoundSD <dbl>, N <int>,
## # LowerBound <dbl>, UpperBound <dbl>
## 
## Post hoc tests for all effects that were significant
## 
## Posthoc multiple comparisons of means : Bonferroni
## 95% family-wise confidence level
##
## $SarcasmLevel
## diff lwr.ci upr.ci pval
## 2-1 -5.515602 -5.950898 -5.080305 <2e-16 ***
## 3-1 -8.497879 -8.934252 -8.061506 <2e-16 ***
## 3-2 -2.982277 -3.416474 -2.548081 <2e-16 ***
##
## $DogOwner
## diff lwr.ci upr.ci pval
## 2-1 -1.383333 -1.67407 -1.092597 <2e-16 ***
##
## $`SarcasmLevel:DogOwner`
## diff lwr.ci upr.ci pval
## 2:1-1:1 -9.953695 -10.7093900 -9.1980007 < 2e-16 ***
## 3:1-1:1 -13.561616 -14.3191789 -12.8040535 < 2e-16 ***
## 1:2-1:1 -7.747475 -8.5069385 -6.9880110 < 2e-16 ***
## 2:2-1:1 -8.824982 -9.5806772 -8.0692878 < 2e-16 ***
## 3:2-1:1 -11.181616 -11.9391789 -10.4240535 < 2e-16 ***
## 3:1-2:1 -3.607921 -4.3617049 -2.8541367 < 2e-16 ***
## 1:2-2:1 2.206221 1.4505260 2.9619153 1e-15 ***
## 2:2-2:1 1.128713 0.3768062 1.8806196 0.00017 ***
## 3:2-2:1 -1.227921 -1.9817049 -0.4741367 3e-05 ***
## 1:2-3:1 5.814141 5.0565787 6.5717041 < 2e-16 ***
## 2:2-3:1 4.736634 3.9828495 5.4904178 < 2e-16 ***
## 3:2-3:1 2.380000 1.6243431 3.1356569 < 2e-16 ***
## 2:2-1:2 -1.077508 -1.8332024 -0.3218131 0.00046 ***
## 3:2-1:2 -3.434141 -4.1917041 -2.6765787 < 2e-16 ***
## 3:2-2:2 -2.356634 -3.1104178 -1.6028495 < 2e-16 ***
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Homogeneity of Variance with Brown-Forsythe
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 1.4728 0.1967
## 594
## 
## Testing Normality Assumption with Shapiro-Wilk
##    *** Possible violation of the assumption.  You may 
## want to plot the residuals to see how they vary from normal ***
## 
## Shapiro-Wilk normality test
##
## data: MyAOV_residuals
## W = 0.973, p-value = 4.585e-09
## 
## Interaction graph plotted...

Plot2WayANOVA(Cynicism~SarcasmLevel*DogOwner, 
dataframe = man2way,
confidence=.95,
plottype = "line",
xlab = "Sarcasm Level",
ylab = "Cynicism",
title = NULL,
subtitle = NULL,
interact.line.size = 1,
ci.line.size = 1,
mean.label = FALSE,
mean.ci = TRUE,
mean.size = 1,
mean.shape = 16,
mean.color = "darkred",
mean.label.size = 3,
mean.label.color = "black",
offset.style = "none",
overlay.type = NULL,
posthoc.method = "bonferroni",
show.dots = FALSE,
PlotSave = FALSE)
## 
## --- WARNING! ---
## You have an unbalanced design. Using Type II sum of
## squares, to calculate factor effect sizes eta and omega.
## Your two factors account for 0.877 of the type II sum of
## squares.
##                                        term    sumsq   meansq  df statistic
## SarcasmLevel SarcasmLevel 4131.405 2065.703 2 781.795
## DogOwner DogOwner 4363.207 4363.207 1 1651.318
## SarcasmLevel:DogOwner SarcasmLevel:DogOwner 2654.927 1327.463 2 502.397
## ...4 Residuals 1569.501 2.642 594 NA
## p.value etasq partial.etasq omegasq partial.omegasq
## SarcasmLevel 0 0.325 0.725 0.324 0.722
## DogOwner 0 0.343 0.735 0.343 0.733
## SarcasmLevel:DogOwner 0 0.209 0.628 0.208 0.626
## ...4 NA NA NA NA NA
## epsilonsq cohens.f power
## SarcasmLevel 0.324 1.622 1
## DogOwner 0.343 1.667 1
## SarcasmLevel:DogOwner 0.208 1.301 1
## ...4 NA NA NA
## 
## Measures of overall model fit
## # A tibble: 1 x 5
## logLik AIC BIC deviance nobs
## <dbl> <dbl> <dbl> <dbl> <int>
## 1 -1140. 2294. 2324. 1570. 600
## 
## Table of group means
## # A tibble: 6 x 15
## # Groups: SarcasmLevel [3]
## SarcasmLevel DogOwner TheMean TheSD TheSEM CIMuliplier LowerBoundCI
## <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 12.5 2.01 0.202 1.98 12.1
## 2 1 2 12.2 1.65 0.166 1.98 11.9
## 3 2 1 10.5 1.20 0.119 1.98 10.3
## 4 2 2 20.3 1.72 0.171 1.98 20.0
## 5 3 1 15.5 1.72 0.172 1.98 15.2
## 6 3 2 22.1 1.34 0.134 1.98 21.8
## # ... with 8 more variables: UpperBoundCI <dbl>, LowerBoundSEM <dbl>,
## # UpperBoundSEM <dbl>, LowerBoundSD <dbl>, UpperBoundSD <dbl>, N <int>,
## # LowerBound <dbl>, UpperBound <dbl>
## 
## Post hoc tests for all effects that were significant
## 
## Posthoc multiple comparisons of means : Bonferroni
## 95% family-wise confidence level
##
## $SarcasmLevel
## diff lwr.ci upr.ci pval
## 2-1 3.087059 2.696792 3.477326 <2e-16 ***
## 3-1 6.441465 6.050233 6.832696 <2e-16 ***
## 3-2 3.354406 2.965126 3.743686 <2e-16 ***
##
## $DogOwner
## diff lwr.ci upr.ci pval
## 2-1 5.393333 5.132672 5.653994 <2e-16 ***
##
## $`SarcasmLevel:DogOwner`
## diff lwr.ci upr.ci pval
## 2:1-1:1 -1.9604960 -2.6380166 -1.2829755 1.9e-15 ***
## 3:1-1:1 2.9949495 2.3157542 3.6741448 < 2e-16 ***
## 1:2-1:1 -0.3030303 -0.9839300 0.3778694 1.0000
## 2:2-1:1 7.8315832 7.1540626 8.5091037 < 2e-16 ***
## 3:2-1:1 9.5849495 8.9057542 10.2641448 < 2e-16 ***
## 3:1-2:1 4.9554455 4.2796379 5.6312532 < 2e-16 ***
## 1:2-2:1 1.6574657 0.9799452 2.3349863 2.6e-11 ***
## 2:2-2:1 9.7920792 9.1179548 10.4662036 < 2e-16 ***
## 3:2-2:1 11.5454455 10.8696379 12.2212532 < 2e-16 ***
## 1:2-3:1 -3.2979798 -3.9771751 -2.6187845 < 2e-16 ***
## 2:2-3:1 4.8366337 4.1608260 5.5124413 < 2e-16 ***
## 3:2-3:1 6.5900000 5.9125133 7.2674867 < 2e-16 ***
## 2:2-1:2 8.1346135 7.4570929 8.8121340 < 2e-16 ***
## 3:2-1:2 9.8879798 9.2087845 10.5671751 < 2e-16 ***
## 3:2-2:2 1.7533663 1.0775587 2.4291740 1.3e-12 ***
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Homogeneity of Variance with Brown-Forsythe
##    *** Possible violation of the assumption ***
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 7.0378 2.102e-06 ***
## 594
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Normality Assumption with Shapiro-Wilk
##    *** Possible violation of the assumption.  You may 
## want to plot the residuals to see how they vary from normal ***
## 
## Shapiro-Wilk normality test
##
## data: MyAOV_residuals
## W = 0.98362, p-value = 2.892e-06
## 
## Interaction graph plotted...

Plot2WayANOVA(Conservatism~SarcasmLevel*DogOwner, 
dataframe = man2way,
confidence=.95,
plottype = "line",
xlab = "Sarcasm Level",
ylab = "Conservatism",
title = NULL,
subtitle = NULL,
interact.line.size = 1,
ci.line.size = 1,
mean.label = FALSE,
mean.ci = TRUE,
mean.size = 1,
mean.shape = 16,
mean.color = "darkred",
mean.label.size = 3,
mean.label.color = "black",
offset.style = "none",
overlay.type = NULL,
posthoc.method = "bonferroni",
show.dots = FALSE,
PlotSave = FALSE)
## 
## --- WARNING! ---
## You have an unbalanced design. Using Type II sum of
## squares, to calculate factor effect sizes eta and omega.
## Your two factors account for 0.586 of the type II sum of
## squares.
##                                        term    sumsq   meansq  df statistic
## SarcasmLevel SarcasmLevel 2469.204 1234.602 2 399.676
## DogOwner DogOwner 123.307 123.307 1 39.918
## SarcasmLevel:DogOwner SarcasmLevel:DogOwner 5.359 2.679 2 0.867
## ...4 Residuals 1834.870 3.089 594 NA
## p.value etasq partial.etasq omegasq partial.omegasq
## SarcasmLevel 0.000 0.557 0.574 0.555 0.571
## DogOwner 0.000 0.028 0.063 0.027 0.061
## SarcasmLevel:DogOwner 0.421 0.001 0.003 0.000 0.000
## ...4 NA NA NA NA NA
## epsilonsq cohens.f power
## SarcasmLevel 0.556 1.160 1.0
## DogOwner 0.027 0.259 1.0
## SarcasmLevel:DogOwner 0.000 0.054 0.2
## ...4 NA NA NA
## 
## Measures of overall model fit
## # A tibble: 1 x 5
## logLik AIC BIC deviance nobs
## <dbl> <dbl> <dbl> <dbl> <int>
## 1 -1187. 2387. 2418. 1835. 600
## 
## Table of group means
## # A tibble: 6 x 15
## # Groups: SarcasmLevel [3]
## SarcasmLevel DogOwner TheMean TheSD TheSEM CIMuliplier LowerBoundCI
## <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 17.1 2.01 0.202 1.98 16.7
## 2 1 2 16.2 1.57 0.158 1.98 15.9
## 3 2 1 18.8 1.89 0.188 1.98 18.4
## 4 2 2 17.7 2.08 0.207 1.98 17.3
## 5 3 1 13.7 1.54 0.154 1.98 13.4
## 6 3 2 13.1 1.31 0.131 1.98 12.8
## # ... with 8 more variables: UpperBoundCI <dbl>, LowerBoundSEM <dbl>,
## # UpperBoundSEM <dbl>, LowerBoundSD <dbl>, UpperBoundSD <dbl>, N <int>,
## # LowerBound <dbl>, UpperBound <dbl>
## 
## Post hoc tests for all effects that were significant
## 
## Posthoc multiple comparisons of means : Bonferroni
## 95% family-wise confidence level
##
## $SarcasmLevel
## diff lwr.ci upr.ci pval
## 2-1 1.605811 1.183839 2.027782 <2e-16 ***
## 3-1 -3.261566 -3.684581 -2.838551 <2e-16 ***
## 3-2 -4.867376 -5.288281 -4.446471 <2e-16 ***
##
## $DogOwner
## diff lwr.ci upr.ci pval
## 2-1 -0.9066667 -1.188503 -0.6248299 5.2e-10 ***
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Homogeneity of Variance with Brown-Forsythe
##    *** Possible violation of the assumption ***
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 7.1384 1.689e-06 ***
## 594
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Normality Assumption with Shapiro-Wilk
##    *** Possible violation of the assumption.  You may 
## want to plot the residuals to see how they vary from normal ***
## 
## Shapiro-Wilk normality test
##
## data: MyAOV_residuals
## W = 0.98734, p-value = 4.62e-05
## 
## Interaction graph plotted...

Plot2WayANOVA(Hypertensive~SarcasmLevel*DogOwner, 
dataframe = man2way,
confidence=.95,
plottype = "line",
xlab = "Sarcasm Level",
ylab = "Hypertensive",
title = NULL,
subtitle = NULL,
interact.line.size = 1,
ci.line.size = 1,
mean.label = FALSE,
mean.ci = TRUE,
mean.size = 1,
mean.shape = 16,
mean.color = "darkred",
mean.label.size = 3,
mean.label.color = "black",
offset.style = "none",
overlay.type = NULL,
posthoc.method = "bonferroni",
show.dots = FALSE,
PlotSave = FALSE)
## 
## --- WARNING! ---
## You have an unbalanced design. Using Type II sum of
## squares, to calculate factor effect sizes eta and omega.
## Your two factors account for 0.862 of the type II sum of
## squares.
##                                        term     sumsq   meansq  df statistic
## SarcasmLevel SarcasmLevel 10418.456 5209.228 2 1443.243
## DogOwner DogOwner 92.827 92.827 1 25.718
## SarcasmLevel:DogOwner SarcasmLevel:DogOwner 2905.913 1452.956 2 402.549
## ...4 Residuals 2143.978 3.609 594 NA
## p.value etasq partial.etasq omegasq partial.omegasq
## SarcasmLevel 0 0.670 0.829 0.669 0.828
## DogOwner 0 0.006 0.041 0.006 0.040
## SarcasmLevel:DogOwner 0 0.187 0.575 0.186 0.572
## ...4 NA NA NA NA NA
## epsilonsq cohens.f power
## SarcasmLevel 0.669 2.204 1.000
## DogOwner 0.006 0.208 0.999
## SarcasmLevel:DogOwner 0.186 1.164 1.000
## ...4 NA NA NA
## 
## Measures of overall model fit
## # A tibble: 1 x 5
## logLik AIC BIC deviance nobs
## <dbl> <dbl> <dbl> <dbl> <int>
## 1 -1233. 2481. 2512. 2144. 600
## 
## Table of group means
## # A tibble: 6 x 15
## # Groups: SarcasmLevel [3]
## SarcasmLevel DogOwner TheMean TheSD TheSEM CIMuliplier LowerBoundCI
## <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 10.7 1.92 0.193 1.98 10.3
## 2 1 2 13.1 1.89 0.190 1.98 12.8
## 3 2 1 17.9 1.97 0.196 1.98 17.5
## 4 2 2 20.1 1.93 0.192 1.98 19.7
## 5 3 1 25.4 2.22 0.222 1.98 24.9
## 6 3 2 18.4 1.36 0.136 1.98 18.1
## # ... with 8 more variables: UpperBoundCI <dbl>, LowerBoundSEM <dbl>,
## # UpperBoundSEM <dbl>, LowerBoundSD <dbl>, UpperBoundSD <dbl>, N <int>,
## # LowerBound <dbl>, UpperBound <dbl>
## 
## Post hoc tests for all effects that were significant
## 
## Posthoc multiple comparisons of means : Bonferroni
## 95% family-wise confidence level
##
## $SarcasmLevel
## diff lwr.ci upr.ci pval
## 2-1 7.056156 6.600023 7.512288 <2e-16 ***
## 3-1 9.950859 9.493599 10.408119 <2e-16 ***
## 3-2 2.894703 2.439724 3.349682 <2e-16 ***
##
## $DogOwner
## diff lwr.ci upr.ci pval
## 2-1 -0.7866667 -1.091319 -0.4820139 5.3e-07 ***
##
## $`SarcasmLevel:DogOwner`
## diff lwr.ci upr.ci pval
## 2:1-1:1 7.1644164 6.3725503 7.9562826 < 2e-16 ***
## 3:1-1:1 14.6730303 13.8792067 15.4668539 < 2e-16 ***
## 1:2-1:1 2.4343434 1.6385278 3.2301591 < 2e-16 ***
## 2:2-1:1 9.3822382 8.5903720 10.1741044 < 2e-16 ***
## 3:2-1:1 7.6630303 6.8692067 8.4568539 < 2e-16 ***
## 3:1-2:1 7.5086139 6.7187497 8.2984781 < 2e-16 ***
## 1:2-2:1 -4.7300730 -5.5219392 -3.9382068 < 2e-16 ***
## 2:2-2:1 2.2178218 1.4299249 3.0057187 1.1e-14 ***
## 3:2-2:1 0.4986139 -0.2912503 1.2884781 0.9498
## 1:2-3:1 -12.2386869 -13.0325105 -11.4448632 < 2e-16 ***
## 2:2-3:1 -5.2907921 -6.0806563 -4.5009279 < 2e-16 ***
## 3:2-3:1 -7.0100000 -7.8018266 -6.2181734 < 2e-16 ***
## 2:2-1:2 6.9478948 6.1560286 7.7397610 < 2e-16 ***
## 3:2-1:2 5.2286869 4.4348632 6.0225105 < 2e-16 ***
## 3:2-2:2 -1.7192079 -2.5090721 -0.9293437 4.3e-09 ***
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Homogeneity of Variance with Brown-Forsythe
##    *** Possible violation of the assumption ***
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 5.6526 4.202e-05 ***
## 594
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Normality Assumption with Shapiro-Wilk
##    *** Possible violation of the assumption.  You may 
## want to plot the residuals to see how they vary from normal ***
## 
## Shapiro-Wilk normality test
##
## data: MyAOV_residuals
## W = 0.96612, p-value = 1.527e-10
## 
## Interaction graph plotted...

Plot2WayANOVA(Funny~SarcasmLevel*DogOwner, 
dataframe = man2way,
confidence=.95,
plottype = "line",
xlab = "Sarcasm Level",
ylab = "Funny",
title = NULL,
subtitle = NULL,
interact.line.size = 1,
ci.line.size = 1,
mean.label = FALSE,
mean.ci = TRUE,
mean.size = 1,
mean.shape = 16,
mean.color = "darkred",
mean.label.size = 3,
mean.label.color = "black",
offset.style = "none",
overlay.type = NULL,
posthoc.method = "bonferroni",
show.dots = FALSE,
PlotSave = FALSE)
## 
## --- WARNING! ---
## You have an unbalanced design. Using Type II sum of
## squares, to calculate factor effect sizes eta and omega.
## Your two factors account for 0.948 of the type II sum of
## squares.
##                                        term     sumsq    meansq  df statistic
## SarcasmLevel SarcasmLevel 35430.524 17715.262 2 5006.860
## DogOwner DogOwner 388.815 388.815 1 109.891
## SarcasmLevel:DogOwner SarcasmLevel:DogOwner 2538.930 1269.465 2 358.789
## ...4 Residuals 2101.689 3.538 594 NA
## p.value etasq partial.etasq omegasq partial.omegasq
## SarcasmLevel 0 0.876 0.944 0.875 0.943
## DogOwner 0 0.010 0.156 0.010 0.154
## SarcasmLevel:DogOwner 0 0.063 0.547 0.063 0.544
## ...4 NA NA NA NA NA
## epsilonsq cohens.f power
## SarcasmLevel 0.876 4.106 1
## DogOwner 0.010 0.430 1
## SarcasmLevel:DogOwner 0.063 1.099 1
## ...4 NA NA NA
## 
## Measures of overall model fit
## # A tibble: 1 x 5
## logLik AIC BIC deviance nobs
## <dbl> <dbl> <dbl> <dbl> <int>
## 1 -1227. 2469. 2500. 2102. 600
## 
## Table of group means
## # A tibble: 6 x 15
## # Groups: SarcasmLevel [3]
## SarcasmLevel DogOwner TheMean TheSD TheSEM CIMuliplier LowerBoundCI
## <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 5.23 1.81 0.182 1.98 4.87
## 2 1 2 3.30 1.82 0.183 1.98 2.94
## 3 2 1 12.8 1.67 0.166 1.98 12.4
## 4 2 2 12.1 2.18 0.217 1.98 11.7
## 5 3 1 19.4 1.58 0.158 1.98 19.1
## 6 3 2 26.8 2.14 0.214 1.98 26.3
## # ... with 8 more variables: UpperBoundCI <dbl>, LowerBoundSEM <dbl>,
## # UpperBoundSEM <dbl>, LowerBoundSD <dbl>, UpperBoundSD <dbl>, N <int>,
## # LowerBound <dbl>, UpperBound <dbl>
## 
## Post hoc tests for all effects that were significant
## 
## Posthoc multiple comparisons of means : Bonferroni
## 95% family-wise confidence level
##
## $SarcasmLevel
## diff lwr.ci upr.ci pval
## 2-1 8.177868 7.726256 8.629479 <2e-16 ***
## 3-1 18.812323 18.359595 19.265051 <2e-16 ***
## 3-2 10.634455 10.183986 11.084925 <2e-16 ***
##
## $DogOwner
## diff lwr.ci upr.ci pval
## 2-1 1.61 1.308367 1.911633 <2e-16 ***
##
## $`SarcasmLevel:DogOwner`
## diff lwr.ci upr.ci pval
## 2:1-1:1 7.5300530 6.746035 8.3140708 < 2e-16 ***
## 3:1-1:1 14.1576768 13.371721 14.9436326 < 2e-16 ***
## 1:2-1:1 -1.9292929 -2.717221 -1.1413648 2.5e-11 ***
## 2:2-1:1 6.8963896 6.112372 7.6804075 < 2e-16 ***
## 3:2-1:1 21.5376768 20.751721 22.3236326 < 2e-16 ***
## 3:1-2:1 6.6276238 5.845588 7.4096594 < 2e-16 ***
## 1:2-2:1 -9.4593459 -10.243364 -8.6753281 < 2e-16 ***
## 2:2-2:1 -0.6336634 -1.413751 0.1464245 0.2547
## 3:2-2:1 14.0076238 13.225588 14.7896594 < 2e-16 ***
## 1:2-3:1 -16.0869697 -16.872926 -15.3010138 < 2e-16 ***
## 2:2-3:1 -7.2612871 -8.043323 -6.4792515 < 2e-16 ***
## 3:2-3:1 7.3800000 6.596021 8.1639786 < 2e-16 ***
## 2:2-1:2 8.8256826 8.041665 9.6097004 < 2e-16 ***
## 3:2-1:2 23.4669697 22.681014 24.2529256 < 2e-16 ***
## 3:2-2:2 14.6412871 13.859251 15.4233228 < 2e-16 ***
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Homogeneity of Variance with Brown-Forsythe
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 1.2835 0.2693
## 594
## 
## Testing Normality Assumption with Shapiro-Wilk
##
## *** Possible violation of the assumption. You may
## want to plot the residuals to see how they vary from normal ***
## 
## Shapiro-Wilk normality test
##
## data: MyAOV_residuals
## W = 0.95368, p-value = 8.706e-13
## 
## Interaction graph plotted...

Plot2WayANOVA(Honest~SarcasmLevel*DogOwner, 
dataframe = man2way,
confidence=.95,
plottype = "line",
xlab = "Sarcasm Level",
ylab = "Honest",
title = NULL,
subtitle = NULL,
interact.line.size = 1,
ci.line.size = 1,
mean.label = FALSE,
mean.ci = TRUE,
mean.size = 1,
mean.shape = 16,
mean.color = "darkred",
mean.label.size = 3,
mean.label.color = "black",
offset.style = "none",
overlay.type = NULL,
posthoc.method = "bonferroni",
show.dots = FALSE,
PlotSave = FALSE)
## 
## --- WARNING! ---
## You have an unbalanced design. Using Type II sum of
## squares, to calculate factor effect sizes eta and omega.
## Your two factors account for 0.756 of the type II sum of
## squares.
##                                        term    sumsq   meansq  df statistic
## SarcasmLevel SarcasmLevel 272.698 136.349 2 51.908
## DogOwner DogOwner 506.002 506.002 1 192.633
## SarcasmLevel:DogOwner SarcasmLevel:DogOwner 4047.404 2023.702 2 770.418
## ...4 Residuals 1560.295 2.627 594 NA
## p.value etasq partial.etasq omegasq partial.omegasq
## SarcasmLevel 0 0.043 0.149 0.042 0.145
## DogOwner 0 0.079 0.245 0.079 0.242
## SarcasmLevel:DogOwner 0 0.634 0.722 0.633 0.719
## ...4 NA NA NA NA NA
## epsilonsq cohens.f power
## SarcasmLevel 0.042 0.418 1
## DogOwner 0.079 0.569 1
## SarcasmLevel:DogOwner 0.633 1.611 1
## ...4 NA NA NA
## 
## Measures of overall model fit
## # A tibble: 1 x 5
## logLik AIC BIC deviance nobs
## <dbl> <dbl> <dbl> <dbl> <int>
## 1 -1138. 2290. 2321. 1560. 600
## 
## Table of group means
## # A tibble: 6 x 15
## # Groups: SarcasmLevel [3]
## SarcasmLevel DogOwner TheMean TheSD TheSEM CIMuliplier LowerBoundCI
## <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 20.7 1.68 0.169 1.98 20.4
## 2 1 2 16.1 1.85 0.186 1.98 15.8
## 3 2 1 17.5 1.50 0.149 1.98 17.2
## 4 2 2 19.4 1.58 0.157 1.98 19.1
## 5 3 1 12.9 1.73 0.173 1.98 12.6
## 6 3 2 21.1 1.34 0.134 1.98 20.8
## # ... with 8 more variables: UpperBoundCI <dbl>, LowerBoundSEM <dbl>,
## # UpperBoundSEM <dbl>, LowerBoundSD <dbl>, UpperBoundSD <dbl>, N <int>,
## # LowerBound <dbl>, UpperBound <dbl>
## 
## Post hoc tests for all effects that were significant
## 
## Posthoc multiple comparisons of means : Bonferroni
## 95% family-wise confidence level
##
## $SarcasmLevel
## diff lwr.ci upr.ci pval
## 2-1 0.02110211 -0.3680186 0.4102228 1.0000
## 3-1 -1.41934343 -1.8094260 -1.0292609 <2e-16 ***
## 3-2 -1.44044554 -1.8285824 -1.0523087 <2e-16 ***
##
## $DogOwner
## diff lwr.ci upr.ci pval
## 2-1 1.836667 1.576771 2.096562 <2e-16 ***
##
## $`SarcasmLevel:DogOwner`
## diff lwr.ci upr.ci pval
## 2:1-1:1 -3.2025203 -3.8780509 -2.5269896 < 2e-16 ***
## 3:1-1:1 -7.7972727 -8.4744733 -7.1200722 < 2e-16 ***
## 1:2-1:1 -4.5858586 -5.2647585 -3.9069587 < 2e-16 ***
## 2:2-1:1 -1.3411341 -2.0166648 -0.6656035 1.2e-07 ***
## 3:2-1:1 0.3727273 -0.3044733 1.0499278 1.0000
## 3:1-2:1 -4.5947525 -5.2685752 -3.9209297 < 2e-16 ***
## 1:2-2:1 -1.3833383 -2.0588690 -0.7078077 4.2e-08 ***
## 2:2-2:1 1.8613861 1.1892416 2.5335306 3.0e-14 ***
## 3:2-2:1 3.5752475 2.9014248 4.2490703 < 2e-16 ***
## 1:2-3:1 3.2114141 2.5342136 3.8886147 < 2e-16 ***
## 2:2-3:1 6.4561386 5.7823158 7.1299614 < 2e-16 ***
## 3:2-3:1 8.1700000 7.4945031 8.8454969 < 2e-16 ***
## 2:2-1:2 3.2447245 2.5691938 3.9202551 < 2e-16 ***
## 3:2-1:2 4.9585859 4.2813853 5.6357864 < 2e-16 ***
## 3:2-2:2 1.7138614 1.0400386 2.3876842 3.6e-12 ***
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Homogeneity of Variance with Brown-Forsythe
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 5 1.9276 0.0879 .
## 594
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Testing Normality Assumption with Shapiro-Wilk
##
## *** Possible violation of the assumption. You may
## want to plot the residuals to see how they vary from normal ***
## 
## Shapiro-Wilk normality test
##
## data: MyAOV_residuals
## W = 0.99474, p-value = 0.03748
## 
## Interaction graph plotted...

#Partial eta squared
# For omnibus manova
library(heplots)
manfit <- manova(Y ~ man2way$SarcasmLevel*man2way$DogOwner)
etasq(Anova(manfit));
##                                           eta^2
## man2way$SarcasmLevel 0.7939056
## man2way$DogOwner 0.8437983
## man2way$SarcasmLevel:man2way$DogOwner 0.7977128
# For individual DVs
library(lsr)
## 
## Attaching package: 'lsr'
## The following object is masked from 'package:corrr':
##
## correlate
names(man2way)
##  [1] "ï..const"     "ID"           "DogOwner"     "SarcasmLevel" "Trust"       
## [6] "Cynicism" "Conservatism" "Hypertensive" "Funny" "Honest"
Trustaov<-aov(man2way$Trust~man2way$SarcasmLevel*man2way$DogOwner)
Cynicaov<-aov(man2way$Cynicism~man2way$SarcasmLevel*man2way$DogOwner)
Conservaov<-aov(man2way$Conservatism~man2way$SarcasmLevel*man2way$DogOwner)
Hyperaov<-aov(man2way$Hypertensive~man2way$SarcasmLevel*man2way$DogOwner)
Funnyaov<-aov(man2way$Funny~man2way$SarcasmLevel*man2way$DogOwner)
Honestaov<-aov(man2way$Honest~man2way$SarcasmLevel*man2way$DogOwner)

etaSquared(Trustaov, type = 3, anova = TRUE )
##                                          eta.sq eta.sq.part       SS  df
## man2way$SarcasmLevel 0.7746027 0.8339966 9809.722 2
## man2way$DogOwner 0.2346107 0.6034350 2971.157 1
## man2way$SarcasmLevel:man2way$DogOwner 0.2393891 0.6082498 3031.672 2
## Residuals 0.1541813 NA 1952.582 594
## MS F p
## man2way$SarcasmLevel 4904.861098 1492.1201 0
## man2way$DogOwner 2971.156566 903.8630 0
## man2way$SarcasmLevel:man2way$DogOwner 1515.835766 461.1362 0
## Residuals 3.287176 NA NA
etaSquared(Cynicaov, type = 3, anova = TRUE )
##                                            eta.sq eta.sq.part          SS  df
## man2way$SarcasmLevel 0.098343876 0.443506587 1250.839687 2
## man2way$DogOwner 0.000357374 0.002887751 4.545455 1
## man2way$SarcasmLevel:man2way$DogOwner 0.208736426 0.628470165 2654.926956 2
## Residuals 0.123397759 NA 1569.501031 594
## MS F p
## man2way$SarcasmLevel 625.419843 236.699040 0.0000000
## man2way$DogOwner 4.545455 1.720292 0.1901622
## man2way$SarcasmLevel:man2way$DogOwner 1327.463478 502.397444 0.0000000
## Residuals 2.642258 NA NA
etaSquared(Conservaov, type = 3, anova = TRUE )
##                                            eta.sq eta.sq.part          SS  df
## man2way$SarcasmLevel 0.305046252 0.424275165 1352.190722 2
## man2way$DogOwner 0.010500380 0.024739594 46.545455 1
## man2way$SarcasmLevel:man2way$DogOwner 0.001208922 0.002912049 5.358837 2
## Residuals 0.413935855 NA 1834.870020 594
## MS F p
## man2way$SarcasmLevel 676.095361 218.8714405 0.0000000000
## man2way$DogOwner 46.545455 15.0680973 0.0001153234
## man2way$SarcasmLevel:man2way$DogOwner 2.679419 0.8674046 0.4205716534
## Residuals 3.089007 NA NA
etaSquared(Hyperaov, type = 3, anova = TRUE )
##                                           eta.sq eta.sq.part         SS  df
## man2way$SarcasmLevel 0.68849060 0.8332534 10713.7215 2
## man2way$DogOwner 0.01885066 0.1203530 293.3384 1
## man2way$SarcasmLevel:man2way$DogOwner 0.18674124 0.5754407 2905.9128 2
## Residuals 0.13777738 NA 2143.9778 594
## MS F p
## man2way$SarcasmLevel 5356.86075 1484.1457 0
## man2way$DogOwner 293.33838 81.2709 0
## man2way$SarcasmLevel:man2way$DogOwner 1452.95638 402.5490 0
## Residuals 3.60939 NA NA
etaSquared(Funnyaov, type = 3, anova = TRUE )
##                                            eta.sq eta.sq.part        SS  df
## man2way$SarcasmLevel 0.246742792 0.82608952 9983.2031 2
## man2way$DogOwner 0.004553823 0.08060042 184.2475 1
## man2way$SarcasmLevel:man2way$DogOwner 0.062751664 0.54711012 2538.9297 2
## Residuals 0.051944923 NA 2101.6894 594
## MS F p
## man2way$SarcasmLevel 4991.601536 1410.77520 0.0000e+00
## man2way$DogOwner 184.247475 52.07382 1.6388e-12
## man2way$SarcasmLevel:man2way$DogOwner 1269.464851 358.78856 0.0000e+00
## Residuals 3.538198 NA NA
etaSquared(Honestaov, type = 3, anova = TRUE )
##                                          eta.sq eta.sq.part       SS  df
## man2way$SarcasmLevel 0.4789735 0.6622160 3058.916 2
## man2way$DogOwner 0.1630011 0.4001829 1040.990 1
## man2way$SarcasmLevel:man2way$DogOwner 0.6337537 0.7217584 4047.404 2
## Residuals 0.2443154 NA 1560.295 594
## MS F p
## man2way$SarcasmLevel 1529.45776 582.2602 0
## man2way$DogOwner 1040.98990 396.3019 0
## man2way$SarcasmLevel:man2way$DogOwner 2023.70176 770.4175 0
## Residuals 2.62676 NA NA