R packages used

library(nlme) # for lme(), gls(), intervals()
library(psych) # for alpha()

Goals

  1. Compare within-participant (between-partner) variabilities in attachment avoidance, anxiety, and relationship satisfaction among individuals who do and do not rank their partners.

  2. Compare polyamorous individuals’ reports of attachment anxiety, attachment avoidance, and relationship satisfaction among individuals who do and do not rank their partners.

  3. Compare polyamorous individuals’ reports of attachment anxiety, attachment avoidance, and relationship satisfaction in primary and secondary relationships of individuals who do rank partners.

Data preparation and analytic plan

All the data cleanup and preparation was done on a separate R script, “dataPrep1.R”.

setwd("C:/Users/fsancierbarbosa/OneDrive - Colorado College/Research/Open/Sharon/CNM")
source("dataPrep1.R")

To account for dependencies among partners of the same participants (since multiple relationships from the same participant are likely to have similarities), we chose to use linear mixed effects models. The models were constructed using the package nlme in R. We adjusted for multiple testing using the False Discovery Rate (FDR) method by Benjamini-Hochberg (1995).

For the first two analyses, the data was converted to long format, that is, each row is a partner/relationship from a participant. For the last analysis, each row represented a pair of primary and secondary relationships from a participant. Since some participants reported having more than one primary and/or secondary partner, some rows came from the same participant. These two datasets were named study1.long and study1.H.long.

To compare models using a likelihood ratio test, models must be generated using the same dataset, so to avoid potential comparison issues caused by missing data, only complete data subsets were used on each analysis.

Variables in the first two analyses

We used a total of 7 within-participant (WP) variables and 10 between-participant (BP) variables.

Variable Labeled Type Description
Respondent.ID id BP Participant’s unique ID
avoidance dv1 WP Attachment avoidance with a partner
anxiety dv2 WP Attachment anxiety with a partner
satisfaction dv3 WP Relationship satisfaction with a partner
hierarchy iv BP 2 levels: hierarchical, non-hierarchical
hierarchy2 iv2 BP 4 levels: non-hier., prim., sec., tert.
rel.length.c cv1 WP Relationship length (in years, standardized)
age cv2 BP Participant’s age (in years)
incomeperPPL cv3 BP Income per ppl. household (in USD/year)
N.Partners.3levels BP cv4 No. of partners, 3 levels: 2, 3, or >3
gender cv5 BP 3 levels: Woman, Man, Non-binary
orientation.binary cv6 BP 2 levels: Heterosexual, LGBTQIA
race.binary cv7 BP 2 levels: White, POC
children.binary cv8 BP Number of children, 2 levels: 0, >0
education.3levels cv9 BP 3 levels: 12th grade, BS, grad school
marital.status cv10 WP 2 levels: married, not married
cohab cv11 WP 3 levels: local, long dist., living together
coparent cv12 WP 3 levels: co-parent, partner has children, not a co-parent

Reliability

Calculating Chronbach’s alpha for avoidance & anxiety (ECR-RS), and relationship satisfaction (CSI-4):

Both relationship types (hierarchical and non-hierarchical)

# Avoidance
a <- alpha(study1.long[,c("avoid1", "avoid2", "avoid3", "avoid4", "avoid5", "avoid6")])
a$total[1]
##  raw_alpha
##  0.8833255
# Anxiety
a <- alpha(study1.long[,c("anx1", "anx2", "anx3")])
a$total[1]
##  raw_alpha
##  0.8595774
# Satisfaction
a <- alpha(study1.long[,c("sat1", "sat2", "sat3", "sat4")])
a$total[1]
##  raw_alpha
##  0.8910224

Non-hierarchical relationships

# Avoidance
a <- alpha(study1.long[(study1.long$hierarchy == "NonHierarchical"), c("avoid1", "avoid2", "avoid3", "avoid4", "avoid5", "avoid6")])
a$total[1]
##  raw_alpha
##  0.8705618
# Anxiety
a <- alpha(study1.long[(study1.long$hierarchy == "NonHierarchical"), c("anx1", "anx2", "anx3")])
a$total[1]
##  raw_alpha
##  0.8385972
# Satisfaction
a <- alpha(study1.long[(study1.long$hierarchy == "NonHierarchical"), c("sat1", "sat2", "sat3", "sat4")])
a$total[1]
##  raw_alpha
##  0.8611398

Hierarchical relationships

# Avoidance
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical"), c("avoid1", "avoid2", "avoid3", "avoid4", "avoid5", "avoid6")])
a$total[1]
##  raw_alpha
##   0.882527
# Anxiety
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical"), c("anx1", "anx2", "anx3")])
a$total[1]
##  raw_alpha
##  0.8686843
# Satisfaction
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical"), c("sat1", "sat2", "sat3", "sat4")])
a$total[1]
##  raw_alpha
##  0.9134547

Primary relationships (hierarchical only)

# Avoidance
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical" & study1.long$primary == 1), 
                       c("avoid1", "avoid2", "avoid3", "avoid4", "avoid5", "avoid6")])
a$total[1]
##  raw_alpha
##  0.7703495
# Anxiety
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical" & study1.long$primary == 1), 
                       c("anx1", "anx2", "anx3")])
a$total[1]
##  raw_alpha
##  0.9190608
# Satisfaction
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical" & study1.long$primary == 1), 
                       c("sat1", "sat2", "sat3", "sat4")])
a$total[1]
##  raw_alpha
##  0.9028212

Non-primary relationships (hierarchical only)

# Avoidance
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical" & study1.long$primary == 0), 
                       c("avoid1", "avoid2", "avoid3", "avoid4", "avoid5", "avoid6")])
a$total[1]
##  raw_alpha
##  0.8689634
# Anxiety
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical" & study1.long$primary == 0), 
                       c("anx1", "anx2", "anx3")])
a$total[1]
##  raw_alpha
##  0.8172812
# Satisfaction
a <- alpha(study1.long[(study1.long$hierarchy == "Hierarchical" & study1.long$primary == 0), 
                       c("sat1", "sat2", "sat3", "sat4")])
a$total[1]
##  raw_alpha
##   0.900718

All relationships (hierarchical and non-hierarchical): Avoidance: alpha = .88; Anxiety: alpha = .86; Satisfaction: alpha = .89.

Non-hierarchical relationships: Avoidance: alpha = .87; Anxiety: alpha = .84; Satisfaction: alpha = .86.

Hierarchical relationships: Avoidance: alpha = .88; Anxiety: alpha = .87; Satisfaction: alpha = .91.

Primary relationships (hierarchical only): Avoidance: alpha = .77; Anxiety: alpha = .92; Satisfaction: alpha = .90.

Non-primary relationships (hierarchical only): Avoidance: alpha = .87; Anxiety: alpha = .82; Satisfaction: alpha = .90.

Correction for multiple testing

We recorded the p-values of all the tests of significance performed on the three mixed-effects analyses (vector pvals) and adjusted them (vector pvals.adj) to control the false discovery rate (FDR) using the BH method.

Checking the need for mixed effects models

Defining variables in a complete dataset:

vars <- c("Respondent.ID", "avoidance", "anxiety", "satisfaction", "hierarchy")
data <- na.omit(study1.long[vars])
dv1 <- data$avoidance
dv2 <- data$anxiety
dv3 <- data$satisfaction
iv <- data$hierarchy
id <- data$Respondent.ID

Checking whether a random-intercept model is an improvement over a fixed intercept one:

# Intercept only models, using general least squares (gls)
i1 <- gls(dv1 ~ 1, method = "ML", na.action=na.exclude)
i2 <- gls(dv2 ~ 1, method = "ML", na.action=na.exclude)
i3 <- gls(dv3 ~ 1, method = "ML", na.action=na.exclude)

# Random intercept only models, using linear mixed effecs (lme)
ri1 <- lme(dv1 ~ 1, random = list(id = pdSymm(form = ~ 1)),
           method="ML", na.action=na.exclude)
ri2 <- lme(dv2 ~ 1, random = list(id = pdSymm(form = ~ 1)),
           method="ML", na.action=na.exclude)
ri3 <- lme(dv3 ~ 1, random = list(id = pdSymm(form = ~ 1)),
           method="ML", na.action=na.exclude)

a1 <- anova(i1, ri1); print(a1)
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## i1      1  2 1709.193 1717.863 -852.5967                        
## ri1     2  3 1698.657 1711.663 -846.3287 1 vs 2 12.53594   4e-04
a2 <- anova(i2, ri2); print(a2)
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## i2      1  2 1965.992 1974.662 -980.9959                        
## ri2     2  3 1921.240 1934.245 -957.6200 1 vs 2 46.75179  <.0001
a3 <- anova(i3, ri3); print(a3)
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## i3      1  2 3004.021 3012.692 -1500.011                        
## ri3     2  3 2971.427 2984.433 -1482.714 1 vs 2 34.59405  <.0001
pvals <- c(a1$`p-value`, a2$`p-value`, a3$`p-value`)

The random-intercept models significantly improve the fixed-intercept ones. This confirms the appropriateness of using linear mixed effects models.

Variability in within-participant avoidance, anxiety, and relationship satisfaction by hierarchy type

Step 1: Look at hierarchy type only

To test whether the within-participant variability in avoidance, anxiety, and relationship satisfaction differed by hierarchy type, we compared (via likelihood ratio test) two linear mixed effects models for each outcome variable: one which assumed a homogeneous variance across hierarchical and non-hierarchical groups and one which assumed heterogeneous variance. Both models had a random intercept and no fixed effects.

Options used in the nlme::lme() function throughout this analysis:

random = list(id = pdSymm(form = ~ 1)), which is the same as random = ~ 1|id, sets the random effects to be structured as a positive-definite symmetric matrix; it assumes homogeneous between-subject variance.

random = list(id = pdDiag(form = ~ iv)) sets the random effects to be structured as a diagonal matrix; it assumes heterogeneous between-subject variance across the levels of iv (hierarchical and non-hierarchical groups).

weights = varIdent(form = ~ 1 | iv) sets heterogeneous within-participant variance for levels of iv (hierarchical and non-hierarchical groups)

method = "ML" Maximum Likelihood is used to compare models and method = "REML" Restricted ML on final model.

wph1 <- lme(dv1 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varIdent(form = ~ 1 | iv), 
            method="ML") 
wph2 <- lme(dv2 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv), 
            method="ML") 
wph3 <- lme(dv3 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv), 
            method="ML")
a1 <- anova(ri1,wph1); print(a1) 
##      Model df      AIC      BIC    logLik   Test L.Ratio p-value
## ri1      1  3 1698.657 1711.663 -846.3287                       
## wph1     2  4 1689.768 1707.109 -840.8843 1 vs 2 10.8889   0.001
a2 <- anova(ri2,wph2); print(a2) 
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## ri2      1  3 1921.240 1934.245 -957.6200                        
## wph2     2  4 1912.517 1929.858 -952.2586 1 vs 2 10.72264  0.0011
a3 <- anova(ri3,wph3); print(a3)
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## ri3      1  3 2971.427 2984.433 -1482.714                        
## wph3     2  4 2969.064 2986.405 -1480.532 1 vs 2 4.363152  0.0367
pvals <- c(pvals, 
           a1$`p-value`, a2$`p-value`, a3$`p-value`)

Hierarchical relationships are associated with higher within-participant variability in avoidance, anxiety, and relationship satisfaction. However, after adjusting for multiple testing, the effect for relationship satisfaction is not significant.

summary(wph1)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1689.769 1707.109 -840.8843
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept)  Residual
## StdDev:     0.39479 0.9110345
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.251505 
## Fixed effects: dv1 ~ 1 
##               Value  Std.Error  DF  t-value p-value
## (Intercept) 2.06929 0.05016391 339 41.25057       0
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -1.7100077 -0.7452329 -0.2186775  0.5639658  4.6224882 
## 
## Number of Observations: 564
## Number of Groups: 225
summary(wph2)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1912.517 1929.858 -952.2586
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    0.770111 1.009911
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##         1.00000         1.26607 
## Fixed effects: dv2 ~ 1 
##                Value  Std.Error  DF  t-value p-value
## (Intercept) 2.227532 0.07048204 339 31.60425       0
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.4722788 -0.5619507 -0.3110696  0.5062236  3.4688398 
## 
## Number of Observations: 564
## Number of Groups: 225
summary(wph3)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   2969.064 2986.405 -1480.532
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.709768 2.775777
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.158351 
## Fixed effects: dv3 ~ 1 
##                Value Std.Error  DF  t-value p-value
## (Intercept) 16.04599  0.170797 339 93.94772       0
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -3.6383066 -0.5963369  0.1176959  0.6894816  1.9773680 
## 
## Number of Observations: 564
## Number of Groups: 225

The within-participant standard deviations for avoidance, anxiety, and relationship satisfaction were higher in the hierarchical group by 25%, 26%, and 16% respectively.

Estimated standard deviations for non-hierarchical and hierarchical groups:

summary(wph1)$sigma # avoidance, non-hierarchical
## [1] 0.9110345
summary(wph1)$sigma*coef(wph1$modelStruct$varStruct, uncons=FALSE) 
## Hierarchical 
##     1.140164
summary(wph2)$sigma # anxiety, non-hierarchical
## [1] 1.009911
summary(wph2)$sigma*coef(wph2$modelStruct$varStruct, uncons=FALSE) 
## Hierarchical 
##     1.278618
summary(wph3)$sigma # satisfaction, non-hierarchical
## [1] 2.775777
summary(wph3)$sigma*coef(wph3$modelStruct$varStruct, uncons=FALSE) 
## Hierarchical 
##     3.215325

Confidence intervals:

intervals(wph1, level = 0.95, which = "all")
## Approximate 95% confidence intervals
## 
##  Fixed effects:
##                lower    est.    upper
## (Intercept) 1.970705 2.06929 2.167874
## attr(,"label")
## [1] "Fixed effects:"
## 
##  Random Effects:
##   Level: id 
##                     lower    est.     upper
## sd((Intercept)) 0.2832421 0.39479 0.5502682
## 
##  Variance function:
##                 lower     est.    upper
## Hierarchical 1.095998 1.251505 1.429076
## attr(,"label")
## [1] "Variance function:"
## 
##  Within-group standard error:
##     lower      est.     upper 
## 0.8316119 0.9110345 0.9980424
intervals(wph2, level = 0.95, which = "all")
## Approximate 95% confidence intervals
## 
##  Fixed effects:
##                lower     est.    upper
## (Intercept) 2.089018 2.227532 2.366046
## attr(,"label")
## [1] "Fixed effects:"
## 
##  Random Effects:
##   Level: id 
##                     lower     est.     upper
## sd((Intercept)) 0.6433183 0.770111 0.9218935
## 
##  Variance function:
##                lower    est.    upper
## Hierarchical 1.10037 1.26607 1.456722
## attr(,"label")
## [1] "Variance function:"
## 
##  Within-group standard error:
##    lower     est.    upper 
## 0.915823 1.009911 1.113665
intervals(wph3, level = 0.95, which = "all")
## Approximate 95% confidence intervals
## 
##  Fixed effects:
##                lower     est.    upper
## (Intercept) 15.71034 16.04599 16.38165
## attr(,"label")
## [1] "Fixed effects:"
## 
##  Random Effects:
##   Level: id 
##                    lower     est.    upper
## sd((Intercept)) 1.387745 1.709768 2.106515
## 
##  Variance function:
##                 lower     est.    upper
## Hierarchical 1.008444 1.158351 1.330542
## attr(,"label")
## [1] "Variance function:"
## 
##  Within-group standard error:
##    lower     est.    upper 
## 2.521170 2.775777 3.056096

