Skip to content

Commit b88a175

Browse files
committed
v1.2
1 parent 270c79e commit b88a175

File tree

98 files changed

+23665
-3487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+23665
-3487
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: gravity
22
Type: Package
33
Title: Estimation Methods for Gravity Models
4-
Version: 1.1
4+
Version: 1.2
55
Authors@R: c(
66
person("Anna-Lena", "Woelwer",
77
role = c("aut", "cph")),
@@ -52,7 +52,7 @@ Depends: R(>= 3.4.0)
5252
License: Apache License (>= 2)
5353
Encoding: UTF-8
5454
LazyData: true
55-
RoxygenNote: 7.2.3
55+
RoxygenNote: 7.3.2
5656
Suggests: knitr,
5757
rmarkdown,
5858
testthat,

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# gravity 1.2
2+
3+
* Sets NULL as the default argument for additional regressors (#23, @MatthieuStigler)
4+
15
# gravity 1.1
26

37
* Updated maintainer's email

R/bvu.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@
8585
#' @examples
8686
#' # Example for CRAN checks:
8787
#' # Executable in < 5 sec
88-
#' library(dplyr)
88+
#'
8989
#' data("gravity_no_zeros")
9090
#'
9191
#' # Choose 5 countries for testing
9292
#' countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
93-
#' grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)
93+
#' grav_small <- subset(gravity_no_zeros, iso_o %in% countries_chosen)
9494
#'
9595
#' fit <- bvu(
9696
#' dependent_variable = "flow",
@@ -103,6 +103,7 @@
103103
#' robust = FALSE,
104104
#' data = grav_small
105105
#' )
106+
#'
106107
#' @return
107108
#' The function returns the summary of the estimated gravity model as an
108109
#' \code{\link[stats]{lm}}-object.

R/bvw.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@
8787
#' @examples
8888
#' # Example for CRAN checks:
8989
#' # Executable in < 5 sec
90-
#' library(dplyr)
90+
#'
9191
#' data("gravity_no_zeros")
9292
#'
9393
#' # Choose 5 countries for testing
9494
#' countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
95-
#' grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)
95+
#' grav_small <- subset(gravity_no_zeros, iso_o %in% countries_chosen)
9696
#'
9797
#' fit <- bvw(
9898
#' dependent_variable = "flow",
@@ -105,6 +105,7 @@
105105
#' robust = FALSE,
106106
#' data = grav_small
107107
#' )
108+
#'
108109
#' @return
109110
#' The function returns the summary of the estimated gravity model as an
110111
#' \code{\link[stats]{lm}}-object.

R/ddm.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@
8181
#' @examples
8282
#' # Example for CRAN checks:
8383
#' # Executable in < 5 sec
84-
#' library(dplyr)
84+
#'
8585
#' data("gravity_no_zeros")
8686
#'
8787
#' # Choose 5 countries for testing
8888
#' countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
89-
#' grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)
89+
#' grav_small <- subset(gravity_no_zeros, iso_o %in% countries_chosen)
9090
#'
9191
#' fit <- ddm(
9292
#' dependent_variable = "flow",
@@ -97,6 +97,7 @@
9797
#' robust = FALSE,
9898
#' data = grav_small
9999
#' )
100+
#'
100101
#' @return
101102
#' The function returns the summary of the estimated gravity model as an
102103
#' \code{\link[stats]{lm}}-object.

R/ek_tobit.R

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,16 @@
9090
#' @examples
9191
#' # Example for CRAN checks:
9292
#' # Executable in < 5 sec
93-
#' library(dplyr)
93+
#'
9494
#' data("gravity_no_zeros")
9595
#'
9696
#' # Choose 5 countries for testing
9797
#' countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
98-
#' grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)
98+
#' grav_small <- subset(gravity_no_zeros, iso_o %in% countries_chosen)
9999
#'
100-
#' grav_small <- grav_small %>%
101-
#' mutate(
102-
#' flow = ifelse(flow < 5, 0, flow), # cutoff for testing purposes
103-
#' lgdp_o = log(gdp_o),
104-
#' lgdp_d = log(gdp_d)
105-
#' )
100+
#' grav_small$flow <- ifelse(grav_small$flow < 5, 0, grav_small$flow)
101+
#' grav_small$lgdp_o <- log(grav_small$gdp_o)
102+
#' grav_small$lgdp_d <- log(grav_small$gdp_d)
106103
#'
107104
#' fit <- ek_tobit(
108105
#' dependent_variable = "flow",
@@ -112,6 +109,7 @@
112109
#' robust = FALSE,
113110
#' data = grav_small
114111
#' )
112+
#'
115113
#' @return
116114
#' The function returns the summary of the estimated gravity model as a
117115
#' \code{\link[survival]{survreg}}-object.

R/et_tobit.R

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,24 @@
103103
#' @examples
104104
#' # Example for CRAN checks:
105105
#' # Executable in < 5 sec
106-
#' library(dplyr)
106+
#'
107107
#' data("gravity_no_zeros")
108108
#'
109109
#' # Choose 5 countries for testing
110110
#' countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
111-
#' grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)
111+
#' grav_small <- subset(gravity_no_zeros, iso_o %in% countries_chosen)
112112
#'
113-
#' grav_small <- grav_small %>%
114-
#' mutate(
115-
#' flow = ifelse(flow < 5, 0, flow), # cutoff for testing purposes
116-
#' lgdp_o = log(gdp_o),
117-
#' lgdp_d = log(gdp_d)
118-
#' )
113+
#' grav_small$flow <- ifelse(grav_small$flow < 5, 0, grav_small$flow)
114+
#' grav_small$lgdp_o <- log(grav_small$gdp_o)
115+
#' grav_small$lgdp_d <- log(grav_small$gdp_d)
119116
#'
120117
#' fit <- et_tobit(
121118
#' dependent_variable = "flow",
122119
#' distance = "distw",
123120
#' additional_regressors = c("rta", "lgdp_o", "lgdp_d"),
124121
#' data = grav_small
125122
#' )
123+
#'
126124
#' @return
127125
#' The function returns the summary of the estimated gravity model as a
128126
#' \code{\link[censReg]{censReg}}-object.

R/fixed_effects.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@
112112
#' @examples
113113
#' # Example for CRAN checks:
114114
#' # Executable in < 5 sec
115-
#' library(dplyr)
115+
#'
116116
#' data("gravity_no_zeros")
117117
#'
118118
#' # Choose 5 countries for testing
119119
#' countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
120-
#' grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)
120+
#' grav_small <- subset(gravity_no_zeros, iso_o %in% countries_chosen)
121121
#'
122122
#' fit <- fixed_effects(
123123
#' dependent_variable = "flow",
@@ -128,6 +128,7 @@
128128
#' robust = FALSE,
129129
#' data = grav_small
130130
#' )
131+
#'
131132
#' @return
132133
#' The function returns the summary of the estimated gravity model as an
133134
#' \code{\link[stats]{lm}}-object.

R/gpml.R

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,23 @@
9292
#' @examples
9393
#' # Example for CRAN checks:
9494
#' # Executable in < 5 sec
95-
#' library(dplyr)
95+
#'
9696
#' data("gravity_no_zeros")
9797
#'
9898
#' # Choose 5 countries for testing
9999
#' countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
100-
#' grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)
100+
#' grav_small <- subset(gravity_no_zeros, iso_o %in% countries_chosen)
101101
#'
102-
#' grav_small <- grav_small %>%
103-
#' mutate(
104-
#' lgdp_o = log(gdp_o),
105-
#' lgdp_d = log(gdp_d)
106-
#' )
102+
#' grav_small$lgdp_o <- log(grav_small$gdp_o)
103+
#' grav_small$lgdp_d <- log(grav_small$gdp_d)
107104
#'
108105
#' fit <- gpml(
109106
#' dependent_variable = "flow",
110107
#' distance = "distw",
111108
#' additional_regressors = c("rta", "iso_o", "iso_d"),
112109
#' data = grav_small
113110
#' )
111+
#'
114112
#' @return
115113
#' The function returns the summary of the estimated gravity model similar to a
116114
#' \code{\link[stats]{glm}}-object.
@@ -122,7 +120,7 @@
122120

123121
gpml <- function(dependent_variable,
124122
distance,
125-
additional_regressors,
123+
additional_regressors = NULL,
126124
robust = FALSE,
127125
data, ...) {
128126
# Checks ------------------------------------------------------------------

R/hm_summary.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
#' @examples
2323
#' # Example for CRAN checks:
2424
#' # Executable in < 5 sec
25-
#' library(dplyr)
25+
#'
2626
#' data("gravity_no_zeros")
2727
#'
2828
#' # Choose 5 countries for testing
2929
#' countries_chosen <- c("AUS", "CHN", "GBR", "BRA", "CAN")
30-
#' grav_small <- filter(gravity_no_zeros, iso_o %in% countries_chosen)
30+
#' grav_small <- subset(gravity_no_zeros, iso_o %in% countries_chosen)
3131
#'
3232
#' # Using OLS for testing
3333
#' fit <- ols(
@@ -44,6 +44,7 @@
4444
#' )
4545
#'
4646
#' fit2 <- hm_summary(fit, robust = FALSE)
47+
#'
4748
#' @return Summary \code{lm} object.
4849
#'
4950
#' @export

0 commit comments

Comments
 (0)