AdaemmerP / lpirfs

40 stars 21 forks source link

Using ip_lin_iv for impulse response function using 2SLS #27

Closed chelseasong521 closed 1 year ago

chelseasong521 commented 1 year ago

Hi, I was having trouble trying to run the following commands:

base_iv1 <- lp_lin_iv( endog_data = endog, shock = shock, cumul_mult = TRUE, instrum = instrum, use_twosls = TRUE, lags_endog_lin = 4, exog_data = exog, lags_exog = 4, lags_criterion = NaN, trend = 0, confint = 1.96, hor = 12 )

and I get an error "Error in { : task 1 failed - "Mat::insert_cols(): given object has an incompatible number of rows"

Specifically, it seems that whenever I put both "cumul_mult = TRUE" and " use_twosls = TRUE", it would report such an error. The number of rows in all data frames I put are the same.

AdaemmerP commented 1 year ago

I did not account for that particular case. I fixed it and pushed a new version to the development branch. Try to install it via devtools::install_github("https://github.com/AdaemmerP/lpirfs/tree/dev") and please tell me whether it solves your issue.

chelseasong521 commented 1 year ago

Thank you so much for your prompt response.

I've tried following the instructions first downloaded the Clang 6.x compiler and the GNU Fortran compiler from [macOS tools], and then installed devtools::install_github("https://github.com/AdaemmerP/lpirfs/tree/dev") in the R studio. However, I received some error messages that "compilation failed for package ‘lpirfs’

The full error message, including my commands, are attached in the files below. Error messages.pdf

Thank you very much for your assistance!

AdaemmerP commented 1 year ago

According to your error message, the error occurs when you attempt to update RcppArmadillo. What happens when you do not update it? Can you install lpirfs then?

chelseasong521 commented 1 year ago

Unfortunately, no. When I skip the updates altogether, it still shows compilation failed for package 'lpirfs'. Error messages 1.pdf

AdaemmerP commented 1 year ago

It says that it cannot find the gfortran library. This seems a compiler and Mac specific issue. Unfortunately, I cannot help you with this. This Link on stack overflow might be helpful though.

chelseasong521 commented 1 year ago

Thank you very much! I will look into it.

AdaemmerP commented 1 year ago

Great. Please let me know whether it works out. I can merge the branches then and push the new version to CRAN.

AdaemmerP commented 1 year ago

The new CRAN version (0.2.3) solved this issue.