Hi RStudio Community!
I am trying to run a panel VAR in R using a monthly data. I usually don't have any issue with the code if it is a yearly data. But whenever I run the code, I will get the "Error in xtfrm.data.frame(x) : cannot xtfrm data frames".
This is the code I use when I'm running a yearly data.
varone <-pvargmm(
dependent_vars = c("SP", "IDV"),
lags = 1,
transformation = "fod",
data = Olu,
panel_identifier = c("Bank", "Year"),
steps = c("twostep"),
system_instruments = FALSE, # System GMM estimator
max_instr_dependent_vars = 99,
min_instr_dependent_vars = 2L,
collapse = FALSE
)
summary(varone)
#Some Diagnostics
Andrews_Lu_MMSC(varone)
stab_varone <- stability(varone)
print(stab_varone)
plot(stab_varone)
#Generating IRFs
varone_oirf <- oirf(varone, n.ahead = 4)
varone_girf <- girf(varone, n.ahead = 4, ma_approx_steps = 4)
varone_bs <- bootstrap_irf(varone, typeof_irf = c("GIRF"), n.ahead = 4, nof_Nstar_draws = 10, confidence.band = 0.95)
plot(varone_girf, varone_bs)```
Here's my monthly data format >>
```Date Firm SP IDV
17/5/2008 1 41.55 78.1671764
17/6/2008 1 41.55 88.71156551
17/7/2008 1 41.55 94.62386639
17/8/2008 1 41.55 90.25628369
17/9/2008 1 41.55 167.8154374
17/10/2008 1 41.55 206.0425319
17/11/2008 1 41.55 143.4637941
17/12/2008 1 41.55 145.8841294
17/1/2009 1 40.56 146.2989599
17/2/2009 1 40.56 147.8324335
17/3/2009 1 40.56 132.3191329
17/4/2009 1 40.56 103.6057804
17/5/2009 1 40.56 103.6464375
17/6/2009 1 40.56 109.9066284
17/7/2009 1 40.56 101.2797006
17/8/2009 1 40.56 98.25295428
17/9/2009 1 40.56 99.4154606
17/10/2009 1 40.56 86.35406984
17/11/2009 1 40.56 99.45631204
17/12/2009 1 40.56 98.41018199
17/1/2010 1 36.17 113.0533892
17/2/2010 1 36.17 111.374998
17/3/2010 1 36.17 107.5623321
17/4/2010 1 36.17 103.8260152
17/5/2010 1 36.17 146.9229145
17/6/2010 1 36.17 134.131418
17/7/2010 1 36.17 141.9443299
17/8/2010 1 36.17 121.069976
17/9/2010 1 36.17 132.6676209
17/10/2010 1 36.17 122.8472654
17/11/2010 1 36.17 127.5586595
17/12/2010 1 36.17 130.4620766
17/1/2011 1 32.73 110.5378187
17/2/2011 1 32.73 93.99837031
17/3/2011 1 32.73 127.251416
17/4/2011 1 32.73 115.8967363
17/5/2011 1 32.73 89.15496195
17/6/2011 1 32.73 117.6272763
17/7/2011 1 32.73 156.7766995
17/8/2011 1 32.73 215.0422942
17/9/2011 1 32.73 190.5246478
17/10/2011 1 32.73 166.4254173
17/11/2011 1 32.73 198.1231932
17/12/2011 1 32.73 182.7998454
17/1/2012 1 31.48 161.9961291
17/2/2012 1 31.48 142.6191284
17/3/2012 1 31.48 134.6995838
17/4/2012 1 31.48 127.5277319
17/5/2012 1 31.48 160.4464483
17/6/2012 1 31.48 189.4425436
17/7/2012 1 31.48 160.2275403
17/8/2012 1 31.48 123.0971093
17/9/2012 1 31.48 152.0809791
17/10/2012 1 31.48 159.5541814
17/11/2012 1 31.48 173.7342532
17/12/2012 1 31.48 168.511748
17/1/2013 1 31.31 167.8918869
17/2/2013 1 31.31 125.5674663
17/3/2013 1 31.31 141.5396622
17/4/2013 1 31.31 133.6297578
17/5/2013 1 31.31 106.2872956
17/6/2013 1 31.31 119.5215531
17/7/2013 1 31.31 108.3500438
17/8/2013 1 31.31 118.5749171
17/9/2013 1 31.31 132.7210016
17/10/2013 1 31.31 158.6930179
17/11/2013 1 31.31 96.36528748
17/12/2013 1 31.31 119.3385261
17/1/2014 1 30.47 111.0462013
17/2/2014 1 30.47 98.21535362
17/3/2014 1 30.47 113.5682659
17/4/2014 1 30.47 101.6973428
17/5/2014 1 30.47 104.1855346
17/6/2014 1 30.47 86.67951839
17/7/2014 1 30.47 93.17936195
17/8/2014 1 30.47 99.6378978
17/9/2014 1 30.47 123.5690457
17/10/2014 1 30.47 119.2752895
17/11/2014 1 30.47 114.062693
17/12/2014 1 30.47 111.5614839
17/1/2015 1 32.18 136.2074457
17/2/2015 1 32.18 113.0624447
17/3/2015 1 32.18 103.9277457
17/4/2015 1 32.18 102.1256079
17/5/2015 1 32.18 106.3849656
17/6/2015 1 32.18 117.341851
17/7/2015 1 32.18 128.4748616
17/8/2015 1 32.18 131.1165349
17/9/2015 1 32.18 174.3628331
17/10/2015 1 32.18 125.1895271
17/11/2015 1 32.18 101.8232681
17/12/2015 1 32.18 113.0718169
17/1/2016 1 34.85 149.5762644
17/2/2016 1 34.85 155.8688966
17/3/2016 1 34.85 166.2577496
17/4/2016 1 34.85 144.6225879
17/5/2016 1 34.85 132.8261068
17/6/2016 1 34.85 243.3254
17/7/2016 1 34.85 236.1954322
17/8/2016 1 34.85 143.8483186
17/9/2016 1 34.85 149.0530404
17/10/2016 1 34.85 134.166564
17/11/2016 1 34.85 251.402222
17/12/2016 1 34.85 222.4529313
17/1/2017 1 33.19 265.8841234
17/2/2017 1 33.19 202.1854423
17/3/2017 1 33.19 235.4675576
17/4/2017 1 33.19 181.3023623
17/5/2017 1 33.19 165.9753869
17/6/2017 1 33.19 169.6574743
17/7/2017 1 33.19 149.1325767
17/8/2017 1 33.19 141.123693
17/9/2017 1 33.19 157.4284091
17/10/2017 1 33.19 150.614683
17/11/2017 1 33.19 155.8565075
17/12/2017 1 33.19 149.5420948
17/1/2018 1 31.37 151.6560698
17/2/2018 1 31.37 124.8380554
17/3/2018 1 31.37 168.4881679
17/4/2018 1 31.37 157.7025835
17/5/2018 1 31.37 175.9046381
17/6/2018 1 31.37 178.3403237
17/7/2018 1 31.37 223.6561374
17/8/2018 1 31.37 180.0526114
17/9/2018 1 31.37 195.988825
17/10/2018 1 31.37 221.7969141
17/11/2018 1 31.37 247.3147665
17/12/2018 1 31.37 270.8802303
17/1/2019 1 33.77 263.3453307
17/2/2019 1 33.77 205.6982687
17/3/2019 1 33.77 250.9757905
17/4/2019 1 33.77 191.5888773
17/5/2019 1 33.77 241.4707898
17/6/2019 1 33.77 316.5279056
17/7/2019 1 33.77 262.0162952
17/8/2019 1 33.77 317.8178408
17/9/2019 1 33.77 273.8698727
17/10/2019 1 33.77 258.4812378
17/11/2019 1 33.77 253.4914123
17/12/2019 1 33.77 266.1575394
17/1/2020 1 45.59 228.0170478
17/2/2020 1 45.59 230.5792029
17/3/2020 1 45.59 356.976704
17/4/2020 1 45.59 359.027983
17/5/2020 1 45.59 431.6293151
17/6/2020 1 45.59 328.6724979
17/7/2020 1 45.59 352.1057149
17/8/2020 1 45.59 301.6853032
17/9/2020 1 45.59 290.0191396
17/10/2020 1 45.59 307.8081476
17/11/2020 1 45.59 368.4571564
17/12/2020 1 45.59 295.6825498
17/1/2021 1 43.73 280.6170065
17/2/2021 1 43.73 215.4135632
17/3/2021 1 43.73 215.2704288
17/4/2021 1 43.73 199.4371476
17/5/2021 1 43.73 190.319996
17/6/2021 1 43.73 178.801245
17/7/2021 1 43.73 205.5256264
17/8/2021 1 43.73 216.4920911
17/9/2021 1 43.73 205.3888224
17/10/2021 1 43.73 195.2901747
17/11/2021 1 43.73 228.0767047
17/12/2021 1 43.73 266.1702001
17/1/2022 1 44.13 232.0608158
17/2/2022 1 44.13 191.9002698
17/3/2022 1 44.13 330.0518633
17/4/2022 1 44.13 303.0238944
17/5/2022 1 44.13 291.2759018
17/6/2022 1 44.13 275.2200013
17/7/2022 1 44.13 317.1823114
17/8/2022 1 44.13 257.1827253
17/9/2022 1 44.13 281.92513
17/10/2022 1 44.13 301.3202716
17/11/2022 1 44.13 332.5035624
17/12/2022 1 44.13 263.563725
17/1/2023 1 45.13 247.3790651
17/2/2023 1 45.13 243.441932
17/3/2023 1 45.13 310.6251426
17/4/2023 1 45.13 231.7783697
17/5/2023 1 45.13 228.3557885
17/5/2008 2 41.55 78.1671764
17/6/2008 2 41.55 88.71156551
17/7/2008 2 41.55 94.62386639
17/8/2008 2 41.55 90.25628369
17/9/2008 2 41.55 167.8154374
17/10/2008 2 41.55 206.0425319
17/11/2008 2 41.55 143.4637941
17/12/2008 2 41.55 145.8841294
17/1/2009 2 40.56 146.2989599
17/2/2009 2 40.56 147.8324335
17/3/2009 2 40.56 132.3191329
17/4/2009 2 40.56 103.6057804
17/5/2009 2 40.56 103.6464375
17/6/2009 2 40.56 109.9066284
17/7/2009 2 40.56 101.2797006
17/8/2009 2 40.56 98.25295428
17/9/2009 2 40.56 99.4154606
17/10/2009 2 40.56 86.35406984
17/11/2009 2 40.56 99.45631204
17/12/2009 2 40.56 98.41018199
17/1/2010 2 36.17 113.0533892
17/2/2010 2 36.17 111.374998
17/3/2010 2 36.17 107.5623321
17/4/2010 2 36.17 103.8260152
17/5/2010 2 36.17 146.9229145
17/6/2010 2 36.17 134.131418
17/7/2010 2 36.17 141.9443299
17/8/2010 2 36.17 121.069976
17/9/2010 2 36.17 132.6676209
17/10/2010 2 36.17 122.8472654
17/11/2010 2 36.17 127.5586595
17/12/2010 2 36.17 130.4620766
17/1/2011 2 32.73 110.5378187
17/2/2011 2 32.73 93.99837031
17/3/2011 2 32.73 127.251416
17/4/2011 2 32.73 115.8967363
17/5/2011 2 32.73 89.15496195
17/6/2011 2 32.73 117.6272763
17/7/2011 2 32.73 156.7766995
17/8/2011 2 32.73 215.0422942
17/9/2011 2 32.73 190.5246478
17/10/2011 2 32.73 166.4254173
17/11/2011 2 32.73 198.1231932
17/12/2011 2 32.73 182.7998454
17/1/2012 2 31.48 161.9961291
17/2/2012 2 31.48 142.6191284
17/3/2012 2 31.48 134.6995838
17/4/2012 2 31.48 127.5277319
17/5/2012 2 31.48 160.4464483
17/6/2012 2 31.48 189.4425436
17/7/2012 2 31.48 160.2275403
17/8/2012 2 31.48 123.0971093
17/9/2012 2 31.48 152.0809791
17/10/2012 2 31.48 159.5541814
17/11/2012 2 31.48 173.7342532
17/12/2012 2 31.48 168.511748
17/1/2013 2 31.31 167.8918869
17/2/2013 2 31.31 125.5674663
17/3/2013 2 31.31 141.5396622
17/4/2013 2 31.31 133.6297578
17/5/2013 2 31.31 106.2872956
17/6/2013 2 31.31 119.5215531
17/7/2013 2 31.31 108.3500438
17/8/2013 2 31.31 118.5749171
17/9/2013 2 31.31 132.7210016
17/10/2013 2 31.31 158.6930179
17/11/2013 2 31.31 96.36528748
17/12/2013 2 31.31 119.3385261
17/1/2014 2 30.47 111.0462013
17/2/2014 2 30.47 98.21535362
17/3/2014 2 30.47 113.5682659
17/4/2014 2 30.47 101.6973428
17/5/2014 2 30.47 104.1855346
17/6/2014 2 30.47 86.67951839
17/7/2014 2 30.47 93.17936195
17/8/2014 2 30.47 99.6378978
17/9/2014 2 30.47 123.5690457
17/10/2014 2 30.47 119.2752895
17/11/2014 2 30.47 114.062693
17/12/2014 2 30.47 111.5614839
17/1/2015 2 32.18 136.2074457
17/2/2015 2 32.18 113.0624447
17/3/2015 2 32.18 103.9277457
17/4/2015 2 32.18 102.1256079
17/5/2015 2 32.18 106.3849656
17/6/2015 2 32.18 117.341851
17/7/2015 2 32.18 128.4748616
17/8/2015 2 32.18 131.1165349
17/9/2015 2 32.18 174.3628331
17/10/2015 2 32.18 125.1895271
17/11/2015 2 32.18 101.8232681
17/12/2015 2 32.18 113.0718169
17/1/2016 2 34.85 149.5762644
17/2/2016 2 34.85 155.8688966
17/3/2016 2 34.85 166.2577496
17/4/2016 2 34.85 144.6225879
17/5/2016 2 34.85 132.8261068
17/6/2016 2 34.85 243.3254
17/7/2016 2 34.85 236.1954322
17/8/2016 2 34.85 143.8483186
17/9/2016 2 34.85 149.0530404
17/10/2016 2 34.85 134.166564
17/11/2016 2 34.85 251.402222
17/12/2016 2 34.85 222.4529313
17/1/2017 2 33.19 265.8841234
17/2/2017 2 33.19 202.1854423
17/3/2017 2 33.19 235.4675576
17/4/2017 2 33.19 181.3023623
17/5/2017 2 33.19 165.9753869
17/6/2017 2 33.19 169.6574743
17/7/2017 2 33.19 149.1325767
17/8/2017 2 33.19 141.123693
17/9/2017 2 33.19 157.4284091
17/10/2017 2 33.19 150.614683
17/11/2017 2 33.19 155.8565075
17/12/2017 2 33.19 149.5420948
17/1/2018 2 31.37 151.6560698
17/2/2018 2 31.37 124.8380554
17/3/2018 2 31.37 168.4881679
17/4/2018 2 31.37 157.7025835
17/5/2018 2 31.37 175.9046381
17/6/2018 2 31.37 178.3403237
17/7/2018 2 31.37 223.6561374
17/8/2018 2 31.37 180.0526114
17/9/2018 2 31.37 195.988825
17/10/2018 2 31.37 221.7969141
17/11/2018 2 31.37 247.3147665
17/12/2018 2 31.37 270.8802303
17/1/2019 2 33.77 263.3453307
17/2/2019 2 33.77 205.6982687
17/3/2019 2 33.77 250.9757905
17/4/2019 2 33.77 191.5888773
17/5/2019 2 33.77 241.4707898
17/6/2019 2 33.77 316.5279056
17/7/2019 2 33.77 262.0162952
17/8/2019 2 33.77 317.8178408
17/9/2019 2 33.77 273.8698727
17/10/2019 2 33.77 258.4812378
17/11/2019 2 33.77 253.4914123
17/12/2019 2 33.77 266.1575394
17/1/2020 2 45.59 228.0170478
17/2/2020 2 45.59 230.5792029
17/3/2020 2 45.59 356.976704
17/4/2020 2 45.59 359.027983
17/5/2020 2 45.59 431.6293151
17/6/2020 2 45.59 328.6724979
17/7/2020 2 45.59 352.1057149
17/8/2020 2 45.59 301.6853032
17/9/2020 2 45.59 290.0191396
17/10/2020 2 45.59 307.8081476
17/11/2020 2 45.59 368.4571564
17/12/2020 2 45.59 295.6825498
17/1/2021 2 43.73 280.6170065
17/2/2021 2 43.73 215.4135632
17/3/2021 2 43.73 215.2704288
17/4/2021 2 43.73 199.4371476
17/5/2021 2 43.73 190.319996
17/6/2021 2 43.73 178.801245
17/7/2021 2 43.73 205.5256264
17/8/2021 2 43.73 216.4920911
17/9/2021 2 43.73 205.3888224
17/10/2021 2 43.73 195.2901747
17/11/2021 2 43.73 228.0767047
17/12/2021 2 43.73 266.1702001
17/1/2022 2 44.13 232.0608158
17/2/2022 2 44.13 191.9002698
17/3/2022 2 44.13 330.0518633
17/4/2022 2 44.13 303.0238944
17/5/2022 2 44.13 291.2759018
17/6/2022 2 44.13 275.2200013
17/7/2022 2 44.13 317.1823114
17/8/2022 2 44.13 257.1827253
17/9/2022 2 44.13 281.92513
17/10/2022 2 44.13 301.3202716
17/11/2022 2 44.13 332.5035624
17/12/2022 2 44.13 263.563725
17/1/2023 2 45.13 247.3790651
17/2/2023 2 45.13 243.441932
17/3/2023 2 45.13 310.6251426
17/4/2023 2 45.13 231.7783697
17/5/2023 2 45.13 228.3557885```
Any assistance with the right code and steps to run a panel VAR using monthly datasets would be appreciated.
Thank you.