S-values: conventional model ambiguity measures

Share:

Description

The function sValues performs the extreme bound analysis proposed by Leamer (2014) and discussed in Leamer (2015). For further details see the package vignette.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
sValues(..., R2_bounds = c(0.1, 0.5, 1), favorites = NULL,
  R2_favorites = NULL, scale = TRUE)

## S3 method for class 'formula'
sValues(formula, data, R2_bounds = c(0.1, 0.5, 1),
  favorites = NULL, R2_favorites = NULL, scale = TRUE, ...)

## S3 method for class 'matrix'
sValues(m, R2_bounds = c(0.1, 0.5, 1), favorites = NULL,
  R2_favorites = NULL, scale = TRUE, ...)

## S3 method for class 'data.frame'
sValues(df, R2_bounds = c(0.1, 0.5, 1),
  favorites = NULL, R2_favorites = NULL, scale = TRUE, ...)

Arguments

...

arguments passed to other methods. The first argument should be a formula followed by a data.frame; alternatively, as a shortcut, you can omit the formula and provide only a matrix or a data.frame: in that case, the function will automatically consider the first column as the dependent variable and the rest as the independent variables.

R2_bounds

a numeric vector with two or more R2 bounds to be considered in the analysis. The default values are c(0.1, 0.5, 1), proposed by Leamer (2014).

favorites

optional - a character vector that specifies the "favorite" varibles to be used in the analysis. These variables will have different lower and upper R2 bounds as defined in the R_favorites argument.

R2_favorites

optional - a numeric vector with two or more R2 bounds for the "favorite" variables.

scale

should the variables be scaled/standardized to zero mean and unit variance? The default is TRUE. If your data is already scaled/standardized you should set this to FALSE.

formula

an object of the class formula: a symbolic description of the model to be fitted.

data

needed only when you pass a formula as first parameter. An object of the class data.frame containing the variables used in the analysis.

m

an object of class matrix with the dependent variable in the first column followed by the covariates. The matrix must have column names.

df

an object of class data.frame with the dependent variable in the first column followed by the covariates.

Value

sValues returns an object a list of class "sValues" containing the main results of the analysis:

  • info: a list with the general information about the paramaters used in the analysis, such as the formula, the data, the bounds and favorite variables.

  • simple: a list with the results of the simple linear regressions for each variable.

  • all: the results of the linear regression with all variables.

  • bayes: a list with the results of the bayesian regression for each combination of the R2 bounds. Each bayesian regression includes the coefficient estimates, the variance-covariance matrix and the t-values.

  • ext_bounds: a list with the extreme bounds estimates for each combination of the R2 bounds.

  • s_values: a data.frame with the s_values for each combination of the R2 bounds.

References

Leamer, E. (2014). S-values: Conventional context-minimal measures of the sturdiness of regression coefficients. Working Paper

Leamer, E. (2015). S-values and bayesian weighted all-subsets regressions. European Economic Review.

See Also

coef.sValues to extract coefficients or statistics;

print.sValues for printing;

summary.sValues for summaries;

plot.sValues for plots.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# growth regressions example
## All variables, No favorites
data(economic_growth)
eg_sv <- sValues(GR6096 ~ ., data = economic_growth)
eg_sv # prints results
plot(eg_sv, R2_bounds = c(0.5, 1))
plot(eg_sv, type = "beta_plot", variable = "P60", error_bar = TRUE)
coefs_eg <- coef(eg_sv) # extract coefficients
coefs_eg

##  only 14 variables
eg_sv_14 <-  sValues(GR6096 ~GDPCH60L + OTHFRAC + ABSLATIT + 
                       LT100CR + BRIT + GOVNOM1 + WARTIME + 
                       SCOUT + P60 + PRIEXP70 + OIL + 
                       H60 + POP1560 + POP6560, data = economic_growth)
eg_sv_14
coefs_eg_14 <- coef(eg_sv_14)

## With 14 favorites among all variables
favorites <- c("GDPCH60L", "OTHFRAC", "ABSLATIT", "LT100CR", 
              "BRIT", "GOVNOM1", "WARTIME", "SCOUT", 
              "P60", "PRIEXP70", "OIL", "H60", 
              "POP1560", "POP6560")
eg_sv_fav <- sValues(GR6096 ~ ., data = economic_growth, R2_bounds = c(0.5, 1),
                    favorites = favorites, R2_favorites = c(0.4, 0.8))
eg_sv_fav
plot(eg_sv_fav, R2_bounds = c(0.5, 1))
plot(eg_sv_fav, type = "beta_plot", variable = "P60", error_bar = TRUE)
coefs_eg_fav <- coef(eg_sv_fav)
coefs_eg_fav