pgsc {pgsc} | R Documentation |
Wrapper function for GSC estimation
Description
Wrapper function for GSC estimation
Usage
pgsc(dta, dep.var, indep.var, b.init, method, sol.it = NULL,
wt.init = NULL, print.level = 0, g.i = NULL, g.i.grad = NULL,
...)
Arguments
dta |
A data frame |
dep.var |
A string defining the dependent variable |
indep.var |
A vector of strings defining the independent (treatment) variables |
b.init |
An initial value for the treatment variable coefficients. Must have same length as 'indep.var' |
method |
The GSC iteration method to be used. Must be one of:
|
sol.it |
The first step solution used in the two-step methods. If omitted, a new one-step solution is computed. |
wt.init |
An initial value for the weighting matrix |
print.level |
The level of detail provided in the printed output |
g.i |
A function defining a restriction on the parameters. Used in hypothesis testing. |
g.i.grad |
The gradient of |
... |
Other arguments to be passed to the optimization |
Details
See the vignette "Using pgsc
" for an extended example.
Value
Returns the point estimate of the model as a gsc
object, a list with entries:
- b
The point estimate of the coefficients on the dependent variables
- diff
The difference between successive iterations
- err
The maximum error on the within-iteration optimization problems
- it
Number of iterations require to solve
- sig.i
The unit-specific MSEs from the solution
- W
The "full" weighting matrix for counterfactuals, containing own-unit weights (all zero) and unit-N weights
- wt
The "minimal" weighting matrix, omitting own-unit weights and weights on unit N (which can be computed as one-minus-rowsum)
Examples
data("pgsc.dta")
sol <- pgsc(pgsc.dta, dep.var = 'y', indep.var = c('D1','D2'),
b.init = c(0,0), method='onestep' )
summary(sol)
g.i <- function(b) b[1] ; g.i.grad <- function(b) c(1,0)
sol.r <- pgsc(pgsc.dta, dep.var = 'y', indep.var = c('D1','D2'),
b.init = sol$b, method='onestep', g.i=g.i, g.i.grad=g.i.grad )
summary(sol.r)