1. Run libraries and import dataset.
## Run libraries
packages <- c("dplyr",
              "psych",
              "ggplot2",
              "biotools",
              "REdaS",
              "mvShapiroTest",
              "heplots",
              "sjstats",
              "agricolae")
installed <- packages %in% rownames(installed.packages())
if (any(!installed)) {
  install.packages(packages[!installed])
}
lapply(packages, library, character.only = TRUE)
## Warning in rgl.init(initValue, onlyNULL): X11 error: GLXBadContext
## Warning: 'rgl.init' failed, will use the null device.
## See '?rgl.useNULL' for ways to avoid this warning.
## Import dataset
url <- "https://github.com/JasonMHoskin/quant632-assignment2/raw/refs/heads/main/data_assn2.rda"
download.file(url, destfile = "file.RDA", mode = "wb")
load("file.RDA")
df1 <- assn2

## Remove unnecessary variables
rm(installed, packages, url)
  1. Recode IV (WORKSTAT): 0 = homemakers, 1 = working women
## Recode
df1$workstat <- ifelse(df1$workstat == 1, 1, 0)

## Verify recoding is accurate
df1 |>
  group_by(workstat) |>
  count(workstat)
## # A tibble: 2 × 2
## # Groups:   workstat [2]
##   workstat     n
##      <dbl> <int>
## 1        0   137
## 2        1   244
assn2 |>
  group_by(workstat) |>
  count(workstat)
## # A tibble: 2 × 2
## # Groups:   workstat [2]
##   workstat       n
##   <hvn_lbll> <int>
## 1 1            244
## 2 2            137
  1. Generate “grouping” variable (The number 1 should be assigned to working women without children, 2 to working women with children, 3 to homemakers without children, and 4 to homemakers with children) and sort cases by the “grouping” variable.
## Make IVs factors
df1$workstat <- as.factor(df1$workstat)
df1$children <- as.factor(df1$children)

## Generate grouping variable
df1 <- df1 |>
  mutate(
    grouping = case_when(
      df1$workstat == 0 & df1$children == 0 ~ 1L,
      df1$workstat == 1 & df1$children == 0 ~ 2L,
      df1$workstat == 0 & df1$children == 1 ~ 3L,
      df1$workstat == 1 & df1$children == 1 ~ 4L,
      TRUE ~ NA_integer_
    )
  )
df1$grouping <- as.factor(df1$grouping)
df1 <- arrange(df1, grouping)
head(df1)
##   subno workstat children control attmar attrole atthouse grouping
## 1     4        0        0       6     24      31       28        1
## 2     7        0        0       6     27      44       30        1
## 3     8        0        0       8     18      48       24        1
## 4    12        0        0       6     16      45       22        1
## 5    14        0        0       6     20      45       25        1
## 6    23        0        0       6     21      30       28        1
  1. Run frequencies for DVs based on the grouping variable.