Exploratory - checked whether a heterogeneous between-subjects variance model improved the heterogeneous within-subjects variance model:

bph1 <- lme(dv1 ~ 1, 
            random = list(id = pdDiag(form = ~ iv)),
            weights = varIdent(form = ~ 1 | iv),
            method="ML") 
bph2 <- lme(dv2 ~ 1, 
            random = list(id = pdDiag(form = ~ iv)), 
            weights = varIdent(form = ~ 1 | iv),
            method="ML") 
bph3 <- lme(dv3 ~ 1, 
            random = list(id = pdDiag(form = ~ iv)), 
            weights = varIdent(form = ~ 1 | iv),
            method="ML") 
a1 <- anova(wph1,bph1); print(a1) 
##      Model df      AIC      BIC    logLik   Test     L.Ratio p-value
## wph1     1  4 1689.768 1707.109 -840.8843                           
## bph1     2  5 1691.768 1713.444 -840.8843 1 vs 2 3.92165e-07  0.9995
a2 <- anova(wph2,bph2); print(a2)  
##      Model df      AIC      BIC    logLik   Test      L.Ratio p-value
## wph2     1  4 1912.517 1929.858 -952.2586                            
## bph2     2  5 1914.517 1936.192 -952.2584 1 vs 2 0.0005435428  0.9814
a3 <- anova(wph3,bph3); print(a3) 
##      Model df      AIC      BIC    logLik   Test      L.Ratio p-value
## wph3     1  4 2969.064 2986.405 -1480.532                            
## bph3     2  5 2971.064 2992.740 -1480.532 1 vs 2 5.476795e-07  0.9994
pvals <- c(pvals, a1$`p-value`, a2$`p-value`, a3$`p-value`)

No significant improvement.

Step 2: add control variables

We first checked which potential control variables are related to the within-participant variability in the outcomes.

# numerical vars
cvs.num <- c("rel.length.c", "age.c", "incomeperPPL.c") 

# categorical vars
cvs.cat <- c("N.Partners.3levels", "gender", "orientation.binary", "race.binary", "children.binary", "education.3levels", "marital.status", "cohab", "coparent") 
cvs <- c(cvs.num, cvs.cat)

For numerical variables, we considered 3 options:

  • weights = varFixed(~cv), which assumes that the variance is proportional to cv;

  • weights = varPower(1,~cv), which assumes that the variance is a power of cv;

  • weights = varExp(1,~cv), which assumes that the variance is an exponential of cv.

The option, if any, that improved the model the most was selected.

for(x in cvs.num){ # numerical vars
  data <- na.omit(study1.long[c(vars,x)])
  print(x)
  cv <- data[[x]]
  dv1 <- data$avoidance
  dv2 <- data$anxiety
  dv3 <- data$satisfaction
  iv <- data$hierarchy
  id <- data$Respondent.ID
  m1 <- lme(dv1 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            method="ML")
  m2 <- lme(dv2 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            method="ML")
  m3 <- lme(dv3 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            method="ML")
  mcv1 <- lme(dv1 ~ 1, 
              random = list(id = pdSymm(form = ~ 1)), 
              #weights = varFixed(~cv),
              #weights = varPower(1,~cv),
              weights = varExp(1,~cv),
              method="ML", 
              control=lmeControl(opt = "optim"))
  mcv2 <- lme(dv2 ~ 1, 
              random = list(id = pdSymm(form = ~ 1)), 
              #weights = varFixed(~cv),
              #weights = varPower(1,~cv),
              weights = varExp(1,~cv),
              method="ML", 
              control=lmeControl(opt = "optim")) 
  mcv3 <- lme(dv3 ~ 1, 
              random = list(id = pdSymm(form = ~ 1)), 
              #weights = varFixed(~cv),
              #weights = varPower(1,~cv),
              weights = varExp(1,~cv),
              method="ML", 
              control=lmeControl(opt = "optim"))
  a1 <- anova(m1,mcv1); 
  a2 <- anova(m2,mcv2); 
  a3 <- anova(m3,mcv3);
  print(a1); print(a2); print(a3); 
  pvals <- c(pvals, 
             a1$`p-value`, a2$`p-value`, a3$`p-value`)
}
## [1] "rel.length.c"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1682.265 1695.238 -838.1323                        
## mcv1     2  4 1666.686 1683.983 -829.3430 1 vs 2 17.57869  <.0001
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m2       1  3 1897.491 1910.464 -945.7455                        
## mcv2     2  4 1894.945 1912.243 -943.4726 1 vs 2 4.545705   0.033
##      Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m3       1  3 2943.723 2956.696 -1468.861                       
## mcv3     2  4 2943.578 2960.876 -1467.789 1 vs 2 2.14462  0.1431
## [1] "age.c"
##      Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m1       1  3 1698.657 1711.663 -846.3287                       
## mcv1     2  4 1713.171 1730.511 -852.5854 1 vs 2 12.5134   4e-04
##      Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m2       1  3 1921.240 1934.245 -957.6200                       
## mcv2     2  4 1967.276 1984.616 -979.6378 1 vs 2 44.0357  <.0001
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m3       1  3 2971.427 2984.433 -1482.714                        
## mcv3     2  4 3007.350 3024.690 -1499.675 1 vs 2 33.92267  <.0001
## [1] "incomeperPPL.c"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1328.222 1340.455 -661.1110                        
## mcv1     2  4 1336.862 1353.173 -664.4312 1 vs 2 6.640512    0.01
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m2       1  3 1491.388 1503.620 -742.6938                        
## mcv2     2  4 1487.526 1503.836 -739.7628 1 vs 2 5.861914  0.0155
##      Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m3       1  3 2305.779 2318.012 -1149.890                       
## mcv3     2  4 2334.305 2350.616 -1163.152 1 vs 2 26.5259  <.0001

Categorical variables:

for(x in cvs.cat){ # categorical vars
  data <- na.omit(study1.long[c(vars,x)])
  print(x)
  cv <- data[[x]]
  dv1 <- data$avoidance
  dv2 <- data$anxiety
  dv3 <- data$satisfaction
  iv <- data$hierarchy
  id <- data$Respondent.ID
  m1 <- lme(dv1 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            method="ML")
  m2 <- lme(dv2 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            method="ML")
  m3 <- lme(dv3 ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            method="ML")
  mcv1 <- lme(dv1 ~ 1, 
              random = list(id = pdSymm(form = ~ 1)),
              weights = varIdent(form = ~1|cv),
              method="ML")
  mcv2 <- lme(dv2 ~ 1, 
              random = list(id = pdSymm(form = ~ 1)),
              weights = varIdent(form = ~1|cv),
              method="ML")
  mcv3 <- lme(dv3 ~ 1, 
              random = list(id = pdSymm(form = ~ 1)),
              weights = varIdent(form = ~1|cv),
              method="ML")
  a1 <- anova(m1,mcv1) 
  a2 <- anova(m2,mcv2) 
  a3 <- anova(m3,mcv3)
  print(a1); print(a2); print(a3); 
  pvals <- c(pvals, 
             a1$`p-value`, a2$`p-value`, a3$`p-value`)
}
## [1] "N.Partners.3levels"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1698.657 1711.663 -846.3287                        
## mcv1     2  5 1679.752 1701.427 -834.8760 1 vs 2 22.90553  <.0001
##      Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m2       1  3 1921.240 1934.245 -957.6200                         
## mcv2     2  5 1925.191 1946.866 -957.5955 1 vs 2 0.0489621  0.9758
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m3       1  3 2971.427 2984.433 -1482.714                        
## mcv3     2  5 2965.826 2987.501 -1477.913 1 vs 2 9.601514  0.0082
## [1] "gender"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1406.073 1418.505 -700.0365                        
## mcv1     2  5 1396.273 1416.994 -693.1366 1 vs 2 13.79972   0.001
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m2       1  3 1587.874 1600.307 -790.9372                        
## mcv2     2  5 1590.274 1610.995 -790.1371 1 vs 2 1.600361  0.4492
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m3       1  3 2460.656 2473.088 -1227.328                        
## mcv3     2  5 2462.291 2483.012 -1226.145 1 vs 2 2.365021  0.3065
## [1] "orientation.binary"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1389.050 1401.450 -691.5247                        
## mcv1     2  4 1386.429 1402.963 -689.2146 1 vs 2 4.620197  0.0316
##      Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m2       1  3 1562.749 1575.149 -778.3744                         
## mcv2     2  4 1564.359 1580.893 -778.1797 1 vs 2 0.3895427  0.5325
##      Model df      AIC      BIC    logLik   Test     L.Ratio p-value
## m3       1  3 2429.558 2441.958 -1211.779                           
## mcv3     2  4 2431.553 2448.087 -1211.777 1 vs 2 0.004521638  0.9464
## [1] "race.binary"
##      Model df      AIC      BIC    logLik   Test     L.Ratio p-value
## m1       1  3 1401.881 1414.300 -697.9404                           
## mcv1     2  4 1403.879 1420.439 -697.9396 1 vs 2 0.001567308  0.9684
##      Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m2       1  3 1575.462 1587.882 -784.7312                         
## mcv2     2  4 1576.899 1593.459 -784.4496 1 vs 2 0.5630493   0.453
##      Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m3       1  3 2447.338 2459.758 -1220.669                         
## mcv3     2  4 2448.683 2465.242 -1220.341 1 vs 2 0.6553933  0.4182
## [1] "children.binary"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1406.073 1418.505 -700.0365                        
## mcv1     2  4 1406.876 1423.453 -699.4380 1 vs 2 1.197015  0.2739
##      Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m2       1  3 1587.874 1600.307 -790.9372                         
## mcv2     2  4 1589.062 1605.638 -790.5307 1 vs 2 0.8129924  0.3672
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m3       1  3 2460.656 2473.088 -1227.328                        
## mcv3     2  4 2461.101 2477.678 -1226.551 1 vs 2 1.554649  0.2125
## [1] "education.3levels"
##      Model df      AIC      BIC    logLik   Test    L.Ratio p-value
## m1       1  3 1385.941 1398.328 -689.9705                          
## mcv1     2  5 1389.896 1410.541 -689.9478 1 vs 2 0.04538158  0.9776
##      Model df      AIC      BIC   logLik   Test  L.Ratio p-value
## m2       1  3 1566.216 1578.603 -780.108                        
## mcv2     2  5 1569.048 1589.693 -779.524 1 vs 2 1.167952  0.5577
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m3       1  3 2418.121 2430.508 -1206.060                        
## mcv3     2  5 2421.047 2441.692 -1205.523 1 vs 2 1.074016  0.5845
## [1] "marital.status"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1698.657 1711.663 -846.3287                        
## mcv1     2  4 1696.037 1713.377 -844.0186 1 vs 2 4.620259  0.0316
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m2       1  3 1921.240 1934.245 -957.6200                        
## mcv2     2  4 1919.955 1937.295 -955.9774 1 vs 2 3.285205  0.0699
##      Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m3       1  3 2971.427 2984.433 -1482.714                         
## mcv3     2  4 2972.554 2989.894 -1482.277 1 vs 2 0.8738922  0.3499
## [1] "cohab"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1698.657 1711.663 -846.3287                        
## mcv1     2  5 1680.353 1702.029 -835.1766 1 vs 2 22.30414  <.0001
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m2       1  3 1921.240 1934.245 -957.6200                        
## mcv2     2  5 1915.071 1936.746 -952.5355 1 vs 2 10.16901  0.0062
##      Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m3       1  3 2971.427 2984.433 -1482.714                         
## mcv3     2  5 2974.534 2996.209 -1482.267 1 vs 2 0.8933916  0.6397
## [1] "coparent"
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1       1  3 1698.657 1711.663 -846.3287                        
## mcv1     2  5 1698.474 1720.149 -844.2368 1 vs 2 4.183865  0.1234
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m2       1  3 1921.240 1934.245 -957.6200                        
## mcv2     2  5 1920.436 1942.112 -955.2181 1 vs 2 4.803633  0.0906
##      Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m3       1  3 2971.427 2984.433 -1482.714                         
## mcv3     2  5 2974.812 2996.487 -1482.406 1 vs 2 0.6154278  0.7351

After adjusting p-values for multiple comparisons, the following variables were related to within-participant variance:

Avoidance - relationship length, number of partners, gender, and cohabitation.

Anxiety - cohabitation

Satisfaction - number of partners

Model selection for within-participant variability in avoidance

Strategy: start with a model that includes hierarchy (variable of interest), relationship length, number of partners, gender, and cohabitation status. Then perform model selection through a backwards elimination process, that is, only variables that significantly improve a model with fewer variables are left in the final model.

Model with 4 control variables

data <- na.omit(study1.long[c(vars,"rel.length.c","N.Partners.3levels","gender","cohab")])
dv <- data$avoidance
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data[["rel.length.c"]]
cv4 <- data[["N.Partners.3levels"]]
cv5 <- data[["gender"]]
cv11 <- data[["cohab"]]

mcv4 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4), # n partners
              varIdent(form = ~ 1 | cv5), # gender
              varIdent(form = ~ 1 | cv11) # cohab
            ),
            method="ML")
aic3 <- numeric() # vector that will store AIC values for later comparison
mcv3 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)), 
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              #varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4), # n partners
              varIdent(form = ~ 1 | cv5), # gender
              varIdent(form = ~ 1 | cv11) # cohab
            ),
            method="ML")
a1 <- anova(mcv3,mcv4)
aic3[1] <- a1$AIC[2]-a1$AIC[1] # AIC of full minus reduced model

mcv3 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # 1 length
              #varIdent(form = ~ 1 | cv4), # n partners
              varIdent(form = ~ 1 | cv5), # gender
              varIdent(form = ~ 1 | cv11) # cohab
            ),
            method="ML")
a4 <- anova(mcv3,mcv4)
aic3[2] <- a4$AIC[2]-a4$AIC[1] # AIC of full minus reduced model

mcv3 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4), # n partners
              #varIdent(form = ~ 1 | cv5), # gender
              varIdent(form = ~ 1 | cv11) # cohab
            ),
            method="ML")
