Closed liuhaiqinFDU closed 1 year ago
Also, I found that in lp_lin_iv.R
, in the 570th (or so) line, the names(diagnostic_list) <- paste("Endog. Variable:", specs$column_names , sep = " ")
can encounter error because diagnostic_list
is empty before the assignment, maybe adding a line diagnostic_list <- vector("list", length = length(specs$column_names))
before this can fix this problem?
This is not a bug. Your data contains NA
values in between, and the package does not know what to do with them because it does not do automatic imputation. If you remove the NA
s, it works. However, you get another error, because of singularity issues. This has something to do with your instruments. Try them out separately.
# Find NA values
data |>
mutate(row_nr = row_number()) |>
relocate(row_nr) |>
filter(if_any(everything(), is.na))
# Remove NA values
data <- data
drop_na()
Have you encountered the following error: while running the 81st line
yx_all <- cbind(y_lin, x_lin) %>% stats::na.omit()
it gives the
yx_all
data.frame with inconsistent length withx_lin
, then, when the program proceeds to line 101 (suppose I choose to use 2SLS), it will report an error saying "Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: X, Y", where X is the length of my instrument data, which is of the same length asy_lin
andx_lin
before running the 81st line; Y is the length ofyx_all
. I think the problem lies in the fact that we drop NAs in the 81st line. How should we fix this?(I attach my data and my code of using the
lp_lin_iv
function here) example.zip