describeBy(df1, group = df1$grouping)
## 
##  Descriptive statistics by group 
## group: 1
##          vars  n   mean     sd median trimmed    mad min max range  skew
## subno       1 49 327.53 245.35    280  318.95 324.69   4 757   753  0.27
## workstat    2 49   1.00   0.00      1    1.00   0.00   1   1     0   NaN
## children    3 49   1.00   0.00      1    1.00   0.00   1   1     0   NaN
## control     4 49   6.80   1.41      7    6.71   1.48   5  10     5  0.57
## attmar      5 49  20.61   5.86     20   20.12   5.93  12  35    23  0.76
## attrole     6 49  37.16   6.66     37   37.29   7.41  24  49    25 -0.11
## atthouse    7 49  22.80   4.09     23   22.80   4.45  14  31    17  0.00
## grouping    8 49   1.00   0.00      1    1.00   0.00   1   1     0   NaN
##          kurtosis    se
## subno       -1.34 35.05
## workstat      NaN  0.00
## children      NaN  0.00
## control     -0.64  0.20
## attmar       0.05  0.84
## attrole     -1.00  0.95
## atthouse    -0.75  0.58
## grouping      NaN  0.00
## ------------------------------------------------------------ 
## group: 2
##          vars  n   mean     sd median trimmed    mad min max range  skew
## subno       1 55 339.51 179.14    359  336.36 220.91  65 690   625  0.01
## workstat    2 55   2.00   0.00      2    2.00   0.00   2   2     0   NaN
## children    3 55   1.00   0.00      1    1.00   0.00   1   1     0   NaN
## control     4 55   6.75   1.44      7    6.62   1.48   5  10     5  0.62
## attmar      5 53  24.57   8.22     25   24.51   7.41  11  44    33  0.15
## attrole     6 55  31.24   6.34     31   31.24   5.93  18  43    25  0.04
## atthouse    7 54  23.54   4.41     24   23.57   5.19  14  33    19 -0.09
## grouping    8 55   2.00   0.00      2    2.00   0.00   2   2     0   NaN
##          kurtosis    se
## subno       -1.25 24.16
## workstat      NaN  0.00
## children      NaN  0.00
## control     -0.50  0.19
## attmar      -0.94  1.13
## attrole     -0.87  0.85
## atthouse    -0.95  0.60
## grouping      NaN  0.00
## ------------------------------------------------------------ 
## group: 3
##          vars  n   mean     sd median trimmed    mad min max range  skew
## subno       1 88 328.36 192.47  319.5  328.35 255.01   5 758   753  0.04
## workstat    2 88   1.00   0.00    1.0    1.00   0.00   1   1     0   NaN
## children    3 88   2.00   0.00    2.0    2.00   0.00   2   2     0   NaN
## control     4 87   6.54   1.25    6.0    6.44   1.48   5  10     5  0.55
## attmar      5 88  20.57   7.01   19.0   19.78   5.93  11  44    33  1.12
## attrole     6 88  37.26   6.32   38.0   37.21   7.41  26  55    29  0.19
## atthouse    7 88  22.33   3.75   22.0   22.33   2.97  11  32    21 -0.12
## grouping    8 88   3.00   0.00    3.0    3.00   0.00   3   3     0   NaN
##          kurtosis    se
## subno       -0.95 20.52
## workstat      NaN  0.00
## children      NaN  0.00
## control     -0.46  0.13
## attmar       1.12  0.75
## attrole     -0.37  0.67
## atthouse     0.39  0.40
## grouping      NaN  0.00
## ------------------------------------------------------------ 
## group: 4
##          vars   n   mean     sd median trimmed    mad min max range  skew
## subno       1 189 295.25 196.47    294  288.06 268.35   2 754   752  0.20
## workstat    2 189   2.00   0.00      2    2.00   0.00   2   2     0   NaN
## children    3 189   2.00   0.00      2    2.00   0.00   2   2     0   NaN
## control     4 189   6.71   1.17      7    6.66   1.48   5  10     5  0.35
## attmar      5 187  23.18   8.72     21   22.25   7.41  11  53    42  0.94
## attrole     6 189  34.49   6.96     35   34.35   7.41  18  52    34  0.14
## atthouse    7 189  23.90   4.44     24   23.91   4.45  12  34    22 -0.03
## grouping    8 189   4.00   0.00      4    4.00   0.00   4   4     0   NaN
##          kurtosis    se
## subno       -1.12 14.29
## workstat      NaN  0.00
## children      NaN  0.00
## control     -0.61  0.09
## attmar       0.36  0.64
## attrole     -0.47  0.51
## atthouse    -0.39  0.32
## grouping      NaN  0.00
  1. Check for missing data. If there are, report the number of missing data by variable. Delete cases with missing data.
## Check for NAs
colSums(is.na(df1))
##    subno workstat children  control   attmar  attrole atthouse grouping 
##        0        0        0        1        4        0        1        0
## Remove NAs
df2 <- na.omit(df1)

## Confirm NAs are removed
colSums(is.na(df2))
##    subno workstat children  control   attmar  attrole atthouse grouping 
##        0        0        0        0        0        0        0        0
  1. Draw a histogram of each DV by the grouping variable and visually evaluate if there are potential outliers, if the distributions are normal, and if the groups could be homogenous in variances.
## Create histograms
ggplot(df2, aes(x = control)) +
  geom_histogram(
    aes(y = after_stat(density)),
    binwidth = 1,
    colour = "black",
    fill = "grey"
  ) +
  labs(title = "locus of control by group") +
  facet_wrap( ~ grouping) +
  theme_grey(base_size = 25) +
  geom_density(alpha = .3, fill = "skyblue")

ggplot(df2, aes(x = attmar)) +
  geom_histogram(
    aes(y = after_stat(density)),
    binwidth = 1,
    colour = "black",
    fill = "grey"
  ) +
  labs(title = "attitudes towrad current marital status by group") +
  facet_wrap( ~ grouping) +
  theme_grey(base_size = 25) +
  geom_density(alpha = .3, fill = "skyblue")

