NnDd: Nearest Neighbour Matching (NN) followed by a Linear Model...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/NnDd.R

Description

Constructs NN by estimating pscores with a GLM and estimates a linear model in a DD setting

Usage

1
2
3
4
5
6
7
8
NnDd(formula, data, indexes = c("year", "firm_id", "tg", "outcome"),
	nn_time = c("2001", "2001"), t_time = "2002", time_ids = c("year", ""), 
	family = "binomial", subset, na.action, model = TRUE, 
	y = TRUE, x = FALSE,  ...)

nndd_reshape(object_NnDd)

nndd_reshape_other(call, data)

Arguments

formula

a formula expression of the form tg | outcome ~ x | z where tg is the response and z regressor variable of the GLM. outcome is the response and x the regressor variable of the DD model.

data

a data frame containing the variables occurring in the formulas such as time and group identifiers. The data has to be a panel.

indexes

a list containing the name of the time, group, treatment identifier, and the outcome variable #Fixme: last two not really necessary

nn_time

a list containing the start timing and end timing for the NN estimation. The GLM is estimated at the end timing. However, it contains all regressor variables lagged in the given interval (start , end).

t_time

a string containing the timing of the treatment.

time_ids

#Fixme: delete this

family

family of the GLM. #Fixme: not implemented in NnDd, but in predict.NnDd

subset

an optional vector specifying a subset of observations to be used for fitting.

na.action

a function which indicates what should happen when the data contain NAs.

model

logical. If TRUE model frame is included as a component of the returned value.

x, y

#Fixme: do I need this?

...

arguments to be passed on to the estimation of the DD (lm.fit)

object_NnDd

an object of class "NnDd"

call

a call of a "NnDd" object

Details

plot.NnDd Creates eight plots in one window. The first tow plots are the distribution of the treated and control pscores pre and post the Nn selection. If data is not specified the pre Nn plot is omitted. In the following the outcome variable of the Dd estimation is plotted over time. For a description of the last four plots see plot.lm.

Value

NnDd

An object of class "NnDd".

nndd_reshape

A data.frame containing a reshaped model matrix of the "NdDd" object.

nndd_reshape_other

A data.frame containing reshaped data.

predict_fun_glm

A list containing pscores.

predict.NnDd

A data.frame containing the specified predictions.

print.NnDd

Returns the imputed object.

plot.NnDd

#Fixme: Ns are not well chosen at the Density plots (the N is of the control) Name of the plot is returned.

Note

Fixme

Author(s)

[aut]

References

Fixme

See Also

Fixme:

Examples

1
2
3
4
5
6
7
8
require(Formula)
set.seed(2015-5-23)
data <- gen_data(treated.n = 50, control.n = 50)
formula <- Formula(tg | outcome ~ X6+X9+X10+X11 | X6+X9+X10+X11+X12+X13) 
nndd <- NnDd(formula, data = data, indexes = c("year", "firm_id", "tg", "outcome"), 
		nn_time = c(1997,2001), t_time = "2002")
names(nndd)
print(nndd)

NnDd documentation built on May 2, 2019, 6:49 p.m.

Related to NnDd in NnDd...