require(lavaan)
## Loading required package: lavaan
## This is lavaan 0.6-19
## lavaan is FREE software! Please report any bugs.
PartialCorrData <- read.table("partialcorrelation.txt", header = TRUE) ;
Fig7.2aModel<-"
! regressions
TrueScore=~1.0*ACTEng
! residuals, variances and covariances
ACTEng ~~ 2.235*ACTEng
TrueScore ~~ TrueVar*TrueScore
! observed means
ACTEng~1;
"
Fig7.2aresult<-lavaan(Fig7.2aModel, data=PartialCorrData, fixed.x=FALSE, missing="FIML")
summary(Fig7.2aresult, fit.measures=TRUE)
## Warning: lavaan->lav_fit_cfi_lavobject():
## computation of robust CFI resulted in NA values.
## Warning: lavaan->lav_fit_rmsea_lavobject():
## computation of robust RMSEA resulted in NA values.
## lavaan 0.6-19 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 2
##
## Number of observations 444
## Number of missing patterns 1
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 0.000
## Degrees of freedom 0
## P-value NA
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1229.810
## Loglikelihood unrestricted model (H1) -1229.810
##
## Akaike (AIC) 2463.620
## Bayesian (BIC) 2471.811
## Sample-size adjusted Bayesian (SABIC) 2465.464
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower NA
## 90 Percent confidence interval - upper NA
## P-value H_0: Robust RMSEA <= 0.050 NA
## P-value H_0: Robust RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## TrueScore =~
## ACTEng 1.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .ACTEng 22.074 0.183 120.473 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .ACTEng 2.235
## TrueScr (TrVr) 12.672 1.000 12.666 0.000
require(lavaangui)
## Loading required package: lavaangui
## This is lavaangui 0.2.4
## lavaangui is BETA software! Please report any bugs at https://github.com/karchjd/lavaangui/issues
#plot_lavaan(Fig7.2aresult)
Figure4.2bmodel<-"
! regressions
TrueScore=~SDT*ACTEng
Error=~3.86*ACTEng
! residuals, variances and covariances
TrueScore ~~ 1.0*TrueScore
Error ~~ 0.15*Error
TrueScore ~~ 0.0*Error
! observed means
ACTEng~1;
"
Figure4.2bresult<-lavaan(Figure4.2bmodel, data=PartialCorrData, fixed.x=FALSE, missing="FIML")
summary(Figure4.2bresult, fit.measures=TRUE)
## Warning: lavaan->lav_fit_cfi_lavobject():
## computation of robust CFI resulted in NA values.
## lavaan 0.6-19 ended normally after 8 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 2
##
## Number of observations 444
## Number of missing patterns 1
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 0.000
## Degrees of freedom 0
## P-value NA
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1229.810
## Loglikelihood unrestricted model (H1) -1229.810
##
## Akaike (AIC) 2463.620
## Bayesian (BIC) 2471.811
## Sample-size adjusted Bayesian (SABIC) 2465.464
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: Robust RMSEA <= 0.050 NA
## P-value H_0: Robust RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## TrueScore =~
## ACTEng (SDT) 3.560 0.141 25.332 0.000
## Error =~
## ACTEng 3.860
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## TrueScore ~~
## Error 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .ACTEng 22.074 0.183 120.473 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## TrueScore 1.000
## Error 0.150
## .ACTEng 0.000
require(lavaangui)
#plot_lavaan(Figure4.2bresult)
library(ggplot2)
library(grid)
# Set angle (in degrees and radians)
theta_deg <- 66
theta_rad <- theta_deg * pi / 180
# Unit vectors
predictor <- c(1, 0) # horizontal vector of unit length
criterion <- c(cos(theta_rad), sin(theta_rad)) # 66° from x-axis
# Projection of criterion onto predictor (Y-hat)
proj_length <- sum(criterion * predictor) # dot product
yhat_vector <- proj_length * predictor
# Residual (error) vector
error_vector <- criterion - yhat_vector
error_length <- sqrt(sum(error_vector^2))
# Create a data frame for vectors
vectors <- data.frame(
x = c(0, 0, 0, yhat_vector[1]),
y = c(0, 0, 0, yhat_vector[2]),
xend = c(predictor[1], criterion[1], yhat_vector[1], criterion[1]),
yend = c(predictor[2], criterion[2], yhat_vector[2], criterion[2]),
label = c("Predictor", "Criterion", "Y-hat", "Residual")
)
# Vector length annotations
annotations <- data.frame(
x = c(predictor[1]/2, criterion[1]/2, yhat_vector[1]/2, (yhat_vector[1] + criterion[1])/2),
y = c(predictor[2]/2 + 0.05, criterion[2]/2 + 0.05, yhat_vector[2]/2 + 0.05,
(yhat_vector[2] + criterion[2])/2 + 0.05),
text = c("1.0", "1.0", sprintf("%.2f", proj_length), sprintf("%.2f", error_length))
)
# Plot the vectors
ggplot() +
geom_segment(data = vectors, aes(x = x, y = y, xend = xend, yend = yend, color = label),
arrow = arrow(length = unit(0.25, "cm")), linewidth = 1.2) +
geom_text(data = annotations, aes(x = x, y = y, label = text), size = 5, fontface = "bold") +
coord_fixed(xlim = c(0, 1.2), ylim = c(0, 1.2)) +
scale_color_manual(values = c("Predictor" = "blue",
"Criterion" = "black",
"Y-hat" = "darkgreen",
"Residual" = "red")) +
labs(title = "Vector Diagram: Y = Y-hat + Residual (66° Correlation)",
x = "Predictor (X)", y = "Criterion (Y)") +
theme_minimal(base_size = 14) +
theme(legend.position = "top")
library(ggplot2)
library(grid)
# Angle and unit vectors
theta_deg <- 26
theta_rad <- theta_deg * pi / 180
# Define vectors
true_x <- c(1, 0) # True X (horizontal)
observed_x <- c(cos(theta_rad), sin(theta_rad)) # 26° from x-axis
# Projection of Observed X onto True X (X-hat)
proj_length <- sum(observed_x * true_x)
xhat_vector <- proj_length * true_x
# Residual vector
residual_vector <- observed_x - xhat_vector
residual_length <- sqrt(sum(residual_vector^2))
# Data frame for vector segments
vectors <- data.frame(
x = c(0, 0, 0, xhat_vector[1]),
y = c(0, 0, 0, xhat_vector[2]),
xend = c(true_x[1], observed_x[1], xhat_vector[1], observed_x[1]),
yend = c(true_x[2], observed_x[2], xhat_vector[2], observed_x[2]),
label = c("True X", "Observed X", "Predicted Component", "Residual")
)
# Annotations for vector lengths
annotations <- data.frame(
x = c(true_x[1] + 0.05,
observed_x[1]/2,
xhat_vector[1]/2,
(xhat_vector[1] + observed_x[1])/2),
y = c(true_x[2] + 0.02, # ← slight vertical shift
observed_x[2]/2 + 0.05,
xhat_vector[2]/2 + 0.05,
(xhat_vector[2] + observed_x[2])/2 + 0.05),
text = c("1.0", "1.0", sprintf("%.2f", proj_length), sprintf("%.2f", residual_length))
)
# Plot
ggplot() +
geom_segment(data = vectors, aes(x = x, y = y, xend = xend, yend = yend, color = label),
arrow = arrow(length = unit(0.25, "cm")), linewidth = 1.2) +
geom_text(data = annotations, aes(x = x, y = y, label = text), size = 5, fontface = "bold") +
coord_fixed(xlim = c(0, 1.2), ylim = c(0, 0.6)) +
scale_color_manual(values = c("True X" = "blue",
"Observed X" = "black",
"Predicted Component" = "darkgreen",
"Residual" = "red")) +
labs(title = "Vector Diagram: Observed X as a Noisy Proxy for True X (26° Angle)",
x = "True X", y = "Observed X") +
theme_minimal(base_size = 12) +
theme(legend.position = "top")
Variables are assumed standardized and 0.22 is fixed at 1-alpha Read in Data, Specify and Run Model
#Read in Data
AttenData <-
read.table("partialcorrelation.txt", header = TRUE) ;
# Estimate Model
library(lavaan);
Attenmodel<-"
! regressions
TrueAlcQF=~SqrtAlpha*AlcQF + NA*AlcQF
ErrorA=~1.0*AlcQF
TrueAlcQF=~b*GPA
Error=~1.0*GPA
! residuals, variances and covariances
TrueAlcQF ~~ 1.0*TrueAlcQF
ErrorA ~~ 0.22*ErrorA
Error ~~ ErrorV*Error
TrueAlcQF ~~ 0.0*Error
! observed means
GPA~1;
AlcQF~1;
"
AttenDataStd <- as.data.frame(scale(AttenData))
Attenresult<-lavaan(Attenmodel, data=AttenDataStd, fixed.x=FALSE, missing="FIML");
summary(Attenresult, fit.measures=TRUE,standardized=TRUE);
## lavaan 0.6-19 ended normally after 8 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 5
##
## Number of observations 444
## Number of missing patterns 1
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 34.503
## Degrees of freedom 1
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1241.765
## Loglikelihood unrestricted model (H1) -1241.765
##
## Akaike (AIC) 2493.530
## Bayesian (BIC) 2514.009
## Sample-size adjusted Bayesian (SABIC) 2498.141
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: Robust RMSEA <= 0.050 NA
## P-value H_0: Robust RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TrueAlcQF =~
## AlcQF (SqrA) 0.882 0.038 23.229 0.000 0.882 0.883
## ErrorA =~
## AlcQF 1.000 0.469 0.470
## TrueAlcQF =~
## GPA (b) -0.309 0.052 -5.929 0.000 -0.309 -0.310
## Error =~
## GPA 1.000 0.950 0.951
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TrueAlcQF ~~
## Error 0.000 0.000 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GPA 0.000 0.047 0.000 1.000 0.000 0.000
## .AlcQF -0.000 0.047 -0.000 1.000 -0.000 -0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TrAlcQF 1.000 1.000 1.000
## ErrorA 0.220 1.000 1.000
## Error (ErrV) 0.902 0.062 14.466 0.000 1.000 1.000
## .AlcQF 0.000 0.000 0.000
## .GPA 0.000 0.000 0.000
require(lavaangui)
#plot_lavaan(Attenresult)
Corrmodel<-"
! regressions
ErrorE=~3.86*ACTEng
ErrorA=~11.93*AlcQF
TrueACT=~SACT*ACTEng
TrueAlc=~SAlc*AlcQF
! residuals, variances and covariances
ErrorE ~~ 0.15*ErrorE
ErrorA ~~ 0.22*ErrorA
TrueACT ~~ 1.0*TrueACT
TrueAlc ~~ 1.0*TrueAlc
TrueACT ~~ r*TrueAlc
ErrorE ~~ 0.0*ErrorA
ErrorE ~~ 0.0*TrueACT
ErrorE ~~ 0.0*TrueAlc
ErrorA ~~ 0.0*TrueACT
ErrorA ~~ 0.0*TrueAlc
! observed means
ACTEng~1;
AlcQF~1;
"
Corrresult<-lavaan(Corrmodel, data=AttenData, fixed.x=FALSE, missing="FIML");
summary(Corrresult, fit.measures=TRUE,standardized=TRUE);
## lavaan 0.6-19 ended normally after 22 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 5
##
## Number of observations 444
## Number of missing patterns 1
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 4.997
## Degrees of freedom 1
## P-value 0.025
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -2958.135
## Loglikelihood unrestricted model (H1) -2958.135
##
## Akaike (AIC) 5926.270
## Bayesian (BIC) 5946.749
## Sample-size adjusted Bayesian (SABIC) 5930.881
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: Robust RMSEA <= 0.050 NA
## P-value H_0: Robust RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ErrorE =~
## ACTEng 3.860 1.495 0.387
## ErrorA =~
## AlcQF 11.930 5.596 0.469
## TrueACT =~
## ACTEng (SACT) 3.560 0.141 25.332 0.000 3.560 0.922
## TrueAlc =~
## AlcQF (SAlc) 10.540 0.453 23.247 0.000 10.540 0.883
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TrueACT ~~
## TrueAlc (r) -0.130 0.057 -2.260 0.024 -0.130 -0.130
## ErrorE ~~
## ErrorA 0.000 0.000 0.000
## TrueACT 0.000 0.000 0.000
## TrueAlc 0.000 0.000 0.000
## ErrorA ~~
## TrueACT 0.000 0.000 0.000
## TrueAlc 0.000 0.000 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ACTEng 22.074 0.183 120.473 0.000 22.074 5.717
## .AlcQF 8.224 0.566 14.521 0.000 8.224 0.689
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ErrorE 0.150 1.000 1.000
## ErrorA 0.220 1.000 1.000
## TrueACT 1.000 1.000 1.000
## TrueAlc 1.000 1.000 1.000
## .ACTEng 0.000 0.000 0.000
## .AlcQF 0.000 0.000 0.000
require(lavaangui)
#plot_lavaan(Corrresult)
Atten2model<-"
! regressions
ErrorAlc=~11.94*AlcQF
ErrorEng=~3.86*ACTEng
TrueAlc=~1.0*AlcQF
TrueACT=~SActTue*ACTEng
TrueGPA=~1.0*GPA
ErrorGPA=~0.707106781*GPA
AlcAdj=~sAlcAdj*TrueAlc
TrueACT=~b2*TrueAlc
GPAAdj=~SGPAAdj*TrueGPA
TrueACT=~b1*TrueGPA
! residuals, variances and covariances
ErrorAlc ~~ 0.22*ErrorAlc
ErrorEng ~~ 0.15*ErrorEng
TrueACT ~~ 1.0*TrueACT
ErrorGPA ~~ 0.19*ErrorGPA
AlcAdj ~~ 1.0*AlcAdj
GPAAdj ~~ 1.0*GPAAdj
AlcAdj ~~ rGPAAlc_ACT*GPAAdj
TrueAlc~~0*TrueAlc
TrueGPA~~0*TrueGPA
ErrorAlc ~~ 0.0*ErrorEng
ErrorAlc ~~ 0.0*TrueAlc
ErrorAlc ~~ 0.0*TrueACT
ErrorAlc ~~ 0.0*ErrorGPA
ErrorAlc ~~ 0.0*TrueGPA
ErrorAlc ~~ 0.0*AlcAdj
ErrorAlc ~~ 0.0*GPAAdj
ErrorEng ~~ 0.0*TrueAlc
ErrorEng ~~ 0.0*TrueACT
ErrorEng ~~ 0.0*ErrorGPA
ErrorEng ~~ 0.0*TrueGPA
ErrorEng ~~ 0.0*AlcAdj
ErrorEng ~~ 0.0*GPAAdj
TrueAlc ~~ 0.0*ErrorGPA
TrueAlc ~~ 0.0*TrueGPA
TrueAlc ~~ 0.0*GPAAdj
TrueACT ~~ 0.0*ErrorGPA
TrueACT ~~ 0.0*AlcAdj
TrueACT ~~ 0.0*GPAAdj
ErrorGPA ~~ 0.0*TrueGPA
ErrorGPA ~~ 0.0*AlcAdj
ErrorGPA ~~ 0.0*GPAAdj
TrueGPA ~~ 0.0*AlcAdj
! observed means
AlcQF~1;
ACTEng~1;
GPA~1;
"
Atten2result<-lavaan(Atten2model, data=AttenData, fixed.x=FALSE, missing="FIML");
summary(Atten2result, fit.measures=TRUE,standardized=TRUE);
## lavaan 0.6-19 ended normally after 33 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Number of observations 444
## Number of missing patterns 1
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 111.950
## Degrees of freedom 3
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -3380.813
## Loglikelihood unrestricted model (H1) -3380.813
##
## Akaike (AIC) 6779.625
## Bayesian (BIC) 6816.488
## Sample-size adjusted Bayesian (SABIC) 6787.926
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: Robust RMSEA <= 0.050 NA
## P-value H_0: Robust RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ErrorAlc =~
## AlcQF 11.940 5.600 0.469
## ErrorEng =~
## ACTEng 3.860 1.495 0.387
## TrueAlc =~
## AlcQF 1.000 10.537 0.883
## TrueACT =~
## ACTEng (SAcT) 3.560 0.141 25.332 0.000 3.560 0.922
## TrueGPA =~
## GPA 1.000 0.636 0.900
## ErrorGPA =~
## GPA 0.707 0.308 0.436
## AlcAdj =~
## TrueAlc (sAlA) 10.448 0.452 23.094 0.000 0.992 0.992
## TrueACT =~
## TrueAlc (b2) -1.369 0.612 -2.237 0.025 -0.130 -0.130
## GPAAdj =~
## TrueGPA (SGPA) 0.558 0.025 21.928 0.000 0.876 0.876
## TrueACT =~
## TrueGPA (b1) 0.307 0.034 8.914 0.000 0.482 0.482
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## AlcAdj ~~
## GPAAdj (rGPA) -0.324 0.058 -5.601 0.000 -0.324 -0.324
## ErrorAlc ~~
## ErrrEng 0.000 0.000 0.000
## .TrueAlc 0.000 NaN NaN
## TrueACT 0.000 0.000 0.000
## ErrrGPA 0.000 0.000 0.000
## .TrueGPA 0.000 NaN NaN
## AlcAdj 0.000 0.000 0.000
## GPAAdj 0.000 0.000 0.000
## ErrorEng ~~
## .TrueAlc 0.000 NaN NaN
## TrueACT 0.000 0.000 0.000
## ErrrGPA 0.000 0.000 0.000
## .TrueGPA 0.000 NaN NaN
## AlcAdj 0.000 0.000 0.000
## GPAAdj 0.000 0.000 0.000
## .TrueAlc ~~
## ErrrGPA 0.000 NaN NaN
## .TrueGPA 0.000 NaN NaN
## GPAAdj 0.000 NaN NaN
## TrueACT ~~
## ErrrGPA 0.000 0.000 0.000
## AlcAdj 0.000 0.000 0.000
## GPAAdj 0.000 0.000 0.000
## .TrueGPA ~~
## ErrrGPA 0.000 NaN NaN
## ErrorGPA ~~
## AlcAdj 0.000 0.000 0.000
## GPAAdj 0.000 0.000 0.000
## .TrueGPA ~~
## AlcAdj 0.000 NaN NaN
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .AlcQF 8.224 0.566 14.521 0.000 8.224 0.689
## .ACTEng 22.074 0.183 120.473 0.000 22.074 5.717
## .GPA 2.736 0.034 81.526 0.000 2.736 3.869
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ErrorAlc 0.220 1.000 1.000
## ErrorEng 0.150 1.000 1.000
## TrueACT 1.000 1.000 1.000
## ErrorGPA 0.190 1.000 1.000
## AlcAdj 1.000 1.000 1.000
## GPAAdj 1.000 1.000 1.000
## .TrueAlc 0.000 0.000 0.000
## .TrueGPA 0.000 0.000 0.000
## .AlcQF 0.000 0.000 0.000
## .ACTEng 0.000 0.000 0.000
## .GPA 0.000 0.000 0.000
require(lavaangui)
#plot_lavaan(Atten2result)
TwoPredmodel<-"
! regressions
TrueACT=~SDActTue*ACTEng
TrueGPA=~SDGpaTrue*GPA
TrueAlc=~1.0*AlcQF
AlcAdj=~d*TrueAlc
TrueACT=~b2*TrueAlc
TrueGPA=~b1*TrueAlc
! residuals, variances and covariances
TrueACT ~~ 1.0*TrueACT
AlcAdj ~~ 1.0*AlcAdj
TrueGPA ~~ 1.0*TrueGPA
TrueGPA ~~ rGPAACT*TrueACT
GPA ~~ 0.19*GPA
ACTEng ~~ 0.15*ACTEng
AlcQF ~~ 0.22*AlcQF
TrueAlc~~0*TrueAlc
TrueACT ~~ 0.0*AlcAdj
TrueGPA ~~ 0.0*AlcAdj
! observed means
ACTEng~1;
GPA~1;
AlcQF~1;
"
AttenDataStd <- as.data.frame(scale(AttenData))
TwoPredresult<-lavaan(TwoPredmodel, data=AttenDataStd, fixed.x=FALSE, missing="FIML");
summary(TwoPredresult, fit.measures=TRUE,standardized=TRUE);
## lavaan 0.6-19 ended normally after 14 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Number of observations 444
## Number of missing patterns 1
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 111.950
## Degrees of freedom 3
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1832.549
## Loglikelihood unrestricted model (H1) -1832.549
##
## Akaike (AIC) 3683.099
## Bayesian (BIC) 3719.961
## Sample-size adjusted Bayesian (SABIC) 3691.399
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: Robust RMSEA <= 0.050 NA
## P-value H_0: Robust RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TrueACT =~
## ACTEng (SDAT) 0.921 0.036 25.319 0.000 0.921 0.922
## TrueGPA =~
## GPA (SDGT) 0.899 0.037 24.125 0.000 0.899 0.900
## TrueAlc =~
## AlcQF 1.000 0.882 0.883
## AlcAdj =~
## TrueAlc (d) 0.827 0.038 21.945 0.000 0.938 0.938
## TrueACT =~
## TrueAlc (b2) 0.041 0.060 0.694 0.487 0.047 0.047
## TrueGPA =~
## TrueAlc (b1) -0.324 0.061 -5.270 0.000 -0.367 -0.367
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TrueACT ~~
## TrueGPA (rGPA) 0.482 0.046 10.391 0.000 0.482 0.482
## AlcAdj 0.000 0.000 0.000
## TrueGPA ~~
## AlcAdj 0.000 0.000 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ACTEng -0.000 0.047 -0.000 1.000 -0.000 -0.000
## .GPA 0.000 0.047 0.000 1.000 0.000 0.000
## .AlcQF -0.000 0.047 -0.000 1.000 -0.000 -0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## TrueACT 1.000 1.000 1.000
## AlcAdj 1.000 1.000 1.000
## TrueGPA 1.000 1.000 1.000
## .GPA 0.190 0.190 0.190
## .ACTEng 0.150 0.150 0.150
## .AlcQF 0.220 0.220 0.220
## .TrueAlc 0.000 0.000 0.000
require(lavaangui)
#plot_lavaan(TwoPredresult)