ggplot(df2, aes(x = attrole)) +
  geom_histogram(
    aes(y = after_stat(density)),
    binwidth = 1,
    colour = "black",
    fill = "grey"
  ) +
  labs(title = "attitudes toward women's role by group") +
  facet_wrap( ~ grouping) +
  theme_grey(base_size = 25) +
  geom_density(alpha = .3, fill = "skyblue")

ggplot(df2, aes(x = atthouse)) +
  geom_histogram(
    aes(y = after_stat(density)),
    binwidth = 1,
    colour = "black",
    fill = "grey"
  ) +
  labs(title = "attitudes toward housework by group") +
  facet_wrap( ~ grouping) +
  theme_grey(base_size = 25) +
  geom_density(alpha = .3, fill = "skyblue")

  1. Check for univariate outliers (use criterion: z = ±3.3). If there are, report the subject numbers (SUBNO) of the univariate outliers. Delete the cases with univariate outliers.
## Check for univariate outliers
df2$z_control <- scale(df2$control)
df2 |>
filter(z_control >= 3.3 | z_control <= -3.3) |>
  pull(subno)
## Warning: Using one column matrices in `filter()` was deprecated in dplyr 1.1.0.
## ℹ Please use one dimensional logical vectors instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## numeric(0)
df2$z_attmar <- scale(df2$attmar)
df2 |>
  filter(z_attmar >= 3.3 | z_attmar <= -3.3) |>
  pull(subno)
## [1]  10 570
df2$z_attrole <- scale(df2$attrole)
df2 |>
  filter(z_attrole >= 3.3 | z_attmar <= -3.3) |>
   pull(subno)
## numeric(0)
df2$z_atthouse <- scale(df2$atthouse)
df2 |>
  filter(z_atthouse >= 3.3 | z_atthouse <= -3.3) |>
   pull(subno)
## numeric(0)
## Remove univariate outliers
df3 <- df2 |>
  filter(
  subno != 10 & subno != 150
    )
  1. Check for multivariate outliers (criterion: χ2 at α = .001 using Mahalanobis distance). Show the Q-Q plot. If there are, report the subject numbers (SUBNO) of the multivariate outliers. Delete the cases with multivariate outliers if there are.
## Subset dataset
worknochild <- subset(df3, grouping ==  1)
workchild <- subset(df3, grouping ==  2)
homenochild <- subset(df3, grouping ==  3)
homechild <- subset(df3, grouping == 4)

## Calculate cutoff distance
alpha <- .001
cutoff <- (qchisq(p = 1 - alpha, df = 4))

## Calculate multivariate variables
worknochild$mahal0 <- outlier(worknochild[, c(4:7)], plot = T)

worknochild$outlier0 <- ifelse(worknochild$mahal0 > cutoff, 1, 0)
table(worknochild$outlier0)
## 
##  0 
## 49
workchild$mahal0 <- outlier(workchild[, c(4:7)], plot = T)

workchild$outlier0 <- ifelse(workchild$mahal0 > cutoff, 1, 0)
table(workchild$outlier0)
## 
##  0 
## 52
homenochild$mahal0 <- outlier(homenochild[, c(4:7)], plot = T)

homenochild$outlier0 <- ifelse(homenochild$mahal0 > cutoff, 1, 0)
table(homenochild$outlier0)
## 
##  0 
## 86
homechild$mahal0 <- outlier(homechild[, c(4:7)], plot = T)

homechild$outlier0 <- ifelse(homechild$mahal0 > cutoff, 1, 0)
table(homechild$outlier0)
## 
##   0 
## 186
## Remove multivariate outliers and remove unnecessary variables

df4 <- df3 |>
  filter(!row_number() %in% c(0, 49, 52, 86, 186)) |>
  dplyr::select(subno,
                grouping,
                workstat,
                children,
                control,
                attmar,
                attrole,
                atthouse)

rm(homechild, homenochild, workchild, worknochild, alpha, cutoff)
  1. Evaluate whether or not the dataset meets the assumption of homogeneity of variance-covariance matrices at .001 level.
boxM(df4[, 5:8], df4[, 2])
## 
##  Box's M-test for Homogeneity of Covariance Matrices 
## 
## data:  df4[, 5:8] by df4[, 2] 
## Chi-Sq (approx.) = 47.0621, df = 30, p-value = 0.02454
  1. Evaluate whether or not the dataset meets the assumption of substantial correlations among DVs at .05 level.
