Back to schedule


Read in the Dataset

library(dyadr)
library(dplyr)
library(nlme)

kashy <- read.csv("kashy.csv")

Repeated Measures Analysis with Day of the Week and Gender

Because there are no random effects, we go back to using GLS.

First, we need to treat DayOfWeek as a “factor” or categorical variable, not a continuous variable.

Also, the full model with 28 repeated measures (14 days and 2 people) takes a very long time to run. To have the run not take so long, we look at days 4 through 11.

kashy <- kashy %>%
  mutate(DayOfWeek = as.factor(DayOfWeek), 
         meas = 10*Day+Person,
         ASATISFn = ASATISF) %>%
  filter(Day > 3 & Day < 11)

The “meas” is variable that codes days 1 to 7 for the two members and goes from 1 to 14. This run takes a few minutes to run! Be patient please.

RM =  gls(ASATISFn ~  GENDER  + DayOfWeek + DayOfWeek*GENDER, 
                 na.action=na.omit, 
                 correlation=corSymm (form=~1|DYADID),
                 weights=varIdent(form=~1|meas),
                 data=kashy)

anova(RM)
## Denom. DF: 1427 
##                  numDF   F-value p-value
## (Intercept)          1 13018.495  <.0001
## GENDER               1    10.578  0.0012
## DayOfWeek            6     1.375  0.2212
## GENDER:DayOfWeek     6     0.820  0.5542
smallsummary(RM)
## Correlation structure of class corSymm representing
##  Correlation: 
##    1     2     3     4     5     6     7     8     9     10    11    12   
## 2  0.670                                                                  
## 3  0.503 0.645                                                            
## 4  0.387 0.615 0.720                                                      
## 5  0.614 0.734 0.588 0.640                                                
## 6  0.425 0.570 0.637 0.597 0.667                                          
## 7  0.382 0.551 0.664 0.585 0.456 0.645                                    
## 8  0.542 0.442 0.376 0.405 0.450 0.477 0.450                              
## 9  0.331 0.536 0.475 0.571 0.516 0.523 0.548 0.497                        
## 10 0.284 0.457 0.622 0.651 0.453 0.469 0.508 0.370 0.611                  
## 11 0.193 0.374 0.364 0.600 0.444 0.372 0.378 0.380 0.542 0.690            
## 12 0.290 0.407 0.284 0.432 0.620 0.392 0.278 0.262 0.347 0.515 0.648      
## 13 0.340 0.389 0.416 0.417 0.473 0.652 0.399 0.435 0.464 0.492 0.523 0.564
## 14 0.306 0.480 0.559 0.510 0.488 0.619 0.622 0.479 0.593 0.703 0.495 0.387
##    13   
## 2       
## 3       
## 4       
## 5       
## 6       
## 7       
## 8       
## 9       
## 10      
## 11      
## 12      
## 13      
## 14 0.624
## 
## Variance function structure of class varIdent representing
##        41        51        61        71        81        91       101 
## 1.0000000 0.9620520 0.8828014 0.9369069 0.9625294 0.8204706 0.8838191 
##        42        52        62        72        82        92       102 
## 0.7404049 0.8711645 0.6989420 0.9062638 1.0107313 0.7988227 0.6454376 
## Residual standard error: 1.025791 
## 
##                     Value Std.Error t-value p-value
## (Intercept)        6.4167    0.0719 89.1860  0.0000
## GENDER            -0.0754    0.0337 -2.2390  0.0253
## DayOfWeek2        -0.0728    0.0546 -1.3339  0.1824
## DayOfWeek3        -0.0769    0.0637 -1.2067  0.2277
## DayOfWeek4        -0.0534    0.0655 -0.8151  0.4152
## DayOfWeek5        -0.0410    0.0529 -0.7755  0.4382
## DayOfWeek6        -0.1296    0.0662 -1.9568  0.0506
## DayOfWeek7         0.0042    0.0603  0.0695  0.9446
## GENDER:DayOfWeek2  0.0176    0.0366  0.4825  0.6295
## GENDER:DayOfWeek3  0.0371    0.0387  0.9593  0.3376
## GENDER:DayOfWeek4  0.0313    0.0406  0.7703  0.4412
## GENDER:DayOfWeek5 -0.0342    0.0383 -0.8925  0.3723
## GENDER:DayOfWeek6 -0.0232    0.0393 -0.5903  0.5551
## GENDER:DayOfWeek7  0.0288    0.0396  0.7284  0.4665
##                     2.5 %  97.5 %
## (Intercept)        6.2756  6.5577
## GENDER            -0.1415 -0.0094
## DayOfWeek2        -0.1797  0.0342
## DayOfWeek3        -0.2017  0.0480
## DayOfWeek4        -0.1818  0.0750
## DayOfWeek5        -0.1446  0.0626
## DayOfWeek6        -0.2594  0.0002
## DayOfWeek7        -0.1139  0.1223
## GENDER:DayOfWeek2 -0.0540  0.0893
## GENDER:DayOfWeek3 -0.0387  0.1129
## GENDER:DayOfWeek4 -0.0483  0.1108
## GENDER:DayOfWeek5 -0.1093  0.0409
## GENDER:DayOfWeek6 -0.1003  0.0539
## GENDER:DayOfWeek7 -0.0487  0.1064

