Built using Zelig version r packageVersion('Zelig')

knitr::opts_knit$set(
        stop_on_error = 2L
)
knitr::opts_chunk$set(eval=FALSE)

The release of Zelig 5.0 expands the set of models available, while simplifying the model wrapping process, and solving architectural problems by completely rewriting into R’s Reference Classes for a fully object-oriented architecture. Comparability wrappers are available so that you can still use pre-Zelig 5 syntax.

Zelig 5 uses reference classes which work a bit differently from what you may expect in R. The big difference is that they are "mutable", i.e. assigning values to them does not overwrite the objects previous contents.

Zelig 5 workflow overview

All models in Zelig 5 can be estimated and results explored presented using a five simple steps:

Here is an example workflow with Zelig 5:

z5 <- zls$new()
z5$zelig(Y ~ X1 + X ~ X, weights = w, data = mydata)
z5$setx()
z5$sim()
z5$graph()

Wrappers

Here is the same set of operations as above using the Zelig 4 wrappers:

z.out <- zelig(Y ~ X1 + X2, model = "ls", weights = w, data = mydata)
x.out <- setx(z.out)
s.out <- sim(z.out, x = x.out)
plot(s.out)

Note that all of the output objects from the Zelig 4 wrappers are Zelig 5 reference class objects, so you can mix and match which syntax you like.

Also note that when using the Zelig 5 methods for a range of fitted values you will need to use setrange rather than setx. For first differences you will need to call $setx1 after $setx. Because of this, using the setx compatibility wrapper can be more straightforward.



IQSS/Zelig documentation built on Dec. 11, 2023, 1:51 a.m.