Package 'panelhetero'

Title: Panel Data Analysis with Heterogeneous Dynamics
Description: Understanding the dynamics of potentially heterogeneous variables is important in statistical applications. This package provides tools for estimating the degree of heterogeneity across cross-sectional units in the panel data analysis. The methods are developed by Okui and Yanagi (2019) <doi:10.1016/j.jeconom.2019.04.036> and Okui and Yanagi (2020) <doi:10.1093/ectj/utz019>.
Authors: Ryo Okui [aut, cph], Takahide Yanagi [aut, cre, cph] , Heejun Lee [aut, cph]
Maintainer: Takahide Yanagi <[email protected]>
License: MIT + file LICENSE
Version: 1.0.1
Built: 2025-02-18 04:57:10 UTC
Source: https://github.com/tkhdyanagi/panelhetero

Help Index


The HPJ bias-corrected empirical CDF estimation

Description

The 'hpjecdf()' function enables to implement the HPJ bias-corrected estimation of the cumulative distribution function (CDF) of the heterogeneous mean, the heterogeneous autocovariance, and the heterogeneous autocorrelation. The method is developed by Okui and Yanagi (2019). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

hpjecdf(data, acov_order = 0, acor_order = 1, R = 1000, ci = TRUE)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation. Default is 1.

R

A positive integer of the number of bootstrap repetitions. Default is 1000.

ci

A logical whether to estimate the confidence interval. Default is TRUE.

Value

A list that contains the following elements.

mean

A plot of the corresponding CDF

acov

A plot of the corresponding CDF

acor

A plot of the corresponding CDF

mean_func

A function that returns the corresponding CDF

acov_func

A function that returns the corresponding CDF

acor_func

A function that returns the corresponding CDF

mean_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

acov_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

acor_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocorrelation

N

The number of cross-sectional units

S

The length of time series

R

The number of bootstrap repetitions

References

Okui, R. and Yanagi, T., 2019. Panel data analysis with heterogeneous dynamics. Journal of Econometrics, 212(2), pp.451-475.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::hpjecdf(data = data, R = 50)

The HPJ bias-corrected kernel density estimation

Description

The 'hpjkd()' function enables to implement the HPJ bias-corrected kernel density estimation for the heterogeneous mean, the autocovariance, and the autocorrelation. The method is developed by Okui and Yanagi (2020). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

hpjkd(
  data,
  acov_order = 0,
  acor_order = 1,
  mean_bw = NULL,
  acov_bw = NULL,
  acor_bw = NULL
)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation. Default is 1.

mean_bw

A scalar of bandwidth used for the estimation of the denisty of mean. Default is NULL, and the plug-in bandwidth is used.

acov_bw

A scalar of bandwidth used for the estimation of the denisty of autocovariance. Default is NULL, and the plug-in bandwidth is used.

acor_bw

A scalar of bandwidth used for the estimation of the denisty of autocorrelation. Default is NULL, and the plug-in bandwidth is used.

Value

A list that contains the following elements:

mean

A plot of the corresponding density

acov

A plot of the corresponding density

acor

A plot of the corresponding density

mean_func

A function that returns the corresponding density

acov_func

A function that returns the corresponding density

acor_func

A function that returns the corresponding density

bandwidth

A Vector of the bandwidths

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocorrelation

N

The number of cross-sectional units

S

The length of time series

References

Okui, R. and Yanagi, T., 2020. Kernel estimation for panel data with heterogeneous dynamics. The Econometrics Journal, 23(1), pp.156-175.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::hpjkd(data = data)

The HPJ bias-corrected estimation of the moments

Description

The 'hpjmoment()' function enables to implement the HPJ bias-corrected estimation of the moments of the heterogeneous mean, the heterogeneous autocovariance, and the heterogeneous autocorrelation. The method is developed by Okui and Yanagi (2019). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

hpjmoment(data, acov_order = 0, acor_order = 1, R = 1000)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation Default is 1.

R

A positive integer of the number of bootstrap repetitions. Default is 1000.

Value

A list that contains the following elements.

estimate

A vector of the parameter estimates

se

A vector of the standard errors

ci