We see the usual gender difference, with women more satisfied than men, but Day of the Week is not significant.

Simpler Model

Because the interaction is not significant, we drop it to make interpretation simpler.

RM2 =  summary(gls(ASATISFn ~  GENDER  + DayOfWeek , 
                 na.action=na.omit, 
                 correlation=corSymm (form=~1|DYADID),
                 weights=varIdent(form=~1|meas),
                 data=kashy))

anova(RM2)
## Denom. DF: 1433 
##             numDF   F-value p-value
## (Intercept)     1 12984.789  <.0001
## GENDER          1    10.487  0.0012
## DayOfWeek       6     1.352  0.2306
RM2
## Generalized least squares fit by REML
##   Model: ASATISFn ~ GENDER + DayOfWeek 
##   Data: kashy 
##        AIC      BIC    logLik
##   2880.818 3476.048 -1327.409
## 
## Correlation Structure: General
##  Formula: ~1 | DYADID 
##  Parameter estimate(s):
##  Correlation: 
##    1     2     3     4     5     6     7     8     9     10    11    12   
## 2  0.664                                                                  
## 3  0.501 0.644                                                            
## 4  0.387 0.614 0.722                                                      
## 5  0.613 0.735 0.586 0.642                                                
## 6  0.424 0.569 0.632 0.600 0.669                                          
## 7  0.382 0.556 0.668 0.585 0.461 0.647                                    
## 8  0.539 0.444 0.374 0.406 0.452 0.479 0.451                              
## 9  0.331 0.543 0.473 0.568 0.525 0.529 0.538 0.504                        
## 10 0.283 0.457 0.618 0.650 0.456 0.472 0.504 0.373 0.612                  
## 11 0.191 0.381 0.360 0.598 0.452 0.374 0.371 0.383 0.543 0.690            
## 12 0.294 0.404 0.286 0.432 0.620 0.389 0.283 0.257 0.348 0.515 0.647      
## 13 0.342 0.391 0.417 0.418 0.476 0.653 0.402 0.434 0.466 0.493 0.524 0.565
## 14 0.299 0.482 0.554 0.510 0.488 0.620 0.623 0.484 0.599 0.704 0.499 0.380
##    13   
## 2       
## 3       
## 4       
## 5       
## 6       
## 7       
## 8       
## 9       
## 10      
## 11      
## 12      
## 13      
## 14 0.620
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | meas 
##  Parameter estimates:
##        41        51        61        71        81        91       101 
## 1.0000000 0.9620508 0.8833825 0.9331423 0.9599636 0.8176094 0.8766606 
##        42        52        62        72        82        92       102 
## 0.7396968 0.8658397 0.6972903 0.9055011 1.0109219 0.7961999 0.6463022 
## 
## Coefficients:
##                 Value  Std.Error  t-value p-value
## (Intercept)  6.425580 0.07132154 90.09312  0.0000
## GENDER      -0.069592 0.02282905 -3.04839  0.0023
## DayOfWeek2  -0.067718 0.05343901 -1.26720  0.2053
## DayOfWeek3  -0.091287 0.06201919 -1.47192  0.1413
## DayOfWeek4  -0.062470 0.06499806 -0.96110  0.3367
## DayOfWeek5  -0.042627 0.05180884 -0.82278  0.4108
## DayOfWeek6  -0.135671 0.06371627 -2.12930  0.0334
## DayOfWeek7  -0.008490 0.05745910 -0.14776  0.8826
## 
##  Correlation: 
##            (Intr) GENDER DyOfW2 DyOfW3 DyOfW4 DyOfW5 DyOfW6
## GENDER      0.318                                          
## DayOfWeek2 -0.309 -0.145                                   
## DayOfWeek3 -0.440 -0.054  0.536                            
## DayOfWeek4 -0.441 -0.138  0.417  0.600                     
## DayOfWeek5 -0.383 -0.020  0.299  0.461  0.564              
## DayOfWeek6 -0.464 -0.009  0.363  0.589  0.484  0.490       
## DayOfWeek7 -0.379 -0.016  0.431  0.576  0.424  0.452  0.625
## 
## Standardized residuals:
##        Min         Q1        Med         Q3        Max 
## -5.0350959 -0.4727381  0.3330254  0.6994591  0.9639556 
## 
## Residual standard error: 1.028077 
## Degrees of freedom: 1441 total; 1433 residual

Summary

Women more satisfied than men, by about 0.15 (again the effect is doubled due to effects coding).

R gls uses “reference coding,” commonly called dummy coding, and Monday, the first category is used as the reference point. The intercept gives the predicted satisfaction for people on Mondays, so a score of 6.43. The dummy variable give the change for those days. So for Tuesday, the prediction is 6.43 - 0.07 or 6.36. Couples are most satisfied on Mondays followed by Sundays and least on Saturdays. Remember though that Day of the Week is not statistically significant.


Back to schedule