Import Data

library(haven)

kid_score <- read_sav("kid_score.sav")

Descriptives

First six lines

head(kid_score)
## # A tibble: 6 × 5
##   kid_score mom_hs                           mom_iq mom_work             mom_age
##       <dbl> <dbl+lbl>                         <dbl> <dbl+lbl>              <dbl>
## 1        65 1 [Graduated high school]         121.  4 [Mother worked fu…      27
## 2        98 1 [Graduated high school]          89.4 4 [Mother worked fu…      25
## 3        85 1 [Graduated high school]         115.  4 [Mother worked fu…      27
## 4        83 1 [Graduated high school]          99.4 3 [Mother worked pa…      25
## 5       115 1 [Graduated high school]          92.7 4 [Mother worked fu…      27
## 6        98 0 [Did not graduate high school]  108.  1 [Mother did not w…      18

Means of the Data

colMeans(kid_score[c(1, 2, 3, 5)])
##   kid_score      mom_hs      mom_iq     mom_age 
##  86.7972350   0.7857143 100.0000000  22.7857143

Correlation Matrix

ks_Cor <- cor(kid_score)
ks_Cor
##            kid_score    mom_hs    mom_iq   mom_work    mom_age
## kid_score 1.00000000 0.2369164 0.4482758 0.08752798 0.09199819
## mom_hs    0.23691643 1.0000000 0.2827094 0.25391024 0.21452839
## mom_iq    0.44827584 0.2827094 1.0000000 0.11480298 0.09160840
## mom_work  0.08752798 0.2539102 0.1148030 1.00000000 0.13559759
## mom_age   0.09199819 0.2145284 0.0916084 0.13559759 1.00000000

Summary stats for the data

library(psych)

describe(kid_score)
##           vars   n   mean    sd median trimmed   mad   min    max  range  skew
## kid_score    1 434  86.80 20.41  90.00   87.93 19.27 20.00 144.00 124.00 -0.46
## mom_hs       2 434   0.79  0.41   1.00    0.86  0.00  0.00   1.00   1.00 -1.39
## mom_iq       3 434 100.00 15.00  97.92   99.11 15.89 71.04 138.89  67.86  0.47
## mom_work     4 434   2.90  1.18   3.00    2.99  1.48  1.00   4.00   3.00 -0.45
## mom_age      5 434  22.79  2.70  23.00   22.71  2.97 17.00  29.00  12.00  0.18
##           kurtosis   se
## kid_score    -0.19 0.98
## mom_hs       -0.07 0.02
## mom_iq       -0.59 0.72
## mom_work     -1.39 0.06
## mom_age      -0.65 0.13

Summary of the Regression Model

library(lavaan)
## This is lavaan 0.6-13
## lavaan is FREE software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
regression_syntax <- "kid_score ~ mom_iq + mom_hs + mom_age"


Regression.model <- sem(regression_syntax, kid_score)

summary(Regression.model, rsquare = TRUE, standardize = TRUE)
## lavaan 0.6.13 ended normally after 1 iteration
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                         4
## 
##   Number of observations                           434
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   kid_score ~                                                           
##     mom_iq            0.563    0.060    9.319    0.000    0.563    0.413
##     mom_hs            5.647    2.247    2.513    0.012    5.647    0.114
##     mom_age           0.225    0.329    0.683    0.495    0.225    0.030
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .kid_score       326.279   22.149   14.731    0.000  326.279    0.785
## 
## R-Square:
##                    Estimate
##     kid_score         0.215

Covariance Model

ks_Cov <- cov(kid_score)
# sem(model_syntax, sample.cov = covariance_matrix, sample.nobs = samp_size)
covariance.model <- sem(regression_syntax, sample.cov = ks_Cov, sample.nobs = 434)

summary(covariance.model, rsquare = TRUE, standardize = TRUE)
## lavaan 0.6.13 ended normally after 1 iteration
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                         4
## 
##   Number of observations                           434
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   kid_score ~                                                           
##     mom_iq            0.563    0.060    9.319    0.000    0.563    0.413
##     mom_hs            5.647    2.247    2.513    0.012    5.647    0.114
##     mom_age           0.225    0.329    0.683    0.495    0.225    0.030
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .kid_score       326.279   22.149   14.731    0.000  326.279    0.785
## 
## R-Square:
##                    Estimate
##     kid_score         0.215

Interpretation

Review of covariance data and regression model show that they have the same result.