A matrix of the 95 percent confidence intervals

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocovariance

N

The number of cross-sectional units

S

The length of time series

R

The number of bootstrap repetitions

References

Okui, R. and Yanagi, T., 2019. Panel data analysis with heterogeneous dynamics. Journal of Econometrics, 212(2), pp.451-475.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::hpjmoment(data = data)

The naive empirical CDF estimation without bias correction

Description

The 'neecdf()' function enables to implement the naive estimation of the cumulative distribution function (CDF) of the heterogeneous mean, the heterogeneous autocovariance, and the heterogeneous autocorrelation. The method is developed by Okui and Yanagi (2019). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

neecdf(data, acov_order = 0, acor_order = 1, R = 1000, ci = TRUE)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation. Default is 1.

R

A positive integer of the number of bootstrap repetitions. Default is 1000.

ci

A logical whether to estimate the confidence interval. Default is TRUE.

Value

A list that contains the following elements.

mean

A plot of the corresponding CDF

acov

A plot of the corresponding CDF

acor

A plot of the corresponding CDF

mean_func

A function that returns the corresponding CDF

acov_func

A function that returns the corresponding CDF

acor_func

A function that returns the corresponding CDF

mean_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

acov_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

acor_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocorrelation

N

The number of cross-sectional units

S

The length of time series

R

The number of bootstrap repetitions

References

Okui, R. and Yanagi, T., 2019. Panel data analysis with heterogeneous dynamics. Journal of Econometrics, 212(2), pp.451-475.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::neecdf(data = data, R = 50)

The naive kernel density estimation

Description

The 'nekd()' function enables to implement the naive kernel density estimation without bias correction for the heterogeneous mean, the autocovariance, and the autocorrelation. The method is developed by Okui and Yanagi (2020). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

nekd(
  data,
  acov_order = 0,
  acor_order = 1,
  mean_bw = NULL,
  acov_bw = NULL,
  acor_bw = NULL
)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation. Default is 1.

mean_bw

A scalar of bandwidth used for the estimation of the denisty of mean. Default is NULL, and the plug-in bandwidth is used.

acov_bw

A scalar of bandwidth used for the estimation of the denisty of autocovariance. Default is NULL, and the plug-in bandwidth is used.

acor_bw

A scalar of bandwidth used for the estimation of the denisty of autocorrelation. Default is NULL, and the plug-in bandwidth is used.

Value

A list that contains the following elements:

mean

A plot of the corresponding density

acov

A plot of the corresponding density

acor

A plot of the corresponding density

mean_func

A function that returns the corresponding density

acov_func

A function that returns the corresponding density

acor_func

A function that returns the corresponding density

bandwidth

A Vector of the bandwidths

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocorrelation

N

The number of cross-sectional units

S

The length of time series

References

Okui, R. and Yanagi, T., 2020. Kernel estimation for panel data with heterogeneous dynamics. The Econometrics Journal, 23(1), pp.156-175.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::nekd(data = data)

The naive estimation of the moments

Description

The 'nemoment()' function enables to implement the naive estimation of the moments of the heterogeneous mean, the heterogeneous autocovariance, and the heterogeneous autocorrelation. The method is developed by Okui and Yanagi (2019). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

nemoment(data, acov_order = 0, acor_order = 1, R = 1000)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation Default is 1.

R

A positive integer of the number of bootstrap repetitions. Default is 1000.

Value

A list that contains the following elements.

estimate

A vector of the parameter estimates

se

A vector of the standard errors

ci

A matrix of the 95 percent confidence intervals

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocovariance

N

The number of cross-sectional units

S

The length of time series

R

The number of bootstrap repetitions

References

Okui, R. and Yanagi, T., 2019. Panel data analysis with heterogeneous dynamics. Journal of Econometrics, 212(2), pp.451-475.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::nemoment(data = data)

Generate artificial data

Description

The 'simulation()' function enables to generate artificial data from an AR(1) model with random coefficients. The function is used in the package vignette.

Usage

simulation(N, S)

Arguments

N

The number of cross-sectional units

S

The length of time series

Value

An N times S matrix of panel data

Examples

panelhetero::simulation(N = 300, S = 50)

