diffreg | R Documentation |

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"))
```

`model` |
An object of class formula where the right-hand-side is an object of
class |

`type` |
Character scalar. Either |

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:subset = ifelse(is.na(toa), TRUE, toa >= per)

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`

.

An object of class `glm`

.

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)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.