bart_spher(df4[, 5:8])
##  Bartlett's Test of Sphericity
## 
## Call: bart_spher(x = df4[, 5:8])
## 
##      X2 = 97.74
##      df = 6
## p-value < 2.22e-16
  1. Evaluate the possibility of multicollinearity.
cor(df4[, 5:8])
##             control      attmar     attrole   atthouse
## control  1.00000000  0.17581370  0.02726253  0.1319919
## attmar   0.17581370  1.00000000 -0.09973102  0.3181755
## attrole  0.02726253 -0.09973102  1.00000000 -0.3317072
## atthouse 0.13199195  0.31817546 -0.33170724  1.0000000
cor.plot(cor(df4[, 5:8]))

  1. Interpret the results of MANOVA (Use α = .01 for each single test. Remember we have 4 DVs. We want to use an adjusted level of significance for each hypothesis testing, i.e., .01.). Were the combined DVs significantly affected by women’s work status, having/not having children, and their interaction?
fit1.1 <- manova(cbind(control, attmar, attrole, atthouse) ~ workstat * children, data = df4)
summary(fit1.1, test = "Wilks")
##                    Df   Wilks approx F num Df den Df    Pr(>F)    
## workstat            1 0.92703   7.1237      4    362 1.572e-05 ***
## children            1 0.98376   1.4937      4    362    0.2035    
## workstat:children   1 0.98080   1.7716      4    362    0.1339    
## Residuals         365                                             
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(fit1.1, test = "Pillai")
##                    Df   Pillai approx F num Df den Df    Pr(>F)    
## workstat            1 0.072971   7.1237      4    362 1.572e-05 ***
## children            1 0.016237   1.4937      4    362    0.2035    
## workstat:children   1 0.019200   1.7716      4    362    0.1339    
## Residuals         365                                              
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(fit1.1, test = "Hotelling")
##                    Df Hotelling-Lawley approx F num Df den Df    Pr(>F)    
## workstat            1         0.078714   7.1237      4    362 1.572e-05 ***
## children            1         0.016505   1.4937      4    362    0.2035    
## workstat:children   1         0.019576   1.7716      4    362    0.1339    
## Residuals         365                                                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(fit1.1, test = "Roy")
##                    Df      Roy approx F num Df den Df    Pr(>F)    
## workstat            1 0.078714   7.1237      4    362 1.572e-05 ***
## children            1 0.016505   1.4937      4    362    0.2035    
## workstat:children   1 0.019576   1.7716      4    362    0.1339    
## Residuals         365                                              
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary.aov(fit1.1)
##  Response control :
##                    Df Sum Sq Mean Sq F value Pr(>F)
## workstat            1   0.24 0.24339  0.1508 0.6980
## children            1   0.55 0.55206  0.3421 0.5590
## workstat:children   1   1.38 1.37997  0.8552 0.3557
## Residuals         365 588.98 1.61366               
## 
##  Response attmar :
##                    Df  Sum Sq Mean Sq F value   Pr(>F)   
## workstat            1   641.6  641.59 10.5984 0.001238 **
## children            1    49.1   49.13  0.8117 0.368224   
## workstat:children   1    31.0   30.97  0.5117 0.474874   
## Residuals         365 22095.6   60.54                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##  Response attrole :
##                    Df  Sum Sq Mean Sq F value    Pr(>F)    
## workstat            1   879.4  879.39 19.3899 1.402e-05 ***
## children            1   192.6  192.60  4.2467   0.04003 *  
## workstat:children   1   160.1  160.12  3.5305   0.06104 .  
## Residuals         365 16553.9   45.35                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##  Response atthouse :
##                    Df Sum Sq Mean Sq F value   Pr(>F)   
## workstat            1  137.1 137.054  7.4952 0.006489 **
## children            1    0.1   0.103  0.0057 0.940121   
## workstat:children   1    8.2   8.237  0.4505 0.502535   
## Residuals         365 6674.3  18.286                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Test for multivariate normality
worknochild <- subset(df4, grouping ==  1)
workchild <- subset(df4, grouping ==  2)
homenochild <- subset(df4, grouping ==  3)
homechild <- subset(df4, grouping == 4)

mat <- as.matrix(df4[, 5:8])
mat1 <- as.matrix(worknochild[, 5:8])
mat2 <- as.matrix(workchild[, 5:8])
mat3 <- as.matrix(homenochild[, 5:8])
mat4 <- as.matrix(homechild[, 5:8])