a5 <- anova(mcv3,mcv4)
aic3[3] <- a5$AIC[2]-a5$AIC[1] # AIC of full minus reduced model

mcv3 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4), # n partners
              varIdent(form = ~ 1 | cv5) # gender
              #varIdent(form = ~ 1 | cv11) # cohab
            ),
            method="ML")
a11 <- anova(mcv3,mcv4)
aic3[4] <- a11$AIC[2]-a11$AIC[1] # AIC of full minus reduced model

print(aic3)
## [1]  -7.822819 -12.915617  -4.199764  -2.843710
pvals <- c(pvals, a1$`p-value`, a4$`p-value`, a5$`p-value`, a11$`p-value`)

Remove cohabitation - it improves the model with 3 control variables, but not by much (after adjusting for multiple testing, improvement is not significant).

Model with 3 control variables

mcv3 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4), # n partners
              varIdent(form = ~ 1 | cv5) # gender
              ),
            method="ML")
aic2 <- numeric() # vector that will store AIC values for later comparison

mcv2 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              #varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4), # n partners
              varIdent(form = ~ 1 | cv5) # gender
              ),
            control=lmeControl(opt = "optim"
                              #opt = "nlminb"
                              #returnObject=TRUE
                              ), 
            method="ML")
a1 <- anova(mcv2,mcv3)
aic2[1] <- a1$AIC[2]-a1$AIC[1] # AIC of full minus reduced model

mcv2 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              #varIdent(form = ~ 1 | cv4), # n partners
              varIdent(form = ~ 1 | cv5) # gender
              ),
            method="ML")
a4 <- anova(mcv2,mcv3)
aic2[2] <- a4$AIC[2]-a4$AIC[1] # AIC of full minus reduced model

mcv2 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4) # n partners
              #varIdent(form = ~ 1 | cv5) # gender
              ),
            method="ML")
a5 <- anova(mcv2,mcv3)
aic2[3] <- a5$AIC[2]-a5$AIC[1] # AIC of full minus reduced model

print(aic2)
## [1] -18.377241 -19.939034  -3.794024
pvals <- c(pvals, a1$`p-value`, a4$`p-value`, a5$`p-value`)

Remove gender - only a small improvement, non-significant after correcting p-value for multiple testing.

aic1 <- numeric()
mcv2 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4) # n partners
              ),
            method="ML")
mcv1 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              #varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4) # n partners
              ),
            method="ML")
a1 <- anova(mcv1, mcv2)
aic1[1] <- a1$AIC[2] - a1$AIC[1]
print(a1)
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## mcv1     1  6 1359.641 1384.428 -673.8205                        
## mcv2     2  7 1339.151 1368.069 -662.5753 1 vs 2 22.49039  <.0001
mcv1 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1) # length
              #varIdent(form = ~ 1 | cv4) # n partners
              ),
            method="ML")
a4 <- anova(mcv1, mcv2)
aic1[2] <- a4$AIC[2] - a4$AIC[1]
print(a4)
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## mcv1     1  5 1367.337 1387.993 -678.6685                        
## mcv2     2  7 1339.151 1368.069 -662.5753 1 vs 2 32.18648  <.0001
pvals <- c(pvals, a1$`p-value`, a4$`p-value`)

Both variables improve the model with hierarchy type only. That is, relationship length and number of partners account for unexplained variability in the model including hierarchy type.

mcv2 <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4) # n partners
              ),
            method="ML")
miv <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              #varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4) # n partners
              ),
            method="ML")
aiv <- anova(miv, mcv2)
print(aiv)
##      Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## miv      1  6 1348.198 1372.985 -668.0990                        
## mcv2     2  7 1339.151 1368.069 -662.5753 1 vs 2 11.04751   9e-04
pvals <- c(pvals, aiv$`p-value`)

Likewise, hierarchy type accounts for unexplained variability in the model including the control variables.

Final model for within-participant avoidance:

var.avoidance <- lme(dv ~ 1, 
                     random = list(id = pdSymm(form = ~ 1)),
                     weights = varComb(
                       varIdent(form = ~ 1 | iv), 
                       varExp(1, ~cv1),
                       varIdent(form = ~ 1 | cv4)
                       ),
                     method="REML")
summary(var.avoidance)
## Linear mixed-effects model fit by REML
##  Data: NULL 
##        AIC      BIC    logLik
##   1343.368 1372.272 -664.6842
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:   0.3738429  1.12048
## 
## Combination of variance functions: 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.298593 
##  Structure: Exponential of variance covariate
##  Formula: ~cv1 
##  Parameter estimates:
##      expon 
## -0.2451602 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | cv4 
##  Parameter estimates:
##        >3         3         2 
## 1.0000000 0.8949205 0.6129542 
## Fixed effects: dv ~ 1 
##                Value  Std.Error  DF  t-value p-value
## (Intercept) 1.853254 0.04848688 274 38.22175       0
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -1.39799141 -0.63526422 -0.05280815  0.77141679  3.64912019 
## 
## Number of Observations: 460
## Number of Groups: 186
res <- resid(var.avoidance, type = "pearson")
fit <- fitted(var.avoidance, level=0)
plot(ranef(var.avoidance, level = 1))

plot(res ~ iv)

plot(res ~ cv1)

plot(res ~ cv4)

qqnorm(res)
qqline(res)

Estimated standard deviations for non-hierarchical and hierarchical groups in the final model:

summary(var.avoidance)$sigma # avoidance, non-hierarchical
## [1] 1.12048
summary(var.avoidance)$sigma*coef(var.avoidance$modelStruct$varStruct, uncons=FALSE) 
## A.Hierarchical        B.expon            C.3            C.2 
##      1.4550482     -0.2746972      1.0027408      0.6868032

Confidence intervals:

intervals(var.avoidance, level = 0.95, which = "all")
## Approximate 95% confidence intervals
## 
##  Fixed effects:
##                lower     est.    upper
## (Intercept) 1.757799 1.853254 1.948708
## attr(,"label")
## [1] "Fixed effects:"
## 
##  Random Effects:
##   Level: id 
##                     lower      est.     upper
## sd((Intercept)) 0.2695546 0.3738429 0.5184794
## 
##  Variance function:
##                     lower       est.      upper
## A.Hierarchical  1.1114660  1.2985932  1.5172253
## B.expon        -0.3581005 -0.2451602 -0.1322198
## C.3             0.7277208  0.8949205  1.1005355
## C.2             0.5032379  0.6129542  0.7465910
## attr(,"label")
## [1] "Variance function:"
## 
##  Within-group standard error:
##     lower      est.     upper 
## 0.9434688 1.1204804 1.3307025

Model selection for within-participant variability in anxiety

Check whether adding cohabitation to a model with hierarchy type improves the model

data <- na.omit(study1.long[c(vars,"cohab")])
dv <- data$anxiety
iv <- data$hierarchy
id <- data$Respondent.ID
cv <- data[["cohab"]] 
m0 <- lme(dv ~ 1, 
          random = list(id = pdSymm(form = ~ 1)),
          weights = varIdent(form = ~ 1 | iv), 
          method="ML")
mcv <- lme(dv ~ 1, 
           random = list(id = pdSymm(form = ~ 1)), 
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varIdent(form = ~ 1 | cv) # cohab
            ),
            method="ML")
a <- anova(m0,mcv)
print(a)
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m0      1  4 1912.517 1929.858 -952.2586                        
## mcv     2  6 1904.627 1930.637 -946.3134 1 vs 2 11.89047  0.0026
pvals <- c(pvals, a$`p-value`)

In a model with heterogeneous within-participant variance by hierarchy type, cohabitation significantly accounts for unexplained within-participant variability in anxiety.

data <- na.omit(study1.long[c(vars,"cohab")])
dv <- data$anxiety
iv <- data$hierarchy
id <- data$Respondent.ID
cv <- data[["cohab"]] 
m0cv <- lme(dv ~ 1, 
            random = list(id = pdSymm(form = ~ 1)),
            weights = varIdent(form = ~ 1 | cv), 
            method="ML")
miv <- lme(dv ~ 1, 
           random = list(id = pdSymm(form = ~ 1)), 
           weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varIdent(form = ~ 1 | cv) # cohab
            ),
            method="ML")
a <- anova(m0cv,miv)
print(a)
##      Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m0cv     1  5 1915.071 1936.746 -952.5355                       
## miv      2  6 1904.627 1930.637 -946.3134 1 vs 2 12.4441   4e-04
pvals <- c(pvals, a$`p-value`)

Final model for within-participant variability in anxiety:

var.anxiety <- lme(dv ~ 1, 
                   random = list(id = pdSymm(form = ~ 1)),
                   weights = varComb(varIdent(form = ~ 1 | iv), 
                                     varIdent(form = ~ 1 | cv)),
                   method="REML")
summary(var.anxiety)
## Linear mixed-effects model fit by REML
##  Data: NULL 
##        AIC      BIC    logLik
##   1908.142 1934.142 -948.0712
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:   0.7648507 1.061122
## 
## Combination of variance functions: 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.292722 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | cv 
##  Parameter estimates:
## Living Separately, Long Distance         Living Separately, local 
##                        1.0000000                        1.0514052 
##                  Living Together 
##                        0.7558595 
## Fixed effects: dv ~ 1 
##                Value  Std.Error  DF  t-value p-value
## (Intercept) 2.135882 0.06886492 339 31.01553       0
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.1112234 -0.5300775 -0.2287174  0.5985833  3.4346434 
## 
## Number of Observations: 564
## Number of Groups: 225
res <- resid(var.anxiety, type = "pearson")
fit <- fitted(var.anxiety, level=0)
plot(ranef(var.anxiety, level = 1))

plot(res ~ iv)

qqnorm(res)
qqline(res)

Model selection for within-participant variability in relationship satisfaction

Check whether adding number of partners to a model with hierarchy type improves de model

data <- na.omit(study1.long[c(vars,"N.Partners.3levels")])
dv <- data$satisfaction
iv <- data$hierarchy
id <- data$Respondent.ID
cv <- data[["N.Partners.3levels"]] 
m0 <- lme(dv ~ 1, 
          random = list(id = pdSymm(form = ~ 1)),
          weights = varIdent(form = ~ 1 | iv), # hierarchy
          method="ML")
mcv <- lme(dv ~ 1, 
           random = list(id = pdSymm(form = ~ 1)), 
           weights = varComb(
             varIdent(form = ~ 1 | iv), 
             varIdent(form = ~ 1 | cv) # number of partners
            ),
            method="ML")
a <- anova(m0,mcv)
print(a)
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m0      1  4 2969.064 2986.405 -1480.532                        
## mcv     2  6 2963.177 2989.187 -1475.589 1 vs 2 9.887362  0.0071
pvals <- c(pvals, a$`p-value`) 

Number of partners significantly accounts for unexplained within-participant variability in satisfaction.

data <- na.omit(study1.long[c(vars,"N.Partners.3levels")])
dv <- data$satisfaction
iv <- data$hierarchy
id <- data$Respondent.ID
cv <- data[["N.Partners.3levels"]] 
m0cv <- lme(dv ~ 1, 
          random = list(id = pdSymm(form = ~ 1)),
          weights = varIdent(form = ~ 1 | cv), # hierarchy
          method="ML")
miv <- lme(dv ~ 1, 
           random = list(id = pdSymm(form = ~ 1)), 
           weights = varComb(
             varIdent(form = ~ 1 | iv), 
             varIdent(form = ~ 1 | cv) # number of partners
            ),
            method="ML")
a <- anova(m0cv,miv)
print(a)
##      Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m0cv     1  5 2965.826 2987.501 -1477.913                       
## miv      2  6 2963.177 2989.187 -1475.589 1 vs 2   4.649  0.0311
pvals <- c(pvals, a$`p-value`) 

Final model for within-participant variability in relationship satisfaction:

var.satisfaction <- lme(dv ~ 1, 
                    random = list(id = pdSymm(form = ~ 1)),
                    weights = varComb(varIdent(form = ~ 1 | iv),
                                      varIdent(form = ~ 1 | cv)),
                    method="REML")
summary(var.satisfaction)
## Linear mixed-effects model fit by REML
##  Data: NULL 
##        AIC      BIC    logLik
##   2964.907 2990.907 -1476.454
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.753299 3.272212
## 
## Combination of variance functions: 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.166539 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | cv 
##  Parameter estimates:
##        >3         3         2 
## 1.0000000 0.8775893 0.7517948 
## Fixed effects: dv ~ 1 
##                Value Std.Error  DF  t-value p-value
## (Intercept) 16.09517 0.1681368 339 95.72663       0
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -3.27521043 -0.63054468  0.08644708  0.68576033  1.87229014 
## 
## Number of Observations: 564
## Number of Groups: 225
res <- resid(var.satisfaction, type = "pearson")
fit <- fitted(var.satisfaction, level=0)
plot(ranef(var.satisfaction, level = 1))

plot(res ~ iv)

qqnorm(res)
qqline(res)

Avoidance, Anxiety, and relationship satisfaction by hierarchy type

Here we use the same variance models from the previous analyses and add fixed effects to it.

Avoidance

Step 1: add hierarchy type to model from previous analysis

data <- na.omit(study1.long[c(vars,"rel.length.c","N.Partners.3levels")])
dv <- data$avoidance
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data[["rel.length.c"]] 
cv4 <- data[["N.Partners.3levels"]] 

m.avoid <- lme(dv ~ 1, 
               random = list(id = pdSymm(form = ~ 1)), 
               weights = varComb(
                 varIdent(form = ~ 1 | iv), 
                 varExp(1, ~cv1), # length
                 varIdent(form = ~ 1 | cv4) # number of partners
                 ),
               method="ML")

m.avoid.h <- lme(dv ~ iv, 
                 random = list(id = pdSymm(form = ~ 1)), 
                 weights = varComb(
                   varIdent(form = ~ 1 | iv), 
                   varExp(1, ~cv1), # length
                   varIdent(form = ~ 1 | cv4) # number of partners
                 ),
                 method="ML")
a <- anova(m.avoid, m.avoid.h); print(a)
##           Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m.avoid       1  7 1631.025 1661.296 -808.5127                       
## m.avoid.h     2  8 1616.309 1650.904 -800.1547 1 vs 2  16.716  <.0001
summary(m.avoid.h)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1616.309 1650.904 -800.1547
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:   0.3007553 1.066648
## 
## Combination of variance functions: 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.334169 
##  Structure: Exponential of variance covariate
##  Formula: ~cv1 
##  Parameter estimates:
##      expon 
## -0.1589828 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | cv4 
##  Parameter estimates:
##        >3         3         2 
## 1.0000000 0.9096141 0.6829270 
## Fixed effects: dv ~ iv 
##                        Value  Std.Error  DF   t-value p-value
## (Intercept)        2.1804693 0.07532642 333 28.946939       0
## ivNonHierarchical -0.3996034 0.09211576 223 -4.338057       0
##  Correlation: 
##                   (Intr)
## ivNonHierarchical -0.818
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -1.52140835 -0.68782754 -0.09703162  0.68923546  4.13118995 
## 
## Number of Observations: 558
## Number of Groups: 225
pvals <- c(pvals, a$`p-value`)

