After estimating my model
train_data <- df_est_hdfe[idx,]
test_data <- df_est_hdfe[-idx,]
est <- c("NATURAL", "GDPsim", "cap_lab_sim", "cap_lab_sim_sq", "cont")
form <- formula(paste0("rta ~ ",paste(est, collapse = " + "), "| exp_ind + imp_ind"))
train_data <- as.data.frame(train_data)
probithdfe <- feglm(form, data = train_data[,c("rta", est, "exp_ind", "imp_ind")], family = binomial(link = "probit"))
I would like to use it to predict the output given some new data
pred_LM <- predict(probithdfe, newdata = test_data[,c(est, "exp_ind", "imp_ind")], type = "response")
However, I can't get my new data into the predict function as
dim(test_data)
[1] 5910 13
while
length(pred_LM)
[1] 11546
which is the size of the training data. How can I apply my estimated model to new data? I assume this might be specific to the feglm specification of the alpaca
package.