# Run Shapiro test
mvShapiro.Test(mat)
## 
##  Generalized Shapiro-Wilk test for Multivariate Normality by
##  Villasenor-Alva and Gonzalez-Estrada
## 
## data:  mat
## MVW = 0.97343, p-value < 2.2e-16
mvShapiro.Test(mat1)
## 
##  Generalized Shapiro-Wilk test for Multivariate Normality by
##  Villasenor-Alva and Gonzalez-Estrada
## 
## data:  mat1
## MVW = 0.96648, p-value = 0.08084
mvShapiro.Test(mat2)
## 
##  Generalized Shapiro-Wilk test for Multivariate Normality by
##  Villasenor-Alva and Gonzalez-Estrada
## 
## data:  mat2
## MVW = 0.95727, p-value = 0.005707
mvShapiro.Test(mat3)
## 
##  Generalized Shapiro-Wilk test for Multivariate Normality by
##  Villasenor-Alva and Gonzalez-Estrada
## 
## data:  mat3
## MVW = 0.96196, p-value = 3.874e-05
mvShapiro.Test(mat4)
## 
##  Generalized Shapiro-Wilk test for Multivariate Normality by
##  Villasenor-Alva and Gonzalez-Estrada
## 
## data:  mat4
## MVW = 0.96667, p-value = 3.744e-11
cqplot(fit1.1)

res <- residuals(fit1.1)
d2 <- mahalanobis(res, colMeans(res), cov(res))
qqplot(
  qchisq(ppoints(length(d2)), df = 4),
  sort(d2),
  xlab = expression(chi^2 ~ quantiles),
  ylab = expression("Residual Mahalanobis Distance" * D^2)
)
abline(0, 1)

12.Conduct the post-hoc univariate test with Bonferroni adjustment.

alpha <- .01

## Post-hoc locus of control
control1 <- aov(control ~ grouping, data=df4)
hsd1 <- HSD.test(control1, "grouping", console = TRUE, alpha = alpha)
## 
## Study: control1 ~ "grouping"
## 
## HSD Test for control 
## 
## Mean Square Error:  1.613656 
## 
## grouping,  means
## 
##    control      std   r         se Min Max Q25 Q50 Q75
## 1 6.812500 1.424053  48 0.18335167   5  10   6   7   8
## 2 6.680000 1.463013  50 0.17964721   5  10   6   6   7
## 3 6.564706 1.248304  85 0.13778312   5  10   6   6   7
## 4 6.715054 1.180696 186 0.09314274   5  10   6   7   8
## 
## Alpha: 0.01 ; DF Error: 365 
## Critical Value of Studentized Range: 4.433438 
## 
## Groups according to probability of means differences and alpha level( 0.01 )
## 
## Treatments with the same letter are not significantly different.
## 
##    control groups
## 1 6.812500      a
## 4 6.715054      a
## 2 6.680000      a
## 3 6.564706      a
## Post-hoc attmar
attmar1 <- aov(attmar ~ grouping, data=df4)
hsd2 <- HSD.test(attmar1, "grouping", console = TRUE, alpha = alpha)
## 
## Study: attmar1 ~ "grouping"
## 
## HSD Test for attmar 
## 
## Mean Square Error:  60.53597 
## 
## grouping,  means
## 
##     attmar      std   r        se Min Max  Q25 Q50   Q75
## 1 20.62500 5.923717  48 1.1230165  12  35 16.0  20 24.25
## 2 24.44000 7.759550  50 1.1003269  12  39 18.5  25 30.00
## 3 20.54118 7.107261  85 0.8439122  11  44 16.0  19 24.00
## 4 23.01613 8.463898 186 0.5704929  11  49 16.0  21 28.00
## 
## Alpha: 0.01 ; DF Error: 365 
## Critical Value of Studentized Range: 4.433438 
## 
## Groups according to probability of means differences and alpha level( 0.01 )
## 
## Treatments with the same letter are not significantly different.
## 
##     attmar groups
## 2 24.44000      a
## 4 23.01613      a
## 1 20.62500      a
## 3 20.54118      a
## Post-house attrole
attrole1 <- aov(attrole ~ grouping, data=df4)
hsd3 <- HSD.test(attrole1, "grouping", console = TRUE, alpha = alpha)
## 
## Study: attrole1 ~ "grouping"
## 
## HSD Test for attrole 
## 
## Mean Square Error:  45.35308 
## 
## grouping,  means
## 
##    attrole      std   r        se Min Max Q25  Q50   Q75
## 1 37.20833 6.725494  48 0.9720370  24  49  32 37.5 43.25
## 2 31.60000 6.430159  50 0.9523978  18  43  27 32.0 36.75
## 3 37.15294 6.404065  85 0.7304558  26  55  32 37.0 42.00
## 4 34.59140 6.958155 186 0.4937953  18  52  29 35.0 39.00
## 
## Alpha: 0.01 ; DF Error: 365 
## Critical Value of Studentized Range: 4.433438 
## 
## Groups according to probability of means differences and alpha level( 0.01 )
## 
## Treatments with the same letter are not significantly different.
## 
##    attrole groups
## 1 37.20833      a
## 3 37.15294      a
## 4 34.59140     ab
## 2 31.60000      b
## Post-hoc atthouse
atthouse1 <- aov(atthouse ~ grouping, data=df4)
hsd4 <- HSD.test(atthouse1, "grouping", console = TRUE, alpha = alpha)
## 
## Study: atthouse1 ~ "grouping"
## 
## HSD Test for atthouse 
## 
## Mean Square Error:  18.28567 
## 
## grouping,  means
## 
##   atthouse      std   r        se Min Max   Q25 Q50 Q75
## 1 22.79167 4.135772  48 0.6172126  14  31 19.75  23  26
## 2 23.58000 4.562894  50 0.6047424  14  33 19.25  24  27
## 3 22.36471 3.766541  85 0.4638163  11  32 20.00  22  25
## 4 23.84409 4.446972 186 0.3135443  12  34 21.00  24  27
## 
## Alpha: 0.01 ; DF Error: 365 
## Critical Value of Studentized Range: 4.433438 
## 
## Groups according to probability of means differences and alpha level( 0.01 )
## 
## Treatments with the same letter are not significantly different.
## 
##   atthouse groups
## 4 23.84409      a
## 2 23.58000      a
## 1 22.79167      a
## 3 22.36471      a
  1. What is the effect size of each of the significant effects? Compute partial eta squared up to three decimal points. You can use manual computations (show your calculations) or use the sjstats package.