Adding hierarchy type as a fixed effect improved the variance-only model for avoidance.

Step 2: control variables

Checking which potential control variables are related to avoidance:

for(x in cvs){
  if(x != "rel.length.c" & x != "N.Partners.3levels"){
    data <- na.omit(study1.long[c(vars,"rel.length.c","N.Partners.3levels",x)])
  } else {
    data <- na.omit(study1.long[c(vars,"rel.length.c","N.Partners.3levels")])
    }
  print(x)
  dv <- data$avoidance
  iv <- data$hierarchy
  id <- data$Respondent.ID
  cv1 <- data$rel.length.c
  cv4 <- data$N.Partners.3levels
  cv <- data[[x]]
  m1 <- lme(dv ~ 1, random = list(id = pdSymm(form = ~ 1)),
            weights = varComb(
              varIdent(form = ~ 1 | iv), 
              varExp(1, ~cv1), # length
              varIdent(form = ~ 1 | cv4) # number of partners
              ),
            method="ML")
  mcv <- lme(dv ~ cv, random = list(id = pdSymm(form = ~ 1)), 
            weights = varComb(
                 varIdent(form = ~ 1 | iv), 
                 varExp(1, ~cv1), # length
                 varIdent(form = ~ 1 | cv4) # number of partners
                 ),
            method="ML")
  a1 <- anova(m1,mcv); print(a1)
  pvals <- c(pvals, a1$`p-value`)
}
## [1] "rel.length.c"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  7 1631.025 1661.296 -808.5127                        
## mcv     2  8 1571.818 1606.413 -777.9089 1 vs 2 61.20755  <.0001
## [1] "age.c"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  7 1631.025 1661.296 -808.5127                        
## mcv     2  8 1630.423 1665.018 -807.2116 1 vs 2 2.602187  0.1067
## [1] "incomeperPPL.c"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  7 1264.281 1292.727 -625.1405                        
## mcv     2  8 1265.613 1298.123 -624.8065 1 vs 2 0.668069  0.4137
## [1] "N.Partners.3levels"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  7 1631.025 1661.296 -808.5127                        
## mcv     2  9 1621.103 1660.023 -801.5516 1 vs 2 13.92204   9e-04
## [1] "gender"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  7 1339.151 1368.069 -662.5753                        
## mcv     2  9 1341.357 1378.538 -661.6783 1 vs 2 1.793924  0.4078
## [1] "orientation.binary"
##     Model df      AIC      BIC    logLik   Test     L.Ratio p-value
## m1      1  7 1327.215 1356.073 -656.6077                           
## mcv     2  8 1329.213 1362.193 -656.6064 1 vs 2 0.002461744  0.9604
## [1] "race.binary"
##     Model df      AIC      BIC    logLik   Test    L.Ratio p-value
## m1      1  7 1335.926 1364.814 -660.9630                          
## mcv     2  8 1337.913 1370.928 -660.9564 1 vs 2 0.01326153  0.9083
## [1] "children.binary"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  7 1339.151 1368.069 -662.5753                        
## mcv     2  8 1335.830 1368.879 -659.9147 1 vs 2 5.321132  0.0211
## [1] "education.3levels"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  7 1318.133 1346.944 -652.0666                        
## mcv     2  9 1319.947 1356.991 -650.9737 1 vs 2 2.185765  0.3352
## [1] "marital.status"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  7 1631.025 1661.296 -808.5127                        
## mcv     2  8 1574.408 1609.003 -779.2040 1 vs 2 58.61739  <.0001
## [1] "cohab"
##     Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m1      1  7 1631.025 1661.296 -808.5127                       
## mcv     2  9 1571.167 1610.086 -776.5835 1 vs 2 63.8583  <.0001
## [1] "coparent"
##     Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m1      1  7 1631.025 1661.296 -808.5127                       
## mcv     2  9 1605.653 1644.572 -793.8263 1 vs 2 29.3727  <.0001

The following variables were related to avoidance: relationship length, number of partners, marital status, cohabitation, and coparenting. PS: After adjusting for multiple testing, children (p=0.02) is not a significant predictor.

Model selection strategy: start with a model that includes hierarchy (iv of interest), relationship length, number of partners, marital status, cohabitation status, and coparenting status, all as fixed effects variables. Then perform model selection through a backwards elimination process, that is, only variables that significantly improve a model with fewer variables are left in the final model.

cvs.avoid.fix <- c("rel.length.c", "N.Partners.3levels",
                   "marital.status", "cohab", "coparent") 
data <- na.omit(study1.long[c(vars,cvs.avoid.fix)])
dv <- data$avoidance
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv4 <- data$N.Partners.3levels
cv10 <- data$marital.status
cv11 <- data$cohab
cv12 <- data$coparent
aic0 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv4 + cv10 + cv11 + cv12,
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varComb(
            varIdent(form = ~ 1 | iv), 
            varExp(1, ~cv1), # length
            varIdent(form = ~ 1 | cv4) # number of partners
          ),
          method="ML")

print(cvs.avoid.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 15 1542.469 1607.334 -756.2343                        
## m0     2 16 1534.467 1603.656 -751.2333 1 vs 2 10.00203  0.0016
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[2])
## [1] "N.Partners.3levels"
m <- update(m0, .~. -cv4)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 14 1534.653 1595.194 -753.3266                        
## m0     2 16 1534.467 1603.656 -751.2333 1 vs 2 4.186693  0.1233
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[3])
## [1] "marital.status"
m <- update(m0, .~. -cv10)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[3] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 15 1533.913 1598.779 -751.9567                        
## m0     2 16 1534.467 1603.656 -751.2333 1 vs 2 1.446789   0.229
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[4])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[4] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 14 1540.894 1601.436 -756.4472                        
## m0     2 16 1534.467 1603.656 -751.2333 1 vs 2 10.42784  0.0054
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[5])
## [1] "coparent"
m <- update(m0, .~. -cv12)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[5] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m      1 14 1530.730 1591.271 -751.3651                       
## m0     2 16 1534.467 1603.656 -751.2333 1 vs 2  0.2637  0.8765
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -8.0020353 -0.1866934  0.5532115 -6.4278388  3.7363000

Remove coparenting - it does not improve model with 4 control variables and increases AIC the most.

cvs.avoid.fix <- c("rel.length.c", "N.Partners.3levels",
                   "marital.status", "cohab") 
aic0 <- numeric()
data <- na.omit(study1.long[c(vars,cvs.avoid.fix)])
dv <- data$avoidance
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv4 <- data$N.Partners.3levels
cv10 <- data$marital.status
cv11 <- data$cohab
aic1 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv4 + cv10 + cv11, 
                random = list(id = pdSymm(form = ~ 1)), 
                weights = varComb(
                  varIdent(form = ~ 1 | iv), 
                  varExp(1, ~cv1), # length
                  varIdent(form = ~ 1 | cv4) # number of partners
                  ),
            method="ML")

print(cvs.avoid.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 13 1540.177 1596.394 -757.0886                        
## m0     2 14 1530.730 1591.271 -751.3651 1 vs 2 11.44684   7e-04
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[2])
## [1] "N.Partners.3levels"
m <- update(m0, .~. -cv4)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 12 1530.774 1582.667 -753.3873                        
## m0     2 14 1530.730 1591.271 -751.3651 1 vs 2 4.044229  0.1324
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[3])
## [1] "marital.status"
m <- update(m0, .~. -cv10)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[3] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 13 1530.151 1586.368 -752.0755                        
## m0     2 14 1530.730 1591.271 -751.3651 1 vs 2 1.420667  0.2333
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[4])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[4] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 12 1537.077 1588.970 -756.5386                        
## m0     2 14 1530.730 1591.271 -751.3651 1 vs 2 10.34701  0.0057
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -9.44684043 -0.04422927  0.57933324 -6.34700617

Remove marital status - it does not improve model with 3 control variables and increases AIC the most.

cvs.avoid.fix <- c("rel.length.c", "N.Partners.3levels", "cohab") 
aic0 <- numeric()
data <- na.omit(study1.long[c(vars,cvs.avoid.fix)])
dv <- data$avoidance
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv4 <- data$N.Partners.3levels
cv11 <- data$cohab
aic1 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv4 + cv11, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varComb(
            varIdent(form = ~ 1 | iv), 
            varExp(1, ~cv1), # length
            varIdent(form = ~ 1 | cv4) # number of partners
            ),
          method="ML")

print(cvs.avoid.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 12 1554.472 1606.364 -765.2361                        
## m0     2 13 1530.151 1586.368 -752.0755 1 vs 2 26.32116  <.0001
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[2])
## [1] "N.Partners.3levels"
m <- update(m0, .~. -cv4)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 11 1530.866 1578.434 -754.4328                        
## m0     2 13 1530.151 1586.368 -752.0755 1 vs 2 4.714721  0.0947
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[3])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[3] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 11 1542.581 1590.148 -760.2902                        
## m0     2 13 1530.151 1586.368 -752.0755 1 vs 2 16.42951   3e-04
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -24.321164  -0.714721 -12.429509

Remove number of partners - it has a small, non-significant improvement in the model.

cvs.avoid.fix <- c("rel.length.c", "cohab") 
aic0 <- numeric()
data <- na.omit(study1.long[c(vars,cvs.avoid.fix)])
dv <- data$avoidance
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv11 <- data$cohab
aic1 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv11, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varComb(
            varIdent(form = ~ 1 | iv), 
            varExp(1, ~cv1), # length
            varIdent(form = ~ 1 | cv4) # number of partners
            ),
          method="ML")

print(cvs.avoid.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 10 1554.021 1597.265 -767.0105                        
## m0     2 11 1530.866 1578.434 -754.4328 1 vs 2 25.15542  <.0001
pvals <- c(pvals, a$`p-value`)

print(cvs.avoid.fix[2])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  9 1547.867 1586.786 -764.9335                        
## m0     2 11 1530.866 1578.434 -754.4328 1 vs 2 21.00124  <.0001
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -23.15542 -17.00124

Keep length of relationship and cohabitation status - both significantly improve the model

cvs.avoid.fix <- c("rel.length.c", "cohab") 
aic0 <- numeric()
data <- na.omit(study1.long[c(vars,cvs.avoid.fix)])
dv <- data$avoidance
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv11 <- data$cohab
aic1 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv11, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varComb(
            varIdent(form = ~ 1 | iv), 
            varExp(1, ~cv1), # length
            varIdent(form = ~ 1 | cv4) # number of partners
            ),
          method="ML")

print(cvs.avoid.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -iv)
a <- anova(m,m0)
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 10 1554.332 1597.576 -767.1660                        
## m0     2 11 1530.866 1578.434 -754.4328 1 vs 2 25.46638  <.0001
pvals <- c(pvals, a$`p-value`)

Hierarchy type improves a model with the CVs.

Residual plots:

summary(m0)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1530.866 1578.434 -754.4328
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept)  Residual
## StdDev:   0.2857844 0.9621063
## 
## Combination of variance functions: 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.232694 
##  Structure: Exponential of variance covariate
##  Formula: ~cv1 
##  Parameter estimates:
##      expon 
## -0.2443413 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | cv4 
##  Parameter estimates:
##        >3         3         2 
## 1.0000000 0.9252155 0.7461111 
## Fixed effects: dv ~ iv + cv1 + cv11 
##                                           Value  Std.Error  DF   t-value
## (Intercept)                           2.4571677 0.08247076 330 29.794411
## ivNonHierarchical                    -0.4326165 0.08266449 223 -5.233402
## cv1                                  -0.1579385 0.03066157 330 -5.151024
## cv11Living Separately, Long Distance -0.0129656 0.11883148 330 -0.109109
## cv11Living Together                  -0.4098462 0.09478961 330 -4.323746
##                                      p-value
## (Intercept)                           0.0000
## ivNonHierarchical                     0.0000
## cv1                                   0.0000
## cv11Living Separately, Long Distance  0.9132
## cv11Living Together                   0.0000
##  Correlation: 
##                                      (Intr) ivNnHr cv1    c11SLD
## ivNonHierarchical                    -0.620                     
## cv1                                   0.064  0.125              
## cv11Living Separately, Long Distance -0.405 -0.022 -0.204       
## cv11Living Together                  -0.529 -0.047 -0.552  0.445
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -1.5885507 -0.7113122 -0.1979085  0.5684950  3.9868007 
## 
## Number of Observations: 558
## Number of Groups: 225
res <- resid(m0, type = "pearson")
fit <- fitted(m0, level=0)
plot(ranef(m0, level = 1))

plot(res ~ iv)

plot(res ~ cv1)

plot(res ~ cv11)

qqnorm(res)
qqline(res)

Differences in avoidance between non-hierarchical relationships and 3 levels of hierarchy (primary, secondary, and tertiary partners)

Checking whether avoidance in non-hierarchical relationships differ from those in primary, secondary, and tertiary relationships:

data <- na.omit(study1.long[c(vars,"hierarchy2","N.Partners.3levels", "rel.length.c","cohab")])
dv <- data$avoidance
iv <- data$hierarchy # 2 levels: hierarchical & non-hierarchical
iv2 <- data$hierarchy2 # 4 leveles: non-hierarchical, primary, secondary, and tertiary
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv4 <- data$N.Partners.3levels
cv11 <- data$cohab

m.avoid <- lme(dv ~ 1, 
               random = list(id = pdSymm(form = ~ 1)), 
               weights = varComb(
                 varIdent(form = ~ 1 | iv), 
                 varExp(1, ~cv1), # length
                 varIdent(form = ~ 1 | cv4) # number of partners
                 ),
               method="ML")

m.avoid.h <- lme(dv ~ iv2, 
                 random = list(id = pdSymm(form = ~ 1)), 
                 weights = varComb(
                   varIdent(form = ~ 1 | iv), 
                   varExp(1, ~cv1), # length
                   varIdent(form = ~ 1 | cv4) # number of partners
                   ),
                method="ML")

m.avoid.hcv <- lme(dv ~ iv2 + cv1 + cv11, 
                   random = list(id = pdSymm(form = ~ 1)), 
                   weights = varComb(
                     varIdent(form = ~ 1 | iv), 
                     varExp(1, ~cv1), # length
                     varIdent(form = ~ 1 | cv4) # number of partners
                     ),
                   method="ML")
