##################################################
# Establish and open the output file difcon.Rout #
##################################################
Â
sink("difcon.Rout", split=TRUE)
Â
###########################################
# Load the required packages: readxl, car #
###########################################
Â
library(readxl)
library(car)
Â
#########################################
# Import Excel data file difssublc.xlsx #
#########################################
Â
difssublc <- read_excel("difssublc.xlsx")
Â
#########################
# Analyses for autonomy #
#########################
Â
# Estimate the constrained algebraic difference score equation.
Â
autsatald <- lm(sat ~ autald, data=difssublc, na.action=na.exclude)
Â
# Estimate the unconstrained algebraic difference score equation.
Â
autsatlin <- lm(sat ~ autca + autcd, data=difssublc, na.action=na.exclude)
Â
# Test the constraint.
Â
lht(autsatlin, c("autca + autcd = 0"), verbose=TRUE)
Â
# Estimate the quadratic equation and test increment in explained variance beyond the linear equation.
Â
autsatqua <- lm(sat ~ autca + autcd + autca2 + autcad + autcd2, data=difssublc, na.action=na.exclude)
Â
lht(autsatqua, c("autca2 = 0", "autcad = 0", "autcd2 = 0"), verbose=TRUE)
Â
# Estimate the constrained squared difference score equation.
Â
autsatsqd <- lm(sat ~ autsqd, data=difssublc, na.action=na.exclude)
Â
# Estimate the unconstrained squared difference score equation.
Â
autsatqua <- lm(sat ~ autca + autcd + autca2 + autcad + autcd2, data=difssublc, na.action=na.exclude)
Â
# Test the constraints.
Â
lht(autsatqua, c("autca = 0", "autcd = 0", "autca2 - autcd2 = 0" "autca2 + autcad + autcd2 = 0"), verbose=TRUE)
Â
# Estimate the cubic equation and test increment in explained variance beyond the quadratic equation.
Â
autsatcub <- lm(sat ~ autca + autcd + autca2 + autcad + autcd2 + autca3 + autca2d + autcad2 + autcd3, data=difssublc, na.action=na.exclude)
Â
lht(autsatqua, c("autca3 = 0", "autca2d = 0", "autcad2 = 0", "autcd3 = 0"), verbose=TRUE)
Â
#########################
# Analyses for prestige #
#########################
Â
# Estimate the constrained algebraic difference score equation.
Â
presatald <- lm(sat ~ preald, data=difssublc, na.action=na.exclude)
Â
# Estimate the unconstrained algebraic difference score equation.
Â
presatlin <- lm(sat ~ preca + precd, data=difssublc, na.action=na.exclude)
Â
# Test the constraint.
Â
lht(presatlin, c("preca + precd = 0"), verbose=TRUE)
Â
# Estimate the quadratic equation and test increment in explained variance beyond the linear equation.
Â
presatqua <- lm(sat ~ preca + precd + preca2 + precad + precd2, data=difssublc, na.action=na.exclude)
Â
lht(presatqua, c("preca2 = 0", "precad = 0", "precd2 = 0"), verbose=TRUE)
Â
# Estimate the constrained squared difference score equation.
Â
presatsqd <- lm(sat ~ presqd, data=difssublc, na.action=na.exclude)
Â
# Estimate the unconstrained squared difference score equation.
Â
presatqua <- lm(sat ~ preca + precd + preca2 + precad + precd2, data=difssublc, na.action=na.exclude)
Â
# Test the constraints.
Â
lht(presatqua, c("preca = 0", "precd = 0", "preca2 - precd2 = 0" "preca2 + precad + precd2 = 0"), verbose=TRUE)
Â
# Estimate the cubic equation and test increment in explained variance beyond the quadratic equation.
Â
presatcub <- lm(sat ~ preca + precd + preca2 + precad + precd2 + preca3 + preca2d + precad2 + precd3, data=difssublc, na.action=na.exclude)
Â
lht(presatqua, c("preca3 = 0", "preca2d = 0", "precad2 = 0", "precd3 = 0"), verbose=TRUE)
Â
################################
# Analyses for span of control #
################################
Â
# Estimate the constrained algebraic difference score equation.
Â
socsatald <- lm(sat ~ socald, data=difssublc, na.action=na.exclude)
Â
# Estimate the unconstrained algebraic difference score equation.
Â
socsatlin <- lm(sat ~ socca + soccd, data=difssublc, na.action=na.exclude)
Â
# Test the constraint.
Â
lht(socsatlin, c("socca + soccd = 0"), verbose=TRUE)
Â
# Estimate the quadratic equation and test increment in explained variance beyond the linear equation.
Â
socsatqua <- lm(sat ~ socca + soccd + socca2 + soccad + soccd2, data=difssublc, na.action=na.exclude)
Â
lht(socsatqua, c("socca2 = 0", "soccad = 0", "soccd2 = 0"), verbose=TRUE)
Â
# Estimate the constrained squared difference score equation.
Â
socsatsqd <- lm(sat ~ socsqd, data=difssublc, na.action=na.exclude)
Â
# Estimate the unconstrained squared difference score equation.
Â
socsatqua <- lm(sat ~ socca + soccd + socca2 + soccad + soccd2, data=difssublc, na.action=na.exclude)
Â
# Test the constraints.
Â
lht(socsatqua, c("socca = 0", "soccd = 0", "socca2 - soccd2 = 0" "socca2 + soccad + soccd2 = 0"), verbose=TRUE)
Â
# Estimate the cubic equation and test increment in explained variance beyond the quadratic equation.
Â
socsatcub <- lm(sat ~ socca + soccd + socca2 + soccad + soccd2 + socca3 + socca2d + soccad2 + soccd3, data=difssublc, na.action=na.exclude)
Â
lht(socsatqua, c("socca3 = 0", "socca2d = 0", "soccad2 = 0", "soccd3 = 0"), verbose=TRUE)
Â
#########################
# Analyses for travel #
#########################
Â
# Estimate the constrained algebraic difference score equation.
Â
tvlsatald <- lm(sat ~ tvlald, data=difssublc, na.action=na.exclude)
Â
# Estimate the unconstrained algebraic difference score equation.
Â
tvlsatlin <- lm(sat ~ tvlca + tvlcd, data=difssublc, na.action=na.exclude)
Â
# Test the constraint.
Â
lht(tvlsatlin, c("tvlca + tvlcd = 0"), verbose=TRUE)
Â
# Estimate the quadratic equation and test increment in explained variance beyond the linear equation.
Â
tvlsatqua <- lm(sat ~ tvlca + tvlcd + tvlca2 + tvlcad + tvlcd2, data=difssublc, na.action=na.exclude)
Â
lht(tvlsatqua, c("tvlca2 = 0", "tvlcad = 0", "tvlcd2 = 0"), verbose=TRUE)
Â
# Estimate the constrained squared difference score equation.
Â
tvlsatsqd <- lm(sat ~ tvlsqd, data=difssublc, na.action=na.exclude)
Â
# Estimate the unconstrained squared difference score equation.
Â
tvlsatqua <- lm(sat ~ tvlca + tvlcd + tvlca2 + tvlcad + tvlcd2, data=difssublc, na.action=na.exclude)
Â
# Test the constraints.
Â
lht(tvlsatqua, c("tvlca = 0", "tvlcd = 0", "tvlca2 - tvlcd2 = 0" "tvlca2 + tvlcad + tvlcd2 = 0"), verbose=TRUE)
Â
# Estimate the cubic equation and test increment in explained variance beyond the quadratic equation.
Â
tvlsatcub <- lm(sat ~ tvlca + tvlcd + tvlca2 + tvlcad + tvlcd2 + tvlca3 + tvlca2d + tvlcad2 + tvlcd3, data=difssublc, na.action=na.exclude)
Â
lht(tvlsatqua, c("tvlca3 = 0", "tvlca2d = 0", "tvlcad2 = 0", "tvlcd3 = 0"), verbose=TRUE)
Â
#########################
# Close the output file #
#########################
Â
sink()