The TOJ bias-corrected empirical CDF estimation

Description

The 'tojecdf()' function enables to implement the TOJ bias-corrected estimation of the cumulative distribution function (CDF) of the heterogeneous mean, the heterogeneous autocovariance, and the heterogeneous autocorrelation. The method is developed by Okui and Yanagi (2019). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

tojecdf(data, acov_order = 0, acor_order = 1, R = 1000, ci = TRUE)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation. Default is 1.

R

A positive integer of the number of bootstrap repetitions. Default is 1000.

ci

A logical whether to estimate the confidence interval. Default is TRUE.

Value

A list that contains the following elements.

mean

A plot of the corresponding CDF

acov

A plot of the corresponding CDF

acor

A plot of the corresponding CDF

mean_func

A function that returns the corresponding CDF

acov_func

A function that returns the corresponding CDF

acor_func

A function that returns the corresponding CDF

mean_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

acov_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

acor_ci_func

A function that returns the 95 percent confidence interval for the corresponding CDF

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocorrelation

N

The number of cross-sectional units

S

The length of time series

R

The number of bootstrap repetitions

References

Okui, R. and Yanagi, T., 2019. Panel data analysis with heterogeneous dynamics. Journal of Econometrics, 212(2), pp.451-475.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::tojecdf(data = data, R = 50)

The TOJ bias-corrected kernel density estimation

Description

The 'tojkd()' function enables to implement the TOJ bias-corrected kernel density estimation for the heterogeneous mean, the autocovariance, and the autocorrelation. The method is developed by Okui and Yanagi (2020). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

tojkd(
  data,
  acov_order = 0,
  acor_order = 1,
  mean_bw = NULL,
  acov_bw = NULL,
  acor_bw = NULL
)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation. Default is 1.

mean_bw

A scalar of bandwidth used for the estimation of the denisty of mean. Default is NULL, and the plug-in bandwidth is used.

acov_bw

A scalar of bandwidth used for the estimation of the denisty of autocovariance. Default is NULL, and the plug-in bandwidth is used.

acor_bw

A scalar of bandwidth used for the estimation of the denisty of autocorrelation. Default is NULL, and the plug-in bandwidth is used.

Value

A list that contains the following elements:

mean

A plot of the corresponding density

acov

A plot of the corresponding density

acor

A plot of the corresponding density

mean_func

A function that returns the corresponding density

acov_func

A function that returns the corresponding density

acor_func

A function that returns the corresponding density

bandwidth

A Vector of the bandwidths

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocorrelation

N

The number of cross-sectional units

S

The length of time series

References

Okui, R. and Yanagi, T., 2020. Kernel estimation for panel data with heterogeneous dynamics. The Econometrics Journal, 23(1), pp.156-175.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::tojkd(data = data)

The TOJ bias-corrected estimation of the moments

Description

The 'tojmoment()' function enables to implement the TOJ bias-corrected estimation of the moments of the heterogeneous mean, the heterogeneous autocovariance, and the heterogeneous autocorrelation. The method is developed by Okui and Yanagi (2019). For more details, see the package vignette with 'vignette("panelhetero")'.

Usage

tojmoment(data, acov_order = 0, acor_order = 1, R = 1000)

Arguments

data

A matrix of panel data. Each row corresponds to individual time series.

acov_order

A non-negative integer of the order of autocovariance. Default is 0.

acor_order

A positive integer of the order of autocorrelation Default is 1.

R

A positive integer of the number of bootstrap repetitions. Default is 1000.

Value

A list that contains the following elements.

estimate

A vector of the parameter estimates

se

A vector of the standard errors

ci

A matrix of the 95 percent confidence intervals

quantity

A matrix of the estimated heterogeneous quantities

acov_order

The order of autocovariance

acor_order

The order of autocovariance

N

The number of cross-sectional units

S

The length of time series

R

The number of bootstrap repetitions

References

Okui, R. and Yanagi, T., 2019. Panel data analysis with heterogeneous dynamics. Journal of Econometrics, 212(2), pp.451-475.

Examples

data <- panelhetero::simulation(N = 300, S = 50)
panelhetero::tojmoment(data = data)