MyNixOS website logo
Description

Value-Price Analysis with Bayesian and Panel Data Methods.

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) <doi:10.17605/OSF.IO/7J8KF> and standard econometric techniques for panel data analysis.

valueprhr

Value-Price Analysis with Bayesian and Panel Data Methods

Overview

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.

Installation

You can install the development version from GitHub:

# install.packages("devtools")
devtools::install_github("isadorenabi/valueprhr")

Main Functions

Data Preparation

  • prepare_panel_data(): Convert wide-format price matrices to panel data
  • prepare_log_matrices(): Extract and log-transform price matrices
  • create_mundlak_data(): Add Mundlak transformations to panel data

Model Fitting

  • fit_bayesian_glm_sectors(): Fit Bayesian GLM for each sector
  • fit_twoway_fe(): Fit two-way fixed effects panel model
  • fit_mundlak_cre(): Fit Mundlak correlated random effects model
  • fit_bayesian_hierarchical(): Fit Bayesian mixed effects model
  • fit_pls_multivariate(): Fit PLS regression with CV selection

Multivariate Analysis

  • run_sparse_cca(): Run sparse CCA with PCA preprocessing
  • fit_panel_var(): Fit panel VAR model
  • fit_aggregated_var(): Fit VAR on aggregated time series
  • panel_granger_test(): Panel Granger causality tests

Validation

  • rolling_window_cv(): Rolling window cross-validation
  • leave_one_sector_out(): LOSO cross-validation
  • summarize_cv_results(): Summarize CV results

Structural Break Tests

  • test_structural_breaks(): Test for structural breaks
  • format_break_results(): Format break test results
  • interpret_break_tests(): Interpret break test results

Summary and Comparison

  • compare_models(): Generate model comparison table
  • generate_analysis_summary(): Create comprehensive summary
  • run_full_analysis(): Run complete analysis pipeline

Example

library(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)

Dependencies

Required (Imports)

  • stats
  • utils
  • Metrics

Optional (Suggests)

  • rstanarm: For Bayesian models
  • loo: For LOO-CV
  • plm: For panel data models
  • pls: For PLS regression
  • vars: For VAR models
  • panelvar: For panel VAR
  • strucchange: For structural break tests
  • lmtest, sandwich: For robust standard errors

Author

Jose Mauricio Gomez Julian ([email protected])

ORCID: 0009-0000-2412-3150

License

MIT.

Metadata

Version

0.1.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows