Provides tools for analyzing the relationship between direct
prices (based on labor values) and prices of production using Bayesian
generalized linear models, panel data methods, partial least squares
regression, canonical correlation analysis, and panel vector
autoregression. Includes functions for model comparison, out-of-sample
validation, and structural break detection. Here, methods use raw accounting data with explicit temporal structure, following Gomez Julian (2023)
Value-Price Analysis with Bayesian and Panel Data Methods
This package provides tools for analyzing the relationship between direct prices (based on labor values) and prices of production using Bayesian generalized linear models, panel data methods, partial least squares regression, canonical correlation analysis, and panel vector autoregression.
You can install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("isadorenabi/valueprhr")
prepare_panel_data(): Convert wide-format price matrices to panel dataprepare_log_matrices(): Extract and log-transform price matricescreate_mundlak_data(): Add Mundlak transformations to panel datafit_bayesian_glm_sectors(): Fit Bayesian GLM for each sectorfit_twoway_fe(): Fit two-way fixed effects panel modelfit_mundlak_cre(): Fit Mundlak correlated random effects modelfit_bayesian_hierarchical(): Fit Bayesian mixed effects modelfit_pls_multivariate(): Fit PLS regression with CV selectionrun_sparse_cca(): Run sparse CCA with PCA preprocessingfit_panel_var(): Fit panel VAR modelfit_aggregated_var(): Fit VAR on aggregated time seriespanel_granger_test(): Panel Granger causality testsrolling_window_cv(): Rolling window cross-validationleave_one_sector_out(): LOSO cross-validationsummarize_cv_results(): Summarize CV resultstest_structural_breaks(): Test for structural breaksformat_break_results(): Format break test resultsinterpret_break_tests(): Interpret break test resultscompare_models(): Generate model comparison tablegenerate_analysis_summary(): Create comprehensive summaryrun_full_analysis(): Run complete analysis pipelinelibrary(valueprhr)
# Create 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]] <- 102 + cumsum(rnorm(20, 2, 1))
}
# Run full analysis
results <- run_full_analysis(
direct, production,
run_bayesian = FALSE,
run_cv = TRUE,
run_breaks = TRUE
)
# View comparison table
print(results$comparison)
Jose Mauricio Gomez Julian ([email protected])
ORCID: 0009-0000-2412-3150
MIT