Least Squares Regression for Continuous Dependent Variables
formula | an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
---|---|
data | an optional data frame, list or environment (or object coercible
by Imputed data sets created with amelia or |
... | arguments to pass to |
model | a character string specifying the model type. NOTE: only required if using the Zelig 4 wrappers. |
weights | an optional vector of weight values or character string
identifying a weighting variable in
|
by | an optional character string identifying a variable in |
bootstrap | logical whether or not to bootstrap the data set. |
cite | logical whether or not to return model citation information to the console when the model has been estimated. |
Use least squares regression analysis to estimate the best linear predictor for the specified dependent variables.
Vignette: http://docs.zeligproject.org/en/latest/zelig-ls.html
zelig(formula, data, model = NULL, ..., weights = NULL, by,
bootstrap = FALSE)
The zelig function estimates a variety of statistical models
not_run({ # Workflow: Zelig 5 Reference Classes z5 <- zls$new() z5$zelig(Y ~ X1 + X ~ X, weights = w, data = mydata) z5$setx() z5$sim() z5$graph() # Workflow: Zelig 4 Wrappers z.out <- zelig(Y ~ X1 + X2, model = "ls", weights = w, data = mydata, cite = FALSE) x.out <- setx(z.out) s.out <- sim(z.out, x = x.out) plot(s.out) }) # Basic Example with First Differences (using Zelig 4 wrappers) # data(macro) # Estimate model z.out1 <- zelig(unem ~ gdp + capmob + trade, model = "ls", data = macro) # Set explanatory variables to their default (mean/mode) values, with high # (80th percentile) and low (20th percentile) values for the trade variable x.high <- setx(z.out1, trade = quantile(macro$trade, 0.8)) x.low <- setx(z.out1, trade = quantile(macro$trade, 0.2)) # Simulate quantities of interest s.out1 <- sim(z.out1, x = x.high, x1 = x.low) not_run({ # Plot first differences plot(s.out1) })