Package 'panelSUR'

Title: Two-Way Error Component SUR Systems Estimation on Unbalanced Panel Data
Description: Generalized Least Squares (GLS) estimation of Seemingly Unrelated Regression (SUR) systems on unbalanced panel in the one/two-way cases also taking into account the possibility of cross equation restrictions. Methodological details can be found in Biørn (2004) <doi:10.1016/j.jeconom.2003.10.023> and Platoni, Sckokai, Moro (2012) <doi:10.1080/07474938.2011.607098>.
Authors: Laura Barbieri [aut, cre], Silvia Platoni [aut]
Maintainer: Laura Barbieri <[email protected]>
License: GPL (>= 3)
Version: 0.1.0
Built: 2025-03-05 03:02:07 UTC
Source: https://github.com/cran/panelSUR

Help Index


Compute errors' variance-covariance matrices

Description

This function aims to obtain the errors' variance-covariance matrices.

Usage

obtainSigmas(modelFrame=modelFrame,
             firstEstimate=firstEstimate,
             method=method)

Arguments

modelFrame

an object of the class prepareData,

firstEstimate

an object of the class preliminaryEstimate,

method

the estimation method to be used, one of "1wayWB", "2wayWB", or "2wayQUE".

Value

An object of class obtainSigmas, which is a list of the following elements:

Sigma_u

remainder error variance-covariance matrix,

Sigma_mu

individual error variance-covariance matrix,

Sigma_nu

time error variance-covariance matrix.


panelSUR package: EC SUR system models estimation on (unbalanced) panel data

Description

Allows to estimate one-way and two-way error component SUR systems on unbalanced panel by GLS estimator with or without cross-equation restrictions.

Details

Package: panelSUR
Type: Package
Version: 0.1.0
Date: 2024-03-03

References

Biørn E (2004). Regression Systems for Unbalanced Panel Data: a Stepwise Maximum Likelihood Procedure. Journal of Econometrics, 122(2), 181-291.

Platoni S, Barbieri L, Moro D, Sckokai P (2020). Heteroscedastic Stratified Two-way EC Models of Single Equations and SUR Systems. Econometrics and Statistics, 15, 46-66.

Platoni S, Sckokai P, Moro D, (2012a). “A Note on Two-way ECM Estimation of SUR Systems on Unbalanced Panel Data. Econometric Reviews, 31(2), 119–141.


Compute post-estimation indicators

Description

This function aims to compute some post estimation indicators.

Usage

postEstimation(modelFrame=modelFrame,
               firstEstimate=firstEstimate,
               system=system)

Arguments

modelFrame

an object of the class prepareData,

firstEstimate

an object of the class preliminaryEstimate,

system

an object of the class system.

Value

An object of class postEstimation, which is the list of R-squared obtained for each equation of the estimated system.


Obtain preliminary system equation estimates

Description

This function aims to obtain the preliminary (single within one or two way) estimate of the system equations.

Usage

preliminaryEstimate(modelFrame=modelFrame,
                    method=method)

Arguments

modelFrame

an object of the class prepareData,

method

the estimation method to be used, one of "1wayWB", "2wayWB", or "2wayQUE".

Value

An object of class preliminaryEstimate, which is a list of the following elements:

f1w

centered residuals of the oneway within estimation obtained for each single equation of the system,

f2w

centered residuals of the twoways within estimation obtained for each single equation of the system,

mi_f1w

individual means of the centered oneway within residuals,

mi_f2w

individual means of the centered twoways within residuals,

mt_f2w

time means of the centered twoways within residuals,

m_f1w

mean of the centered oneway within residuals,

reglist

list of the regressor matrix of each equation,

reglist2

list of the regressors data frame of each equation,

regnames

a vector whose elements are the names of all the variables included in each equation of the system,

final_regnames

a vector whose elements are the names of the variables considered in the system equations, taking into account only the first appearance of those affected by restrictions on the coefficients.


Prepare data for use

Description

This function prepares data that have to be used.

Usage

prepareData(data=data,
            restrictions=NULL,
            eqlist=eqlist)

Arguments

eqlist

a list containing the equations making up the SUR system. They should be object of the class "formula" and necessarly include the intercept,

restrictions

a vector containing constraints on the equation coefficients, which should be expressed in the form "equation_name$variable_name". Any spaces should be excluded from the restrictions definition. If one of the constraints includes an intercept term, the variable_name will be simply 'const'. Only simple restrictions involving equality between two parameters are considered, and not linear combinations involving more than two parameters,

data

a data frame of the class "pdata.frame" (mandatory).

Value

An object of class prepareData, which is a list of the following elements:

eqlist

list of the equations of the system,

neq

number of the system equations,

varlist

list of the system variables,

ncoeff

number of the system coefficients,

sumreg

position of the first variable of each equation, including the constant, in the ordered list of the variables of the system,

nconstr

number of contraints,

constr

a matrix with as many rows as constraints, and whose row elements indicate the position, in the sorted list of model variables, of the variables affected by each constraint,

nind

total number of individuals,

nt

total number of individuals observed in each period,

psur

table reporting the number of times each individual is observed,

psurmax

maximum number of times the individuals are observed in the panel,

tmax

number of period included in the panel,

sumTi

sum of squares of the numbers of times each individual is observed,

sumNt

sum of squares of the numbers of individuals observed in each time period,

vectorTi

vector containing the number of times each individual is observed,

sysdata