fit2.1 <- aov(control ~ workstat, data=df4)  
summary(fit2.1)
##              Df Sum Sq Mean Sq F value Pr(>F)
## workstat      1    0.2  0.2434   0.151  0.698
## Residuals   367  590.9  1.6101
effectsize::eta_squared(fit2.1, partial = TRUE)
## For one-way between subjects designs, partial eta squared is equivalent
##   to eta squared. Returning eta squared.
## # Effect Size for ANOVA
## 
## Parameter |     Eta2 |       95% CI
## -----------------------------------
## workstat  | 4.12e-04 | [0.00, 1.00]
## 
## - One-sided CIs: upper bound fixed at [1.00].
fit2.2 <- aov(attmar ~ workstat, data=df4)  
summary(fit2.2)
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## workstat      1    642   641.6   10.62 0.00122 **
## Residuals   367  22176    60.4                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
effectsize::eta_squared(fit2.2, partial = TRUE)
## For one-way between subjects designs, partial eta squared is equivalent
##   to eta squared. Returning eta squared.
## # Effect Size for ANOVA
## 
## Parameter | Eta2 |       95% CI
## -------------------------------
## workstat  | 0.03 | [0.01, 1.00]
## 
## - One-sided CIs: upper bound fixed at [1.00].
fit2.3 <- aov(attrole ~ workstat, data=df4)  
summary(fit2.3)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## workstat      1    879   879.4   19.09 1.63e-05 ***
## Residuals   367  16907    46.1                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
effectsize::eta_squared(fit2.3, partial = TRUE)
## For one-way between subjects designs, partial eta squared is equivalent
##   to eta squared. Returning eta squared.
## # Effect Size for ANOVA
## 
## Parameter | Eta2 |       95% CI
## -------------------------------
## workstat  | 0.05 | [0.02, 1.00]
## 
## - One-sided CIs: upper bound fixed at [1.00].
fit2.4 <- aov(atthouse ~ workstat, data=df4)  
summary(fit2.4)
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## workstat      1    137  137.05   7.527 0.00638 **
## Residuals   367   6683   18.21                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
effectsize::eta_squared(fit2.4, partial = TRUE)
## For one-way between subjects designs, partial eta squared is equivalent
##   to eta squared. Returning eta squared.
## # Effect Size for ANOVA
## 
## Parameter | Eta2 |       95% CI
## -------------------------------
## workstat  | 0.02 | [0.00, 1.00]
## 
## - One-sided CIs: upper bound fixed at [1.00].