print(anova(m.avoid, m.avoid.h, m.avoid.hcv))
##             Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m.avoid         1  7 1631.025 1661.296 -808.5127                         
## m.avoid.h       2 11 1517.805 1565.373 -747.9023 1 vs 2 121.22067  <.0001
## m.avoid.hcv     3 14 1487.905 1548.446 -729.9523 2 vs 3  35.90009  <.0001
summary(m.avoid)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1631.025 1661.296 -808.5127
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:   0.3729916 1.044518
## 
## Combination of variance functions: 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.387752 
##  Structure: Exponential of variance covariate
##  Formula: ~cv1 
##  Parameter estimates:
##      expon 
## -0.2166751 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | cv4 
##  Parameter estimates:
##        >3         3         2 
## 1.0000000 0.9022662 0.6753020 
## Fixed effects: dv ~ 1 
##                Value  Std.Error  DF  t-value p-value
## (Intercept) 1.884467 0.04491353 333 41.95767       0
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -1.52312184 -0.64435785 -0.06007659  0.75089252  3.88281866 
## 
## Number of Observations: 558
## Number of Groups: 225
summary(m.avoid.h)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1517.805 1565.373 -747.9023
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:   0.3824019 1.051132
## 
## Combination of variance functions: 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##         1.00000         1.05426 
##  Structure: Exponential of variance covariate
##  Formula: ~cv1 
##  Parameter estimates:
##      expon 
## -0.2173105 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | cv4 
##  Parameter estimates:
##        >3         3         2 
## 1.0000000 0.8861006 0.6673136 
## Fixed effects: dv ~ iv2 
##                   Value  Std.Error  DF  t-value p-value
## (Intercept)   1.7633776 0.05569555 329 31.66101  0.0000
## iv2Other      1.0512247 0.26335131 329  3.99172  0.0001
## iv2Primary   -0.1287850 0.09598497 329 -1.34172  0.1806
## iv2Secondary  0.9270025 0.11643425 329  7.96160  0.0000
## iv2Tertiary   1.7063925 0.22573872 329  7.55915  0.0000
##  Correlation: 
##              (Intr) iv2Oth iv2Prm iv2Scn
## iv2Other     -0.211                     
## iv2Primary   -0.580  0.168              
## iv2Secondary -0.478  0.127  0.421       
## iv2Tertiary  -0.247  0.060  0.195  0.152
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0144395 -0.6164220 -0.1136943  0.5695850  3.9809269 
## 
## Number of Observations: 558
## Number of Groups: 225
summary(m.avoid.hcv)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1487.905 1548.446 -729.9523
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept)  Residual
## StdDev:   0.3309848 0.9593045
## 
## Combination of variance functions: 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.116213 
##  Structure: Exponential of variance covariate
##  Formula: ~cv1 
##  Parameter estimates:
##      expon 
## -0.2523947 
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | cv4 
##  Parameter estimates:
##        >3         3         2 
## 1.0000000 0.9200493 0.7185425 
## Fixed effects: dv ~ iv2 + cv1 + cv11 
##                                           Value  Std.Error  DF   t-value
## (Intercept)                           1.9126557 0.07416250 326 25.790066
## iv2Other                              0.9321925 0.25859749 326  3.604801
## iv2Primary                            0.0856490 0.09602067 326  0.891985
## iv2Secondary                          0.7589260 0.12083781 326  6.280534
## iv2Tertiary                           1.5239990 0.22640467 326  6.731306
## cv1                                  -0.1177103 0.03069555 326 -3.834768
## cv11Living Separately, Long Distance  0.0276351 0.11540364 326  0.239465
## cv11Living Together                  -0.2368111 0.09632493 326 -2.458461
##                                      p-value
## (Intercept)                           0.0000
## iv2Other                              0.0004
## iv2Primary                            0.3731
## iv2Secondary                          0.0000
## iv2Tertiary                           0.0000
## cv1                                   0.0002
## cv11Living Separately, Long Distance  0.8109
## cv11Living Together                   0.0145
##  Correlation: 
##                                      (Intr) iv2Oth iv2Prm iv2Scn iv2Trt
## iv2Other                             -0.178                            
## iv2Primary                           -0.244  0.123                     
## iv2Secondary                         -0.472  0.124  0.248              
## iv2Tertiary                          -0.261  0.061  0.118  0.171       
## cv1                                   0.162  0.006 -0.204  0.044  0.003
## cv11Living Separately, Long Distance -0.475  0.014 -0.013  0.058  0.045
## cv11Living Together                  -0.671  0.053 -0.140  0.234  0.140
##                                      cv1    c11SLD
## iv2Other                                          
## iv2Primary                                        
## iv2Secondary                                      
## iv2Tertiary                                       
## cv1                                               
## cv11Living Separately, Long Distance -0.200       
## cv11Living Together                  -0.455  0.444
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -1.9578732 -0.6828616 -0.1928818  0.5702773  4.0908065 
## 
## Number of Observations: 558
## Number of Groups: 225

After controling for relationship length and cohabitation, avoidance in non-hierarchical relationships is lower, on average, than avoidance in secondary and tertiary relationships, but is at a similar level as primary ones.

Anxiety

Step 1: add hierarchy type to model from previous analysis

data <- na.omit(study1.long[vars])
dv <- data$anxiety
iv <- data$hierarchy
id <- data$Respondent.ID

m.anx <- lme(dv ~ 1, random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv), 
            method="ML")

m.anx.h <- lme(dv ~ iv, random = list(id = pdSymm(form = ~ 1)), 
               weights = varIdent(form = ~ 1 | iv), 
               method="ML")

summary(m.anx.h)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1900.971 1922.647 -945.4857
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:   0.7270242 1.012684
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.258141 
## Fixed effects: dv ~ iv 
##                        Value Std.Error  DF   t-value p-value
## (Intercept)        2.5509474 0.1104378 339 23.098493   0e+00
## ivNonHierarchical -0.5251889 0.1406963 223 -3.732784   2e-04
##  Correlation: 
##                   (Intr)
## ivNonHierarchical -0.785
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.3699878 -0.5642526 -0.3003285  0.5140620  3.5548607 
## 
## Number of Observations: 564
## Number of Groups: 225
a <- anova(m.anx, m.anx.h); print(a)
##         Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m.anx       1  4 1912.517 1929.858 -952.2586                        
## m.anx.h     2  5 1900.972 1922.647 -945.4857 1 vs 2 13.54583   2e-04
pvals <- c(pvals, a$`p-value`)

Adding hierarchy type as a fixed effect improved the variance model (no fixed effects) for anxiety.

Step 2: control variables

Checking which potential control variables are related to anxiety:

for(x in cvs){
  data <- na.omit(study1.long[c(vars,x)])
  print(x)
  dv <- data$anxiety
  iv <- data$hierarchy
  id <- data$Respondent.ID
  cv <- data[[x]]
  m1 <- lme(dv ~ 1, random = list(id = pdSymm(form = ~ 1)),
            weights = varIdent(form = ~ 1 | iv), 
            method="ML")
  mcv <- lme(dv ~ cv, random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv),
            method="ML")
  a <- anova(m1,mcv)
  print(a)
  pvals <- c(pvals, a$`p-value`)
}
## [1] "rel.length.c"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1889.623 1906.921 -940.8116                        
## mcv     2  5 1853.985 1875.606 -921.9923 1 vs 2 37.63856  <.0001
## [1] "age.c"
##     Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m1      1  4 1912.517 1929.858 -952.2586                         
## mcv     2  5 1913.950 1935.626 -951.9751 1 vs 2 0.5670111  0.4514
## [1] "incomeperPPL.c"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1488.719 1505.030 -740.3597                        
## mcv     2  5 1490.355 1510.744 -740.1777 1 vs 2 0.364047  0.5463
## [1] "N.Partners.3levels"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1912.517 1929.858 -952.2586                        
## mcv     2  6 1914.753 1940.763 -951.3764 1 vs 2 1.764562  0.4138
## [1] "gender"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1581.768 1598.345 -786.8839                        
## mcv     2  6 1583.705 1608.570 -785.8526 1 vs 2 2.062734  0.3565
## [1] "orientation.binary"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1558.268 1574.802 -775.1341                        
## mcv     2  5 1556.183 1576.850 -773.0913 1 vs 2 4.085704  0.0432
## [1] "race.binary"
##     Model df      AIC      BIC    logLik   Test      L.Ratio p-value
## m1      1  4 1569.976 1586.536 -780.9881                            
## mcv     2  5 1571.976 1592.675 -780.9880 1 vs 2 0.0002802241  0.9866
## [1] "children.binary"
##     Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m1      1  4 1581.768 1598.345 -786.8839                         
## mcv     2  5 1583.352 1604.073 -786.6760 1 vs 2 0.4157617  0.5191
## [1] "education.3levels"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1560.868 1577.384 -776.4339                        
## mcv     2  6 1563.118 1587.892 -775.5587 1 vs 2 1.750394  0.4168
## [1] "marital.status"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1912.517 1929.858 -952.2586                        
## mcv     2  5 1884.621 1906.296 -937.3104 1 vs 2 29.89654  <.0001
## [1] "cohab"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1912.517 1929.858 -952.2586                        
## mcv     2  6 1873.617 1899.628 -930.8086 1 vs 2 42.90002  <.0001
## [1] "coparent"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 1912.517 1929.858 -952.2586                        
## mcv     2  6 1905.634 1931.644 -946.8169 1 vs 2 10.88358  0.0043

The following variables were related to anxiety: relationship length, sexual orientation, marital status, cohabitation, co-parenting.

Model selection strategy: start with a model that includes hierarchy (iv of interest), relationship length, sexual orientation, marital status, cohabitation, co-parenting, all as fixed effects variables. Then perform model selection through a backwards elimination process.

cvs.anx.fix <- c("rel.length.c", "orientation", "marital.status", "cohab", "coparent") 
data <- na.omit(study1.long[c(vars,cvs.anx.fix)])
dv <- data$anxiety
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv6 <- data$orientation
cv10 <- data$marital.status
cv11 <- data$cohab
cv12 <- data$coparent
aic0 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv6 + cv10 + cv11 + cv12, 
                random = list(id = pdSymm(form = ~ 1)), 
                weights = varIdent(form = ~ 1 | iv), 
            method="ML")

print(cvs.anx.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 17 1521.022 1591.253 -743.5111                        
## m0     2 18 1517.847 1592.209 -740.9235 1 vs 2 5.175343  0.0229
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[2])
## [1] "orientation"
m <- update(m0, .~. -cv6)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 11 1513.181 1558.624 -745.5903                        
## m0     2 18 1517.847 1592.209 -740.9235 1 vs 2 9.333689  0.2296
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[3])
## [1] "marital.status"
m <- update(m0, .~. -cv10)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[3] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m      1 17 1516.114 1586.345 -741.0571                         
## m0     2 18 1517.847 1592.209 -740.9235 1 vs 2 0.2672973  0.6052
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[4])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[4] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 16 1526.345 1592.444 -747.1723                        
## m0     2 18 1517.847 1592.209 -740.9235 1 vs 2 12.49774  0.0019
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[5])
## [1] "coparent"
m <- update(m0, .~. -cv12)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[5] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 16 1515.306 1581.406 -741.6530                        
## m0     2 18 1517.847 1592.209 -740.9235 1 vs 2 1.459097  0.4821
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -3.175343  4.666311  1.732703 -8.497738  2.540903

Remove coparenting - it does not improve model with 4 control variables and increases AIC the most.

cvs.anx.fix <- c("rel.length.c", "orientation", "marital.status", "cohab") 
data <- na.omit(study1.long[c(vars,cvs.anx.fix)])
dv <- data$anxiety
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv6 <- data$orientation
cv10 <- data$marital.status
cv11 <- data$cohab
aic0 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv6 + cv10 + cv11, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varIdent(form = ~ 1 | iv), 
          method="ML")

print(cvs.anx.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 15 1517.321 1579.289 -743.6602                        
## m0     2 16 1515.306 1581.406 -741.6530 1 vs 2 4.014495  0.0451
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[2])
## [1] "orientation"
m <- update(m0, .~. -cv6)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC   logLik   Test  L.Ratio p-value
## m      1  9 1510.106 1547.287 -746.053                        
## m0     2 16 1515.306 1581.406 -741.653 1 vs 2 8.800016  0.2673
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[3])
## [1] "marital.status"
m <- update(m0, .~. -cv10)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[3] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m      1 15 1513.449 1575.418 -741.7248                         
## m0     2 16 1515.306 1581.406 -741.6530 1 vs 2 0.1435067  0.7048
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[4])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[4] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1 14 1523.208 1581.045 -747.6041                        
## m0     2 16 1515.306 1581.406 -741.6530 1 vs 2 11.90224  0.0026
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -2.014495  5.199984  1.856493 -7.902243

Remove orientation - it does not improve a model with 3 control variables and it increases AIC the most.

cvs.anx.fix <- c("rel.length.c", "marital.status", "cohab") 
data <- na.omit(study1.long[c(vars,cvs.anx.fix)])
dv <- data$anxiety
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv10 <- data$marital.status
cv11 <- data$cohab
aic0 <- numeric()

m0 <- lme(dv ~ iv + cv1 + cv10 + cv11, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varIdent(form = ~ 1 | iv), 
          method="ML")

print(cvs.anx.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  8 1835.759 1870.354 -909.8798                        
## m0     2  9 1831.461 1870.380 -906.7305 1 vs 2 6.298463  0.0121
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[2])
## [1] "marital.status"
m <- update(m0, .~. -cv10)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m      1  8 1829.702 1864.297 -906.8510                         
## m0     2  9 1831.461 1870.380 -906.7305 1 vs 2 0.2410078  0.6235
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[3])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[3] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  7 1838.741 1869.012 -912.3707                        
## m0     2  9 1831.461 1870.380 -906.7305 1 vs 2 11.28028  0.0036
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -4.298463  1.758992 -7.280277

Remove marital status.

cvs.anx.fix <- c("rel.length.c", "cohab") 
data <- na.omit(study1.long[c(vars,cvs.anx.fix)])
dv <- data$anxiety
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv11 <- data$cohab
aic0 <- numeric()

m0 <- lme(dv ~ iv + cv1 + cv11, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varIdent(form = ~ 1 | iv), 
          method="ML")

