Learn R Programming

netdiffuseR (version 1.22.6)

diffreg: Diffusion regression model

Description

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.

Usage

diffreg(model, type = c("logit", "probit"))

Value

An object of class glm.

Arguments

model

An object of class formula where the right-hand-side is an object of class diffnet

type

Character scalar. Either "probit" or "logit".

Lagged regression

The model estimated is a lagged regression model that has two main assumptions:

  1. The network is exogenous to the behavior (no selection effect)

  2. 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.

Details

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:

  1. Compute exposure by calling exposure on the LHS (dependent variable).

  2. Modify the formula so that the model is on adoption as a function of exposure and whatever covariates the user specifies.

  3. 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.

  4. Estimates the model.

The data passed to glm is obtained by using as.data.frame.diffnet.

Examples

Run this code
data("medInnovationsDiffNet")

# Default model
ans <- diffreg(
  medInnovationsDiffNet ~ exposure + factor(city) + proage + per)
summary(ans)

Run the code above in your browser using DataLab