hm_summary: Head and Mayer consistent summary statistics

View source: R/hm_summary.R

hm_summaryR Documentation

Head and Mayer consistent summary statistics

Description

Summary of estimates function that, if is used with default options, provides estimation results are consistent with the Stata methods used in \insertCiteHead2014;textualgravity. This function is adapted from the work of Isidore Beautrelet.

Usage

hm_summary(model, robust = FALSE, ...)

Arguments

model

(Type: lm) Regression object obtained by using the estimation methods from this package or a generic method such as lm or glm. Some particular classes (gpml, nbpml, negbin and nls) don't return R squared and F statistic.

robust

(Type: logical) Determines whether a robust variance-covariance matrix should be used. By default is set to FALSE.

If set TRUE the estimation results are consistent with the Stata code provided at the website Gravity Equations: Workhorse, Toolkit, and Cookbook when choosing robust estimation.

...

additional arguments to be passed to tobit.

Value

Summary lm object.

Examples

# Example for CRAN checks:
# Executable in < 5 sec
library(dplyr)
data("gravity_no_zeros")

# Choose 5 countries for testing
countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)

# Using OLS for testing
fit <- ols(
  dependent_variable = "flow",
  distance = "distw",
  additional_regressors = c("rta", "contig", "comcur"),
  income_origin = "gdp_o",
  income_destination = "gdp_d",
  code_origin = "iso_o",
  code_destination = "iso_d",
  uie = FALSE,
  robust = FALSE,
  data = grav_small
)

fit2 <- hm_summary(fit, robust = FALSE)

gravity documentation built on May 2, 2023, 9:13 a.m.