print(cvs.anx.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  7 1840.053 1870.323 -913.0264                        
## m0     2  8 1829.702 1864.297 -906.8510 1 vs 2 12.35068   4e-04
pvals <- c(pvals, a$`p-value`)

print(cvs.anx.fix[2])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  6 1840.161 1866.108 -914.0808                        
## m0     2  8 1829.702 1864.297 -906.8510 1 vs 2 14.45945   7e-04
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -10.35068 -10.45945

Keep relationship length and cohabitation.

summary(m0)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC   logLik
##   1829.702 1864.297 -906.851
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept)  Residual
## StdDev:   0.7597411 0.9573307
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.202774 
## Fixed effects: dv ~ iv + cv1 + cv11 
##                                           Value  Std.Error  DF   t-value
## (Intercept)                           2.7506465 0.12221267 330 22.507049
## ivNonHierarchical                    -0.5434799 0.13959761 223 -3.893189
## cv1                                  -0.2122172 0.06029459 330 -3.519673
## cv11Living Separately, Long Distance -0.0406754 0.15228300 330 -0.267104
## cv11Living Together                  -0.4729560 0.13040235 330 -3.626898
##                                      p-value
## (Intercept)                           0.0000
## ivNonHierarchical                     0.0001
## cv1                                   0.0005
## cv11Living Separately, Long Distance  0.7896
## cv11Living Together                   0.0003
##  Correlation: 
##                                      (Intr) ivNnHr cv1    c11SLD
## ivNonHierarchical                    -0.661                     
## cv1                                   0.198  0.075              
## cv11Living Separately, Long Distance -0.316 -0.037 -0.182       
## cv11Living Together                  -0.437 -0.050 -0.548  0.381
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.9022303 -0.5992908 -0.2149004  0.4898987  3.4076844 
## 
## Number of Observations: 558
## Number of Groups: 225

Residual plots:

res <- resid(m0, type = "pearson")
fit <- fitted(m0, level=0)
plot(ranef(m0, level = 1))

plot(res ~ iv)

plot(res ~ cv1) # rel. length

plot(res ~ cv11) # cohab

qqnorm(res)
qqline(res)

Differences in anxiety between non-hierarchical relationships and 3 levels of hierarchy (primary, secondary, and tertiary partners)

data <- na.omit(study1.long[c(vars,"hierarchy2","rel.length.c","cohab")])
dv <- data$anxiety
iv <- data$hierarchy
iv2 <- data$hierarchy2
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv11 <- data$cohab

m.anx <- lme(dv ~ 1, random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv), 
            method="ML")

m.anx.h <- lme(dv ~ iv2, random = list(id = pdSymm(form = ~ 1)), 
               weights = varIdent(form = ~ 1 | iv), 
               method="ML")

m.anx.hcv <- lme(dv ~ iv2 + cv1 + cv11, random = list(id = pdSymm(form = ~ 1)), 
               weights = varIdent(form = ~ 1 | iv), 
               method="ML")

print(anova(m.anx, m.anx.h, m.anx.hcv))
##           Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m.anx         1  4 1889.623 1906.921 -940.8116                        
## m.anx.h       2  8 1851.256 1885.851 -917.6280 1 vs 2 46.36725  <.0001
## m.anx.hcv     3 11 1829.198 1876.766 -903.5989 2 vs 3 28.05813  <.0001
summary(m.anx.h)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC   logLik
##   1851.256 1885.851 -917.628
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:   0.7747196 1.003007
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.132424 
## Fixed effects: dv ~ iv2 
##                   Value Std.Error  DF   t-value p-value
## (Intercept)   2.0335325 0.0904697 329 22.477502  0.0000
## iv2Other      0.6532175 0.3273944 329  1.995201  0.0468
## iv2Primary   -0.0167979 0.1660676 329 -0.101151  0.9195
## iv2Secondary  0.9280205 0.1686191 329  5.503650  0.0000
## iv2Tertiary   0.9570468 0.2864278 329  3.341319  0.0009
##  Correlation: 
##              (Intr) iv2Oth iv2Prm iv2Scn
## iv2Other     -0.276                     
## iv2Primary   -0.545  0.268              
## iv2Secondary -0.537  0.232  0.513       
## iv2Tertiary  -0.316  0.123  0.294  0.272
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.4489913 -0.5054803 -0.2632330  0.4339564  3.5330230 
## 
## Number of Observations: 558
## Number of Groups: 225
summary(m.anx.hcv)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   1829.198 1876.766 -903.5989
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept)  Residual
## StdDev:   0.7692255 0.9550746
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.179662 
## Fixed effects: dv ~ iv2 + cv1 + cv11 
##                                           Value Std.Error  DF   t-value
## (Intercept)                           2.1721841 0.1103088 326 19.691853
## iv2Other                              0.5374539 0.3260970 326  1.648141
## iv2Primary                            0.2853026 0.1740617 326  1.639089
## iv2Secondary                          0.7382674 0.1711560 326  4.313418
## iv2Tertiary                           0.7899550 0.2867508 326  2.754849
## cv1                                  -0.1752501 0.0618196 326 -2.834862
## cv11Living Separately, Long Distance -0.0371184 0.1519449 326 -0.244289
## cv11Living Together                  -0.3763038 0.1356738 326 -2.773593
##                                      p-value
## (Intercept)                           0.0000
## iv2Other                              0.1003
## iv2Primary                            0.1022
## iv2Secondary                          0.0000
## iv2Tertiary                           0.0062
## cv1                                   0.0049
## cv11Living Separately, Long Distance  0.8072
## cv11Living Together                   0.0059
##  Correlation: 
##                                      (Intr) iv2Oth iv2Prm iv2Scn iv2Trt
## iv2Other                             -0.243                            
## iv2Primary                           -0.360  0.229                     
## iv2Secondary                         -0.496  0.238  0.405              
## iv2Tertiary                          -0.307  0.128  0.240  0.286       
## cv1                                   0.276  0.017 -0.202  0.048  0.015
## cv11Living Separately, Long Distance -0.395  0.006  0.030  0.019  0.052
## cv11Living Together                  -0.559  0.052 -0.132  0.167  0.104
##                                      cv1    c11SLD
## iv2Other                                          
## iv2Primary                                        
## iv2Secondary                                      
## iv2Tertiary                                       
## cv1                                               
## cv11Living Separately, Long Distance -0.178       
## cv11Living Together                  -0.442  0.364
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.8626435 -0.5918645 -0.2003911  0.4431720  3.4584526 
## 
## Number of Observations: 558
## Number of Groups: 225

After controling for relationship length and cohabitation, anxiety in non-hierarchical relationships is lower, on average, than anxiety in secondary and tertiary relationships, but is at a similar level as primary ones.

Satisfaction

Step 1: add hierarchy type to model from previous analysis

data <- na.omit(study1.long[vars])
dv <- data$satisfaction
iv <- data$hierarchy
id <- data$Respondent.ID

m.sat <- lme(dv ~ 1, random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv), 
            method="ML")

m.sat.h <- lme(dv ~ iv, random = list(id = pdSymm(form = ~ 1)), 
               weights = varIdent(form = ~ 1 | iv), 
               method="ML")

a <- anova(m.sat, m.sat.h); print(a)
##         Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m.sat       1  4 2969.064 2986.405 -1480.532                       
## m.sat.h     2  5 2956.329 2978.004 -1473.165 1 vs 2 14.7354   1e-04
summary(m.sat.h)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   2956.329 2978.004 -1473.164
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.592001 2.778264
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.153484 
## Fixed effects: dv ~ iv 
##                       Value Std.Error  DF  t-value p-value
## (Intercept)       15.252474 0.2618853 339 58.24106   0e+00
## ivNonHierarchical  1.317279 0.3380101 223  3.89716   1e-04
##  Correlation: 
##                   (Intr)
## ivNonHierarchical -0.775
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -3.72377209 -0.62639807  0.09877309  0.69605258  1.86197608 
## 
## Number of Observations: 564
## Number of Groups: 225
pvals <- c(pvals, a$`p-value`)

Adding hierarchy type as a fixed effect improved the variance model (no fixed effects) for satisfaction.

Step 2: control variables

Checking which potential control variables are related to satisfaction:

for(x in cvs){
  data <- na.omit(study1.long[c(vars,x)])
  print(x)
  dv <- data$satisfaction
  iv <- data$hierarchy
  id <- data$Respondent.ID
  cv <- data[[x]]
  m1 <- lme(dv ~ 1, random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv), 
            method="ML")
  mcv <- lme(dv ~ cv, random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv),
            method="ML")
  a <- anova(m1,mcv)
  print(a)
  pvals <- c(pvals, a$`p-value`)
}
## [1] "rel.length.c"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2941.305 2958.602 -1466.652                        
## mcv     2  5 2930.017 2951.638 -1460.008 1 vs 2 13.28801   3e-04
## [1] "age.c"
##     Model df      AIC      BIC    logLik   Test   L.Ratio p-value
## m1      1  4 2969.064 2986.405 -1480.532                         
## mcv     2  5 2970.799 2992.474 -1480.399 1 vs 2 0.2653941  0.6064
## [1] "incomeperPPL.c"
##     Model df      AIC      BIC    logLik   Test     L.Ratio p-value
## m1      1  4 2306.772 2323.083 -1149.386                           
## mcv     2  5 2308.769 2329.158 -1149.385 1 vs 2 0.002634695  0.9591
## [1] "N.Partners.3levels"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2969.064 2986.405 -1480.532                        
## mcv     2  6 2965.087 2991.097 -1476.543 1 vs 2 7.977476  0.0185
## [1] "gender"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2461.340 2477.917 -1226.670                        
## mcv     2  6 2460.173 2485.039 -1224.087 1 vs 2 5.166593  0.0755
## [1] "orientation.binary"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2430.531 2447.065 -1211.266                        
## mcv     2  5 2430.610 2451.276 -1210.305 1 vs 2 1.921985  0.1656
## [1] "race.binary"
##     Model df      AIC      BIC    logLik   Test    L.Ratio p-value
## m1      1  4 2448.238 2464.797 -1220.119                          
## mcv     2  5 2450.140 2470.840 -1220.070 1 vs 2 0.09763496  0.7547
## [1] "children.binary"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2461.340 2477.917 -1226.670                        
## mcv     2  5 2460.307 2481.028 -1225.153 1 vs 2 3.033148  0.0816
## [1] "education.3levels"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2419.185 2435.701 -1205.592                        
## mcv     2  6 2421.665 2446.439 -1204.833 1 vs 2 1.519473  0.4678
## [1] "marital.status"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2969.064 2986.405 -1480.532                        
## mcv     2  5 2960.798 2982.473 -1475.399 1 vs 2 10.26638  0.0014
## [1] "cohab"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2969.064 2986.405 -1480.532                        
## mcv     2  6 2956.537 2982.548 -1472.269 1 vs 2 16.52699   3e-04
## [1] "coparent"
##     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m1      1  4 2969.064 2986.405 -1480.532                        
## mcv     2  6 2962.505 2988.515 -1475.252 1 vs 2 10.55977  0.0051

The following variables were related to satisfaction: relationship length, marital status, cohabitation, co-parenting.

Model selection strategy: start with a model that includes hierarchy (iv of interest), relationship length, marital status, cohabitation, co-parenting, all as fixed effects variables. Then perform model selection through a backwards elimination process.

cvs.sat.fix <- c("rel.length.c", "marital.status", "cohab", "coparent") 
data <- na.omit(study1.long[c(vars,cvs.sat.fix)])
dv <- data$satisfaction
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv10 <- data$marital.status
cv11 <- data$cohab
cv12 <- data$coparent
aic0 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv10 + cv11 + cv12, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varIdent(form = ~ 1 | iv), 
          method="ML")

print(cvs.sat.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test L.Ratio p-value
## m      1 10 2918.595 2961.839 -1449.298                       
## m0     2 11 2918.783 2966.351 -1448.391 1 vs 2  1.8124  0.1782
pvals <- c(pvals, a$`p-value`)

print(cvs.sat.fix[2])
## [1] "marital.status"
m <- update(m0, .~. -cv10)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test      L.Ratio p-value
## m      1 10 2916.783 2960.027 -1448.392                            
## m0     2 11 2918.783 2966.351 -1448.391 1 vs 2 0.0003488189  0.9851
pvals <- c(pvals, a$`p-value`)

print(cvs.sat.fix[3])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[3] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  9 2918.967 2957.886 -1450.483                        
## m0     2 11 2918.783 2966.351 -1448.391 1 vs 2 4.184037  0.1234
pvals <- c(pvals, a$`p-value`)

print(cvs.sat.fix[4])
## [1] "coparent"
m <- update(m0, .~. -cv12)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[4] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  9 2915.791 2954.711 -1448.896                        
## m0     2 11 2918.783 2966.351 -1448.391 1 vs 2 1.008725  0.6039
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1]  0.1876002  1.9996512 -0.1840373  2.9912755

Remove coparenting - it does not improve model with 4 control variables and increases AIC the most.

cvs.sat.fix <- c("rel.length.c", "marital.status", "cohab") 
data <- na.omit(study1.long[c(vars,cvs.sat.fix)])
dv <- data$satisfaction
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv10 <- data$marital.status
cv11 <- data$cohab
aic0 <- numeric()
m0 <- lme(dv ~ iv + cv1 + cv10 + cv11, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varIdent(form = ~ 1 | iv), 
          method="ML")

