`library(modsem)`

In essence quadratic effects are just a special case of interaction effects – where a variable has an interaction effect with itself. Thus, all of the modsem methods can be used to estimate quadratic effects as well.

Here you can see a very simple example using the LMS-approach.

```
library(modsem)
<- '
m1 # Outer Model
X =~ x1 + x2 + x3
Y =~ y1 + y2 + y3
Z =~ z1 + z2 + z3
# Inner model
Y ~ X + Z + Z:X + X:X
'
<- modsem(m1, data = oneInt, method = "lms")
est1Lms summary(est1Lms)
```

In this example we have a simple model with two quadratic effects and one interaction effect, using the QML- and double centering approach, using the data from a subset of the PISA 2006 data.

```
<- '
m2 ENJ =~ enjoy1 + enjoy2 + enjoy3 + enjoy4 + enjoy5
CAREER =~ career1 + career2 + career3 + career4
SC =~ academic1 + academic2 + academic3 + academic4 + academic5 + academic6
CAREER ~ ENJ + SC + ENJ:ENJ + SC:SC + ENJ:SC
'
<- modsem(m2, data = jordan)
est2Dblcent <- modsem(m2, data = jordan, method = "qml")
est2Qml summary(est2Qml)
```

Note: The other approaches work as well, but might be quite slow depending on the number of interaction effects (particularly for the LMS- and constrained approach).