subset of the original data frame containing only the variables used in the estimated system,

infoSample

information on the sysdata dataframe obtained trougth the pdim command of the plm package.


Print summary of estimated equation system

Description

This function prints a summary of the estimated equation system.

Usage

printSUR(object)

Arguments

object

an object of class SURest.

Value

No values are returned from the printSUR function. However, when called, it generates a visual output in the console, consisting of a formatted table containing the results of the SUR estimation and other relevant information.

Examples

data("SURdata", package="panelSUR")

## Data preparation
library(plm)
datap <- pdata.frame(data, index=c("IND", "TIME"))

## Equations specification
eq1<-Y1~X1+X2
eq2<-Y2~X1+X2+X3
eqlist<-c(eq1,eq2)

## System estimation
mod1<-SURest(eqlist=eqlist,method="1wayWB",data=datap)

## Summary of estimation results
printSUR(mod1)

Simulated data for a simultaneous equation system

Description

The SURdata dataset consists of an unbalanced panel comprising 100 individuals observed across four time periods for a total of 220 observations (n=100, T=4, N=220). In order to construct this unbalanced panel, the procedure currently used for rotating panels, in which there is approximately the same number of individuals every year, has been used: a fixed percentage of individuals (20% in this case) is replaced each year, but they can re-enter the sample in the following years.

Usage

data(SURdata)

Format

A large unbalanced panel dataset

Source

Simulated data


EC SUR System Models Estimation on (Unbalanced) Panel Data

Description

SURest is used to estimate one-way and two-way SUR systems on unbalanced panel data by GLS estimator also allowing cross-equation restrictions.

Usage

SURest(data = data,
       eqlist = eqlist,
       restrictions = NULL,
       method="1wayWB")

Arguments

eqlist

a list containing the equations making up the SUR system. They should be object of the class "formula" and necessarly include the intercept,

restrictions

a vector containing constraints on the equation coefficients, which should be expressed in the form "equation_name$variable_name". Any spaces should be excluded from the restrictions definition. If one of the constraints includes an intercept term, the variable_name will be simply 'const'. Only simple restrictions involving equality between two parameters are considered, and not linear combinations involving more than two parameters,

method

the estimation method to be used, one of "1wayWB", "2wayWB", or "2wayQUE" (see details),

data

a data frame of the class "pdata.frame" (mandatory).

Details

SURest is a function for the GLS estimation of SUR system models on (unbalanced) panel data. It supports the following estimation methods: one-way error component procedure based on the Biorn (2004)’s procedure (1wayWB), two-way error component procedure based on the Biorn (2004)’s procedure (2wayWB), and the two-way QUE estimation procedure by Platoni et al. (2012) (2wayQUE).

Value

An object of class SURest, which is a list of the following elements:

Sigma_u

remainder error variance-covariance matrix,

Sigma_mu

individual error variance-covariance matrix,

Sigma_nu

time error variance-covariance matrix,

varnames

a vector whose elements are the names of the variables considered in the system equations, taking into account only the first appearance of those affected by restrictions on the coefficients,

Estimate

vector of the coefficient estimates of the system equations, taking into account only the first appearance of those affected by restrictions,

std_error

vector of the standard errors of the coefficient estimates, taking into account only the first appearance of those affected by restrictions,

tstat

vector of the t-statistics associated to the coefficient estimates, taking into account only the first appearance of those affected by restrictions,

pvalue

vector of the p-values associated to the t-statistics,

infoSample

information on the considered dataset obtained trougth the pdim command of the plm package,

neq

number of the system equations,

Rsquared

list of R-squared obtained for each equation of the estimated system,

method

method choosen for the system estimation.

References

Biorn E, (2004), Regression Systems for Unbalanced Panel Data: a Stepwise Maximum Likelihood Procedure, Journal of Econometrics, 122(2), 181–291.

Platoni S, Sckokai P, Moro D (2012), A Note on Two-way ECM Estimation of SUR Systems on Unbalanced Panel Data, Econometric Reviews, 31(2), 119–141.

Examples

data("SURdata", package="panelSUR")

## Data preparation
library(plm)
datap <- pdata.frame(data, index=c("IND", "TIME"))

## Equations specification
eq1<-Y1~X1+X2
eq2<-Y2~X1+X2+X3
eq3<-Y3~X2+X3
eqlist<-c(eq1,eq2,eq3)

## Constraints specification
constraints<-c("eq1$X2=eq2$X1","eq2$X3=eq3$X2")

## System estimation
mod1<-SURest(eqlist=eqlist,restrictions=constraints,method="2wayQUE",data=datap)

Build and solve system for beta coefficient estimates

Description

This function aims to built and solve the system in order to obtain beta coefficient estimates.

Usage

system(modelFrame=modelFrame,
       firstEstimate=firstEstimate,
       matrices=matrices)

Arguments

modelFrame

an object of the class prepareData,

firstEstimate

an object of the class preliminaryEstimate,

matrices

an object of the class obtainSigmas.

Value

An object of class system, which is a list of the following elements:

BsurQ

vector of the coefficient estimates of the system equations, taking into account only the first appearance of those affected by restrictions,

std_error

vector of the standard errors of the coefficient estimates, taking into account only the first appearance of those affected by restrictions,

t_stat

vector of the t-statistics associated to the coefficient estimates, taking into account only the first appearance of those affected by restrictions,

p_value

vector of the p-values associated to the t-statistics.