`merlin`

used to be called `megenreg`

… I’m sure everyone (except Tim Morris…he was a `forge`

fan) will agree `merlin`

is a better name. I’m planning T-shirts…

`merlin`

stands for Mixed Effects Regression for LInear and Non-linear models. `merlin`

can fit multivariate
outcome models of any type, each of which could be repeatedly measured (panel/longitudinal), with any number of levels, and with any number of random effects at each level. Standard distributions/models available include the Bernoulli, beta, gamma, Gaussian, linear quantile, negative binomial, ordinal, Poisson, and time-to-event/survival models include the exponential, gompertz, splines on the log hazard scale, Royston-Parmar, and Weibull. `merlin`

provides a flexible predictor syntax, allowing the user to define variables, random effects, spline and fractional polynomial functions, functions of other outcome models, and any interaction of them. Non-linear and time-dependent effects are seamlessly incorporated into the predictor. `merlin`

allows level-specific random effect distributions, either multivariate normal or $t$, which are integrated out using either Gaussian quadrature or Monte-Carlo integration.

$~$

`merlin`

version 1.0.0 is now released

The development version is now up on my website, and you can install it by typing:

```
net install merlin, from("https://www.mjcrowther.co.uk/code/merlin")
```

It’ll be on SSC very soon as well, and when it is, I recommend you uninstall the development version, and install the SSC version instead. Development updates will be pushed to my website first.

All of the tutorials on the accompanying `merlin`

pages have been updated.

There are some big changes and improvements:

- syntax re-write ->
`megenreg`

used to require naming parameters through`@name`

notation, when anything more complicated than a`varname`

was specified in the complex predictor, now`@`

is only required when specifying a constraint on a parameter, such as`M1[id]@1`

when specifying a random intercept. This is much more consistent with`gsem`

, and a lot more convenient. - syntax re-write ->
`fp(varname, ...)`

and`rcs(varname, ...)`

now take a variable input to specify fractional polynomial and restricted cubic spline elements. Before,`fp()`

and`rcs()`

elements could only be used with`timevar()`

for time-dependent effects. Now they can be used with any variable, but if`varname`

matches with that in`timevar()`

then time-dependent effects are automatically handled. `offset()`

has also been added as an option of both`fp()`

and`rcs()`

- interactions between
`fp()`

and`rcs()`

elements etc. are now allowed - predictions have (finally) been added -> currently supporting
`fixedonly`

which calculates predictions based only on the fixed effects, and`marginal`

which calculates predictions by marginalising over the random effects. Available predictions include the expected value of an outcome, the expected value of a complex predictor, the hazard function, the cumulative hazard function, the survival function, and restricted mean survival time. Lots more to add. Predictions can be made`at()`

specified covariate patterns, and at user-specified times using a`timevar()`

. `EV[]`

notation now corresponds to the expected value of a response, whereas before it corresponded to the expected value of each model’s complex predictor - which has been replaced with`XB[]`

elements.- random effect names in the complex syntax must now start with a capital
`M`

e.g.`M#[]`

- all help files updated, including documenting all utility functions for use in
`family(user)`

distributions - results table substantially improved

Error checks and bug fixes:

- bug fix with if statements
- error check added for . notation or ## in a complex predictor, as they are not supported

There’s a lot more to come from `merlin`

.