Closed waynelapierre closed 3 years ago
pmg
removes observations when NA is encountered. Could you provide an example to illustrate what you have in mind?
After updating to the most recent plm, it seems plm can handle missing values in independent and dependent variables now. Does it also handle missing values in the time and id index?
Please make sure to use the latest CRAN version before you write in. However, if I remember correctly, dropping rows with NA in variables used in estimation is in pmg for quite a long time (maybe from its first version).
Please read the NEWS (from 2.4-1): NAs in the index variables are "handled" like this (at least currently; one could argue to drop affected rows (with a warning)):
- pdata.frame: warns if NA in index dimension is encountered (before, only a plain message was printed).
- Between/between/Sum/Within: Methods which rely on the index attribute (*.pseries and partly *.matrix)
now error informatively if NA in any index dimension is encountered.
Example:
data("Produc", package = "plm")
Produc[2, "state"] <- NA
head(Produc)
mgmod <- pmg(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc)
# Error in checkNA.index(index) : NA in the individual index variable
# In addition: Warning message:
# In pdata.frame(data, index) :
# at least one NA in at least one index dimension in resulting pdata.frame
# to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany")
I noticed that I need to remove all missing values when using plm::pmg. Most other econometrics packages can automatically handle missing values. Would you add this feature in the future? Thanks.