The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Introduction to valueprhr

Overview

The valueprhr package provides tools for analyzing the relationship between direct prices (based on labor values) and prices of production. This vignette demonstrates the main functionality of the package.

Getting Started

library(valueprhr)

Creating Example Data

set.seed(123)
years <- 2000:2019
sectors <- LETTERS[1:5]

direct <- data.frame(Year = years)
production <- data.frame(Year = years)

for (s in sectors) {
  direct[[s]] <- 100 + cumsum(rnorm(20, 2, 1))
  production[[s]] <- direct[[s]] * 1.02 + rnorm(20, 0, 2)
}

Preparing Panel Data

panel <- prepare_panel_data(direct, production)
head(panel)
#>   year sector direct_price production_price log_direct log_production sector_id
#> 1 2000      A     101.4395         101.3327   4.619463       4.618409         1
#> 2 2001      A     103.2093         104.8376   4.636759       4.652412         1
#> 3 2002      A     106.7681         106.8514   4.670659       4.671439         1
#> 4 2003      A     108.8386         109.5576   4.689866       4.696450         1
#> 5 2004      A     110.9679         111.9371   4.709241       4.717937         1
#> 6 2005      A     114.6829         113.6032   4.742171       4.732712         1
#>   time
#> 1    1
#> 2    2
#> 3    3
#> 4    4
#> 5    5
#> 6    6

Fitting Models

Two-Way Fixed Effects

if (requireNamespace("plm", quietly = TRUE)) {
  twoway_result <- fit_twoway_fe(panel)
  print(twoway_result$r2_within)
}

Mundlak CRE Model

if (requireNamespace("plm", quietly = TRUE)) {
  mundlak_result <- fit_mundlak_cre(panel)
  print(mundlak_result$variance_components)
}

Model Comparison

comparison <- compare_models(
  twoway_result = twoway_result,
  mundlak_result = mundlak_result
)
print(comparison)

Cross-Validation

cv_results <- rolling_window_cv(panel, window_sizes = c(10, 15))
cv_summary <- summarize_cv_results(cv_results)
print(cv_summary)

Structural Break Tests

if (requireNamespace("strucchange", quietly = TRUE)) {
  break_tests <- test_structural_breaks(panel)
  print(format_break_results(break_tests))
}

Full Analysis Pipeline

For convenience, you can run the complete analysis with a single function:

results <- run_full_analysis(
  direct, production,
  run_bayesian = FALSE,
  run_cv = TRUE,
  run_breaks = TRUE
)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.