\begin{Schunk}
\begin{Sinput}
 dat <- read.table("data/anxiety.dat", header = F) 
 names(dat) <- c("a1", "a2", "a3", "a4")
 model <- "
    intercept =~ 1*a1 + 1*a2 + 1*a3 + 1*a4 
    slope =~ 0*a1 + 1*a2 + 2*a3 + 3*a4 
    a1 ~ 0*1 
    a2 ~ 0*1 
    a3 ~ 0*1 
    a4 ~ 0*1 
    intercept ~ 1 
    slope ~ 1 
  "
 output <- sem(model, data = dat) 
 summary(output)
\end{Sinput}
\begin{Soutput}
lavaan 0.6-3 ended normally after 45 iterations

  Optimization method                           NLMINB
  Number of free parameters                          9

  Number of observations                           485

  Estimator                                         ML
  Model Fit Test Statistic                      27.288
  Degrees of freedom                                 5
  P-value (Chi-square)                           0.000

Parameter Estimates:

  Information                                 Expected
  Information saturated (h1) model          Structured
  Standard Errors                             Standard

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  intercept =~                                        
    a1                1.000                           
    a2                1.000                           
    a3                1.000                           
    a4                1.000                           
  slope =~                                            
    a1                0.000                           
    a2                1.000                           
    a3                2.000                           
    a4                3.000                           

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)
  intercept ~~                                        
    slope            -0.011    0.003   -3.472    0.001

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)
   .a1                0.000                           
   .a2                0.000                           
   .a3                0.000                           
   .a4                0.000                           
    intercept         0.698    0.020   35.050    0.000
    slope            -0.062    0.006  -10.513    0.000

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .a1                0.067    0.007    8.910    0.000
   .a2                0.048    0.004   11.119    0.000
   .a3                0.048    0.004   11.383    0.000
   .a4                0.040    0.006    6.658    0.000
    intercept         0.151    0.013   11.871    0.000
    slope             0.007    0.001    4.790    0.000
\end{Soutput}
\end{Schunk}