print(cvs.sat.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  8 2916.591 2951.186 -1450.295                        
## m0     2  9 2915.791 2954.711 -1448.896 1 vs 2 2.799484  0.0943
pvals <- c(pvals, a$`p-value`)

print(cvs.sat.fix[2])
## [1] "marital.status"
m <- update(m0, .~. -cv10)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test     L.Ratio p-value
## m      1  8 2913.801 2948.396 -1448.900                           
## m0     2  9 2915.791 2954.711 -1448.896 1 vs 2 0.009129234  0.9239
pvals <- c(pvals, a$`p-value`)

print(cvs.sat.fix[3])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[3] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  7 2916.701 2946.972 -1451.351                        
## m0     2  9 2915.791 2954.711 -1448.896 1 vs 2 4.909633  0.0859
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -0.7994839  1.9908708 -0.9096331

Remove marital status.

cvs.sat.fix <- c("rel.length.c", "cohab") 
data <- na.omit(study1.long[c(vars,cvs.sat.fix)])
dv <- data$satisfaction
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c
cv11 <- data$cohab
aic0 <- numeric()

m0 <- lme(dv ~ iv + cv1 + cv11, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varIdent(form = ~ 1 | iv), 
          method="ML")

print(cvs.sat.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[1] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  7 2916.617 2946.888 -1451.309                        
## m0     2  8 2913.801 2948.396 -1448.900 1 vs 2 4.816656  0.0282
pvals <- c(pvals, a$`p-value`)

print(cvs.sat.fix[2])
## [1] "cohab"
m <- update(m0, .~. -cv11)
a <- anova(m,m0)
diff <- a$AIC[2] - a$AIC[1]
aic0[2] <- diff
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  6 2915.594 2941.541 -1451.797                        
## m0     2  8 2913.801 2948.396 -1448.900 1 vs 2 5.793781  0.0552
pvals <- c(pvals, a$`p-value`)

print(aic0)
## [1] -2.816656 -1.793781

Revome cohabitation. It improves the model, but not significantly.

cvs.sat.fix <- c("rel.length.c") 
data <- na.omit(study1.long[c(vars,cvs.sat.fix)])
dv <- data$satisfaction
iv <- data$hierarchy
id <- data$Respondent.ID
cv1 <- data$rel.length.c

m0 <- lme(dv ~ iv + cv1, 
          random = list(id = pdSymm(form = ~ 1)), 
          weights = varIdent(form = ~ 1 | iv), 
          method="ML")

print(cvs.sat.fix[1])
## [1] "rel.length.c"
m <- update(m0, .~. -cv1)
a <- anova(m,m0)
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  5 2929.017 2950.639 -1459.508                        
## m0     2  6 2915.594 2941.541 -1451.797 1 vs 2 15.42234   1e-04
pvals <- c(pvals, a$`p-value`)

m <- update(m0, .~. -iv)
a <- anova(m,m0)
print(a)
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m      1  5 2930.017 2951.638 -1460.008                        
## m0     2  6 2915.594 2941.541 -1451.797 1 vs 2 16.42221   1e-04
pvals <- c(pvals, a$`p-value`)
summary(m0)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   2915.594 2941.541 -1451.797
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.596808 2.751665
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.145703 
## Fixed effects: dv ~ iv + cv1 
##                       Value Std.Error  DF  t-value p-value
## (Intercept)       15.210669 0.2616928 332 58.12414   0e+00
## ivNonHierarchical  1.392232 0.3382513 223  4.11597   1e-04
## cv1                0.539746 0.1366961 332  3.94851   1e-04
##  Correlation: 
##                   (Intr) ivNnHr
## ivNonHierarchical -0.775       
## cv1               -0.054  0.066
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -3.6063417 -0.6053108  0.1151261  0.6845231  1.9090858 
## 
## Number of Observations: 558
## Number of Groups: 225

Residual plots:

res <- resid(m0, type = "pearson")
fit <- fitted(m0, level=0)
plot(ranef(m0, level = 1))

plot(res ~ iv)

plot(res ~ cv1) # rel. length

plot(res ~ cv11) # cohab

qqnorm(res)
qqline(res)

Differences in satisfaction between non-hierarchical relationships and 3 levels of hierarchy (primary, secondary, and tertiary partners)

data <- na.omit(study1.long[c(vars,"hierarchy2","rel.length.c","cohab")])
dv <- data$satisfaction
iv <- data$hierarchy
iv2 <- data$hierarchy2
id <- data$Respondent.ID
cv1 <- data$rel.length.c

m.sat <- lme(dv ~ 1, random = list(id = pdSymm(form = ~ 1)), 
            weights = varIdent(form = ~ 1 | iv), 
            method="ML")

m.sat.h <- lme(dv ~ iv2, random = list(id = pdSymm(form = ~ 1)), 
               weights = varIdent(form = ~ 1 | iv), 
               method="ML")

m.sat.hcv <- lme(dv ~ iv2 + cv1, random = list(id = pdSymm(form = ~ 1)), 
               weights = varIdent(form = ~ 1 | iv), 
               method="ML")

print(anova(m.sat, m.sat.h, m.sat.hcv))
##           Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## m.sat         1  4 2941.305 2958.602 -1466.652                        
## m.sat.h       2  8 2878.146 2912.741 -1431.073 1 vs 2 71.15881  <.0001
## m.sat.hcv     3  9 2878.906 2917.825 -1430.453 2 vs 3  1.24020  0.2654
summary(m.sat.h)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   2878.146 2912.741 -1431.073
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.649997 2.776589
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##       1.0000000       0.9995233 
## Fixed effects: dv ~ iv2 
##                  Value Std.Error  DF  t-value p-value
## (Intercept)  16.571627 0.2182967 329 75.91332  0.0000
## iv2Other     -2.287679 0.7784189 329 -2.93888  0.0035
## iv2Primary    0.260075 0.3927875 329  0.66213  0.5084
## iv2Secondary -1.982843 0.3984492 329 -4.97640  0.0000
## iv2Tertiary  -4.446815 0.6813313 329 -6.52666  0.0000
##  Correlation: 
##              (Intr) iv2Oth iv2Prm iv2Scn
## iv2Other     -0.280                     
## iv2Primary   -0.556  0.251              
## iv2Secondary -0.548  0.219  0.483       
## iv2Tertiary  -0.320  0.116  0.276  0.256
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -3.71423031 -0.57983191  0.09572108  0.66164997  1.90656048 
## 
## Number of Observations: 558
## Number of Groups: 225
summary(m.sat.hcv)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   2878.906 2917.825 -1430.453
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.638991 2.759479
## 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | iv 
##  Parameter estimates:
## NonHierarchical    Hierarchical 
##        1.000000        1.013855 
## Fixed effects: dv ~ iv2 + cv1 
##                  Value Std.Error  DF  t-value p-value
## (Intercept)  16.581345 0.2172686 328 76.31725  0.0000
## iv2Other     -2.249935 0.7833320 328 -2.87226  0.0043
## iv2Primary    0.110002 0.4151829 328  0.26495  0.7912
## iv2Secondary -1.913839 0.4035860 328 -4.74208  0.0000
## iv2Tertiary  -4.392910 0.6865104 328 -6.39890  0.0000
## cv1           0.163908 0.1454126 328  1.12719  0.2605
##  Correlation: 
##              (Intr) iv2Oth iv2Prm iv2Scn iv2Trt
## iv2Other     -0.275                            
## iv2Primary   -0.535  0.217                     
## iv2Secondary -0.532  0.219  0.399              
## iv2Tertiary  -0.313  0.116  0.232  0.259       
## cv1           0.040  0.049 -0.319  0.148  0.073
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -3.6920637 -0.5945191  0.1124667  0.6491956  1.9112982 
## 
## Number of Observations: 558
## Number of Groups: 225

After controling for relationship length, satisfaction in non-hierarchical relationships is higher, on average, than satisfaction in secondary and tertiary relationships, but is at a similar level as primary ones.

Differences between primary and secondary partners in hierarchical relationships

dv <- study1.H.long$P.anx - study1.H.long$S.anx
id <- as.factor(study1.H.long$Respondent.ID)
cv1 <- study1.H.long$age - mean(study1.H.long$age, na.rm=T)
cv2 <- study1.H.long$N.Partners.3levels
cv3 <- study1.H.long$gender
cv4 <- study1.H.long$orientation.binary
cv5 <- study1.H.long$race.binary
cv6 <- study1.H.long$incomeperPPL - mean(study1.long$incomeperPPL, na.rm=T)
cv7 <- study1.H.long$children.binary
cv8 <- study1.H.long$education.3levels
cv9 <- study1.H.long$MS.P
cv10 <- study1.H.long$cohab.P
cv11 <- study1.H.long$cohab.S
cv12 <- study1.H.long$coparent.P
cv13 <- study1.H.long$coparent.S
cv14 <- study1.H.long$P.length - mean(study1.H.long$P.length, na.rm=T)
cv15 <- study1.H.long$S.length - mean(study1.H.long$S.length, na.rm=T)
cv16 <- cv14-cv15
cv <- list(cv1, cv2, cv3, cv4, cv5, cv6, cv7, cv8, cv9, cv10, cv11, cv12, cv13, cv14, cv15, cv16)
names(cv) <- c("cv1", "cv2", "cv3", "cv4", "cv5", "cv6",
               "cv7", "cv8", "cv9", "cv10", "cv11", 
               "cv12", "cv13", "cv14", "cv15", "cv16")

The need for a mixed effects model

Testing whether a random intercept-only model is an improvement over non-random intercept one:

# Fixed intercept only, using general least squares (gls)
fi <- gls(dv ~ 1, method="ML", na.action=na.exclude)

# Random intercept only, using linear mixed effecs model (lme)
ri <- lme(dv ~ 1, random = ~1|id, method="ML",
          na.action=na.exclude)
anova(fi,ri) 
##    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## fi     1  2 409.2379 414.5647 -202.6189                        
## ri     2  3 403.7551 411.7454 -198.8776 1 vs 2 7.482734  0.0062
summary(ri)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   403.7551 411.7454 -198.8776
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:     1.12656  1.17532
## 
## Fixed effects: dv ~ 1 
##                  Value Std.Error DF   t-value p-value
## (Intercept) -0.9688763 0.1719318 83 -5.635235       0
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0352140 -0.4595785  0.1340091  0.4640288  2.0840151 
## 
## Number of Observations: 106
## Number of Groups: 83

Control variables

Checking the need for control variables:

lme.list <- list()
for(var in cv){
  lme.list[[i]] <- lme(dv ~ var, random = ~1|id, 
                       method="ML", na.action=na.exclude)
  print(summary(lme.list[[i]]))
}
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   405.7426 416.3963 -198.8713
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.125184 1.176194
## 
## Fixed effects: dv ~ var 
##                  Value Std.Error DF   t-value p-value
## (Intercept) -0.9683019 0.1727699 81 -5.604576  0.0000
## var         -0.0021226 0.0190776 81 -0.111263  0.9117
##  Correlation: 
##     (Intr)
## var -0.028
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0349574 -0.4662021  0.1247943  0.4677897  2.0792900 
## 
## Number of Observations: 106
## Number of Groups: 83 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   404.9695 418.2867 -197.4848
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.077151 1.184638
## 
## Fixed effects: dv ~ var 
##                  Value Std.Error DF   t-value p-value
## (Intercept) -1.1041667 0.2344449 80 -4.709707  0.0000
## var3         0.4922875 0.3692921 80  1.333057  0.1863
## var>3       -0.3314873 0.5502151 80 -0.602469  0.5486
##  Correlation: 
##       (Intr) var3  
## var3  -0.635       
## var>3 -0.426  0.271
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.18497700 -0.41396047  0.04813494  0.51023035  1.97059972 
## 
## Number of Observations: 106
## Number of Groups: 83 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##       AIC      BIC    logLik
##   322.809 334.9631 -156.4045
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.198608 1.097237
## 
## Fixed effects: dv ~ var 
##                    Value Std.Error DF    t-value p-value
## (Intercept)   -0.8091340 0.4289049 62 -1.8865115  0.0639
## varWoman      -0.1792821 0.4875953 62 -0.3676863  0.7144
## varNon-binary  0.8416749 0.9063631 62  0.9286288  0.3567
##  Correlation: 
##               (Intr) varWmn
## varWoman      -0.880       
## varNon-binary -0.473  0.416
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0912144 -0.5564737  0.1336956  0.4760656  2.1957996 
## 
## Number of Observations: 84
## Number of Groups: 65 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   310.3049 319.9318 -151.1525
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.118468 1.118417
## 
## Fixed effects: dv ~ var 
##                  Value Std.Error DF   t-value p-value
## (Intercept) -1.0982898 0.3140544 62 -3.497132  0.0009
## varLGBTQIA   0.4346902 0.3970794 62  1.094718  0.2779
##  Correlation: 
##            (Intr)
## varLGBTQIA -0.791
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.05694425 -0.56309246  0.04393947  0.49458040  2.08535878 
## 
## Number of Observations: 82
## Number of Groups: 64 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC     BIC    logLik
##   318.6496 328.325 -155.3248
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.227382 1.095385
## 
## Fixed effects: dv ~ var 
##                  Value Std.Error DF   t-value p-value
## (Intercept) -0.8915752 0.2126333 62 -4.193018  0.0001
## varPOC       0.2214264 0.6415341 62  0.345151  0.7311
##  Correlation: 
##        (Intr)
## varPOC -0.331
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.04760736 -0.54323684  0.09103137  0.49577977  2.16648234 
## 
## Number of Observations: 83
## Number of Groups: 64 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   310.8335 320.4113 -151.4167
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.223875  1.09618
## 
## Fixed effects: dv ~ var 
##                  Value  Std.Error DF   t-value p-value
## (Intercept) -0.8063680 0.20661885 60 -3.902684  0.0002
## var         -0.0051635 0.00700154 60 -0.737482  0.4637
##  Correlation: 
##     (Intr)
## var -0.177
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.08594704 -0.48878445  0.08817148  0.47421694  2.12279293 
## 
## Number of Observations: 81
## Number of Groups: 62 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   320.9274 330.6506 -156.4637
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.210238 1.089769
## 
## Fixed effects: dv ~ var 
##                  Value Std.Error DF   t-value p-value
## (Intercept) -0.5723426 0.3286383 63 -1.741558  0.0865
## varNo       -0.4929566 0.4106478 63 -1.200437  0.2345
##  Correlation: 
##       (Intr)
## varNo -0.8  
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.02091092 -0.52101130  0.06251733  0.50624781  2.22605936 
## 
## Number of Observations: 84
## Number of Groups: 65 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   320.6122 332.7663 -155.3061
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.162209 1.098711
## 
## Fixed effects: dv ~ var 
##                               Value Std.Error DF    t-value p-value
## (Intercept)               0.3333333  1.151658 62  0.2894377  0.7732
## varSome university or BS -1.4952245  1.177666 62 -1.2696506  0.2090
## varGrad School           -0.8299327  1.197661 62 -0.6929612  0.4909
##  Correlation: 
##                          (Intr) vSuoBS
## varSome university or BS -0.978       
## varGrad School           -0.962  0.940
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0224760 -0.5027350  0.1048613  0.4145465  2.2517637 
## 
## Number of Observations: 84
## Number of Groups: 65 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##       AIC      BIC    logLik
##   403.833 414.4867 -197.9165
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:     1.14567 1.143313
## 
## Fixed effects: dv ~ var 
##                    Value Std.Error DF   t-value p-value
## (Intercept)   -1.1804700 0.2294026 82 -5.145844  0.0000
## varNonmarried  0.4599188 0.3310205 22  1.389397  0.1786
##  Correlation: 
##               (Intr)
## varNonmarried -0.661
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.12130189 -0.54495601  0.07876163  0.51518657  2.18984051 
## 
## Number of Observations: 106
## Number of Groups: 83 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   405.6052 418.9224 -197.8026
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.150364 1.137691
## 
## Fixed effects: dv ~ var 
##                                          Value Std.Error DF    t-value
## (Intercept)                         -0.6509383 0.4554773 82 -1.4291344
## varLiving Separately, Long Distance  0.3703698 0.7699832 21  0.4810102
## varLiving Together                  -0.4318161 0.4946158 21 -0.8730333
##                                     p-value
## (Intercept)                          0.1568
## varLiving Separately, Long Distance  0.6355
## varLiving Together                   0.3925
##  Correlation: 
##                                     (Intr) vLS,LD
## varLiving Separately, Long Distance -0.592       
## varLiving Together                  -0.921  0.564
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.14739281 -0.54352460  0.03596659  0.47058498  2.16889752 
## 
## Number of Observations: 106
## Number of Groups: 83 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##       AIC      BIC    logLik
##   406.927 420.2442 -198.4635
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.149779 1.150574
## 
## Fixed effects: dv ~ var 
##                                          Value Std.Error DF   t-value
## (Intercept)                         -0.8841119 0.1999880 81 -4.420826
## varLiving Separately, Long Distance -0.2446234 0.4076776 22 -0.600041
## varLiving Together                  -0.4968405 0.6549636 81 -0.758577
##                                     p-value
## (Intercept)                          0.0000
## varLiving Separately, Long Distance  0.5546
## varLiving Together                   0.4503
##  Correlation: 
##                                     (Intr) vLS,LD
## varLiving Separately, Long Distance -0.425       
## varLiving Together                  -0.305  0.130
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0622459 -0.4852617  0.0945595  0.5094250  2.0203243 
## 
## Number of Observations: 106
## Number of Groups: 83 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   407.2359 420.5531 -198.6179
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.097098 1.191493
## 
## Fixed effects: dv ~ var 
##                                                                           Value
## (Intercept)                                                          -0.7946320
## varMy partner is a parent, but I do not take on a co-parenting role. -0.0868621
## varNot co-parents                                                    -0.2655530
##                                                                      Std.Error
## (Intercept)                                                          0.3037635
## varMy partner is a parent, but I do not take on a co-parenting role. 0.7437056
## varNot co-parents                                                    0.3698071
##                                                                      DF
## (Intercept)                                                          82
## varMy partner is a parent, but I do not take on a co-parenting role. 21
## varNot co-parents                                                    21
##                                                                         t-value
## (Intercept)                                                          -2.6159563
## varMy partner is a parent, but I do not take on a co-parenting role. -0.1167963
## varNot co-parents                                                    -0.7180853
##                                                                      p-value
## (Intercept)                                                           0.0106
## varMy partner is a parent, but I do not take on a co-parenting role.  0.9081
## varNot co-parents                                                     0.4806
##  Correlation: 
##                                                                      (Intr)
## varMy partner is a parent, but I do not take on a co-parenting role. -0.366
## varNot co-parents                                                    -0.813
##                                                                      vpiapbIdntoacr
## varMy partner is a parent, but I do not take on a co-parenting role.               
## varNot co-parents                                                     0.298        
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.17132929 -0.53292677  0.05812183  0.49993185  2.09664055 
## 
## Number of Observations: 106
## Number of Groups: 83 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   405.9393 419.2565 -197.9697
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.104549 1.174199
## 
## Fixed effects: dv ~ var 
##                                                                           Value
## (Intercept)                                                           0.1804173
## varMy partner is a parent, but I do not take on a co-parenting role. -1.4255180
## varNot co-parents                                                    -1.1099980
##                                                                      Std.Error
## (Intercept)                                                           1.064306
## varMy partner is a parent, but I do not take on a co-parenting role.  1.125131
## varNot co-parents                                                     1.082247
##                                                                      DF
## (Intercept)                                                          82
## varMy partner is a parent, but I do not take on a co-parenting role. 21
## varNot co-parents                                                    21
##                                                                         t-value
## (Intercept)                                                           0.1695164
## varMy partner is a parent, but I do not take on a co-parenting role. -1.2669797
## varNot co-parents                                                    -1.0256416
##                                                                      p-value
## (Intercept)                                                           0.8658
## varMy partner is a parent, but I do not take on a co-parenting role.  0.2190
## varNot co-parents                                                     0.3167
##  Correlation: 
##                                                                      (Intr)
## varMy partner is a parent, but I do not take on a co-parenting role. -0.946
## varNot co-parents                                                    -0.983
##                                                                      vpiapbIdntoacr
## varMy partner is a parent, but I do not take on a co-parenting role.               
## varNot co-parents                                                     0.931        
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -1.9708004 -0.5074900  0.1147678  0.5461441  2.0798100 
## 
## Number of Observations: 106
## Number of Groups: 83 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   405.6779 416.3316 -198.8389
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.125799 1.175144
## 
## Fixed effects: dv ~ var 
##                  Value  Std.Error DF   t-value p-value
## (Intercept) -0.9691058 0.17268434 82 -5.612007  0.0000
## var         -0.0062511 0.02269719 22 -0.275414  0.7856
##  Correlation: 
##     (Intr)
## var 0.005 
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0379407 -0.4787558  0.1109071  0.4752443  2.0898417 
## 
## Number of Observations: 106
## Number of Groups: 83 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   401.9324 412.5482 -196.9662
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.137341 1.167429
## 
## Fixed effects: dv ~ var 
##                  Value  Std.Error DF   t-value p-value
## (Intercept) -0.9826722 0.17409625 81 -5.644419  0.0000
## var         -0.0358167 0.05980635 22 -0.598877  0.5554
##  Correlation: 
##     (Intr)
## var -0.011
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0407620 -0.4647584  0.1163215  0.4493768  2.0694003 
## 
## Number of Observations: 105
## Number of Groups: 82 
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   402.2834 412.8992 -197.1417
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:    1.129482 1.176443
## 
## Fixed effects: dv ~ var 
##                  Value  Std.Error DF   t-value p-value
## (Intercept) -0.9837682 0.17407682 81 -5.651345  0.0000
## var         -0.0023160 0.02180534 22 -0.106213  0.9164
##  Correlation: 
##     (Intr)
## var 0.017 
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0271622 -0.4661373  0.1324045  0.4505844  2.0897024 
## 
## Number of Observations: 105
## Number of Groups: 82

No potential control variables. The final model is a random intercept-only model.

lmeH <- lme((dv) ~ 1, random = ~1|id, method="ML", 
            na.action=na.exclude)
summary(lmeH)
## Linear mixed-effects model fit by maximum likelihood
##  Data: NULL 
##        AIC      BIC    logLik
##   403.7551 411.7454 -198.8776
## 
## Random effects:
##  Formula: ~1 | id
##         (Intercept) Residual
## StdDev:     1.12656  1.17532
## 
## Fixed effects: (dv) ~ 1 
##                  Value Std.Error DF   t-value p-value
## (Intercept) -0.9688763 0.1719318 83 -5.635235       0
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -2.0352140 -0.4595785  0.1340091  0.4640288  2.0840151 
## 
## Number of Observations: 106
## Number of Groups: 83

Adjusted p-values

pvals.adj <- p.adjust(pvals, method = "fdr")
print(pvals)
##   [1]           NA 3.991983e-04           NA 8.057143e-12           NA
##   [6] 4.061453e-09           NA 9.674236e-04           NA 1.058326e-03
##  [11]           NA 3.672430e-02           NA 9.995003e-01           NA
##  [16] 9.813998e-01           NA 9.994095e-01           NA 2.756609e-05
##  [21]           NA 3.300143e-02           NA 1.430705e-01           NA
##  [26] 4.040438e-04           NA 3.224403e-11           NA 5.734664e-09
##  [31]           NA 9.968531e-03           NA 1.547196e-02           NA
##  [36] 2.600284e-07           NA 1.062008e-05           NA 9.758162e-01
##  [41]           NA 8.223519e-03           NA 1.007927e-03           NA
##  [46] 4.492479e-01           NA 3.065083e-01           NA 3.159761e-02
##  [51]           NA 5.325399e-01           NA 9.463882e-01           NA
##  [56] 9.684206e-01           NA 4.530342e-01           NA 4.181910e-01
##  [61]           NA 2.739191e-01           NA 3.672370e-01           NA
##  [66] 2.124504e-01           NA 9.775647e-01           NA 5.576767e-01
##  [71]           NA 5.844944e-01           NA 3.159647e-02           NA
##  [76] 6.990688e-02           NA 3.498800e-01           NA 1.434557e-05
##  [81]           NA 6.191959e-03           NA 6.397385e-01           NA
##  [86] 1.234483e-01           NA 9.055332e-02           NA 7.351256e-01
##  [91]           NA 1.723600e-03           NA 2.122367e-04           NA
##  [96] 1.657463e-02           NA 3.265180e-02           NA 6.358150e-06
## [101]           NA 6.334391e-06           NA 2.030248e-02           NA
## [106] 2.111979e-06           NA 1.025166e-07           NA 8.880659e-04
## [111]           NA 2.618286e-03           NA 4.193138e-04           NA
## [116] 7.128310e-03           NA 3.107165e-02           NA 4.341333e-05
## [121]           NA 5.136411e-15           NA 1.067164e-01           NA
## [126] 4.137256e-01           NA 9.481272e-04           NA 4.078066e-01
## [131]           NA 9.604284e-01           NA 9.083193e-01           NA
## [136] 2.106832e-02           NA 3.352488e-01           NA 1.915160e-14
## [141]           NA 1.359400e-14           NA 4.185999e-07           NA
## [146] 1.563673e-03           NA 1.232739e-01           NA 2.290440e-01
## [151]           NA 5.440309e-03           NA 8.764725e-01           NA
## [156] 7.161567e-04           NA 1.323752e-01           NA 2.332937e-01
## [161]           NA 5.664690e-03           NA 2.891033e-07           NA
## [166] 9.466977e-02           NA 2.706309e-04           NA 5.289081e-07
## [171]           NA 2.751937e-05           NA 4.501598e-07           NA
## [176] 2.328082e-04           NA 8.514477e-10           NA 4.514491e-01
## [181]           NA 5.462672e-01           NA 4.138378e-01           NA
## [186] 3.565194e-01           NA 4.324743e-02           NA 9.866441e-01
## [191]           NA 5.190595e-01           NA 4.167799e-01           NA
## [196] 4.557262e-08           NA 4.834804e-10           NA 4.331730e-03
## [201]           NA 2.290965e-02           NA 2.295779e-01           NA
## [206] 6.051505e-01           NA 1.932638e-03           NA 4.821265e-01
## [211]           NA 4.511073e-02           NA 2.673348e-01           NA
## [216] 7.048194e-01           NA 2.602919e-03           NA 1.208427e-02
## [221]           NA 6.234791e-01           NA 3.552377e-03           NA
## [226] 4.408264e-04           NA 7.247212e-04           NA 1.237016e-04
## [231]           NA 2.671096e-04           NA 6.064383e-01           NA
## [236] 9.590631e-01           NA 1.852307e-02           NA 7.552461e-02
## [241]           NA 1.656380e-01           NA 7.546865e-01           NA
## [246] 8.157959e-02           NA 4.677896e-01           NA 1.354765e-03
## [251]           NA 2.577564e-04           NA 5.093013e-03           NA
## [256] 1.782206e-01           NA 9.850990e-01           NA 1.234377e-01
## [261]           NA 6.038906e-01           NA 9.429466e-02           NA
## [266] 9.238803e-01           NA 8.587895e-02           NA 2.818597e-02
## [271]           NA 5.519459e-02           NA 8.596609e-05           NA
## [276] 5.068794e-05
print(pvals.adj)
##   [1]           NA 1.639943e-03           NA 2.779714e-10           NA
##   [6] 7.006007e-08           NA 3.256206e-03           NA 3.396489e-03
##  [11]           NA 7.038824e-02           NA 9.995003e-01           NA
##  [16] 9.995003e-01           NA 9.995003e-01           NA 1.653965e-04
##  [21]           NA 6.414362e-02           NA 2.243605e-01           NA
##  [26] 1.639943e-03           NA 8.899352e-10           NA 8.793151e-08
##  [31]           NA 2.371823e-02           NA 3.558551e-02           NA
##  [36] 2.990326e-06           NA 7.327854e-05           NA 9.995003e-01
##  [41]           NA 1.990957e-02           NA 3.311761e-03           NA
##  [46] 5.735663e-01           NA 4.360634e-01           NA 6.319523e-02
##  [51]           NA 6.503584e-01           NA 9.995003e-01           NA
##  [56] 9.995003e-01           NA 5.735663e-01           NA 5.444374e-01
##  [61]           NA 3.937587e-01           NA 5.017694e-01           NA
##  [66] 3.221775e-01           NA 9.995003e-01           NA 6.692120e-01
##  [71]           NA 6.953468e-01           NA 6.319523e-02           NA
##  [76] 1.269362e-01           NA 4.877116e-01           NA 9.427086e-05
##  [81]           NA 1.553619e-02           NA 7.296191e-01           NA
##  [86] 1.980915e-01           NA 1.562045e-01           NA 8.247751e-01
##  [91]           NA 5.170800e-03           NA 1.046024e-03           NA
##  [96] 3.749670e-02           NA 6.414362e-02           NA 4.618025e-05
## [101]           NA 4.618025e-05           NA 4.447211e-02           NA
## [106] 1.714430e-05           NA 1.286117e-06           NA 3.142387e-03
## [111]           NA 7.373948e-03           NA 1.653295e-03           NA
## [116] 1.756619e-02           NA 6.319523e-02           NA 2.496266e-04
## [121]           NA 7.088247e-13           NA 1.774321e-01           NA
## [126] 5.444374e-01           NA 3.256206e-03           NA 5.444374e-01
## [131]           NA 9.995003e-01           NA 9.948259e-01           NA
## [136] 4.542856e-02           NA 4.720851e-01           NA 8.809737e-13
## [141]           NA 8.809737e-13           NA 4.126199e-06           NA
## [146] 4.795264e-03           NA 1.980915e-01           NA 3.406641e-01
## [151]           NA 1.416533e-02           NA 9.676256e-01           NA
## [156] 2.631882e-03           NA 2.099745e-01           NA 3.424950e-01
## [161]           NA 1.447643e-02           NA 3.068942e-06           NA
## [166] 1.593223e-01           NA 1.167096e-03           NA 4.561833e-06
## [171]           NA 1.653965e-04           NA 4.141470e-06           NA
## [176] 1.107846e-03           NA 1.678568e-08           NA 5.735663e-01
## [181]           NA 6.612708e-01           NA 5.444374e-01           NA
## [186] 4.919967e-01           NA 8.175542e-02           NA 9.995003e-01
## [191]           NA 6.395554e-01           NA 5.444374e-01           NA
## [196] 6.289022e-07           NA 1.112005e-08           NA 1.172115e-02
## [201]           NA 4.863896e-02           NA 3.406641e-01           NA
## [206] 7.032646e-01           NA 5.674555e-03           NA 5.994006e-01
## [211]           NA 8.412541e-02           NA 3.883390e-01           NA
## [216] 7.972548e-01           NA 7.373948e-03           NA 2.826491e-02
## [221]           NA 7.170010e-01           NA 9.804561e-03           NA
## [226] 1.689835e-03           NA 2.631882e-03           NA 6.322528e-04
## [231]           NA 1.167096e-03           NA 7.032646e-01           NA
## [236] 9.995003e-01           NA 4.122877e-02           NA 1.353558e-01
## [241]           NA 2.568320e-01           NA 8.398930e-01           NA
## [246] 1.443331e-01           NA 5.868633e-01           NA 4.249035e-03
## [251]           NA 1.167096e-03           NA 1.351607e-02           NA
## [256] 2.732716e-01           NA 9.995003e-01           NA 1.980915e-01
## [261]           NA 7.032646e-01           NA 1.593223e-01           NA
## [266] 9.995003e-01           NA 1.500164e-01           NA 5.893430e-02
## [271]           NA 1.015580e-01           NA 4.562816e-04           NA
## [276] 2.797974e-04
print(length(pvals))
## [1] 276
print(length(pvals.adj))
## [1] 276