A wrapper of glm
, this function estimates a lagged regression model of
adoption as a function of exposure and other controls as especified by the
user.
diffreg(model, type = c("logit", "probit"))
An object of class formula where the right-hand-side is an object of
class diffnet
Character scalar. Either "probit"
or "logit"
.
An object of class glm
.
The model must be in the following form:
<diffnet object> ~ exposure + covariate1 + covariate2 + ...
Where exposure
can be especified either as a simple term, or as a
call to the exposure function, e.g. to compute exposure with a lag of
length 2, the formula could be:
<diffnet object> ~ exposure(lags = 2) + covariate1 + covariate2 + ...
When no argument is passed to exposure
, the function sets a lag
of length 1 by default (see the Lagged regression section).
This is a wrapper of glm
. The function does the
following steps:
Compute exposure by calling exposure
on the LHS (dependent variable).
Modify the formula so that the model is on adoption as a function of exposure and whatever covariates the user specifies.
Selects either "probit"
or "logit"
and prepares the call
to glm
. This includes passing the following line:
This results in including observations that either did not adopted or up to the time of adoption.
Estimates the model.
The data passed to glm
is obtained by using as.data.frame.diffnet
.
The model estimated is a lagged regression model that has two main assumptions:
The network is exogenous to the behavior (no selection effect)
The influence effect (diffusion) happens in a lagged fasion, hence, exposure is computed lagged.
If either of these two assumptions is not met, then the model becomes endogenous, ans so inference becomes invalid.
In the case of the first assumption, the user can overcome the non-exogeneity
problem by providing an alternative network. This can be done by especifying
alt.graph
in the exposure
function so that the network becomes
exogenous to the adoption.
data("medInnovationsDiffNet")
# Default model
ans <- diffreg(
medInnovationsDiffNet ~ exposure + factor(city) + proage + per)
summary(ans)
#>
#> Call:
#> glm(formula = Adopt ~ exposure + factor(city) + proage + per,
#> family = binomial(link = "logit"), data = dat, subset = ifelse(is.na(toa),
#> TRUE, toa >= per))
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -3.17030 0.34339 -9.232 < 2e-16 ***
#> exposure -0.23786 0.30608 -0.777 0.43709
#> factor(city)2 -0.18010 0.29894 -0.602 0.54686
#> factor(city)3 -0.24595 0.29236 -0.841 0.40021
#> factor(city)4 -0.26689 0.30147 -0.885 0.37600
#> proage 0.18482 0.06292 2.937 0.00331 **
#> per 0.11016 0.02696 4.085 4.4e-05 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> (Dispersion parameter for binomial family taken to be 1)
#>
#> Null deviance: 670.82 on 865 degrees of freedom
#> Residual deviance: 646.55 on 859 degrees of freedom
#> (131 observations deleted due to missingness)
#> AIC: 660.55
#>
#> Number of Fisher Scoring iterations: 5
#>