hdfeppml "Error in stats::lm.wfit(x_resid, z_resid, mu) : 0 (non-NA) cases"

Hi all,

I'm trying to run hdfeppml on a panel of international trade flows. "Value" is my dv, "UKFTA" is my iv, "Expcom" and "Expmon" are manually created factor variables which I would like to use for fixed effects.

I follow online examples / help and get the error message:

"Error in stats::lm.wfit(x_resid, z_resid, mu) : 0 (non-NA) cases
In addition: Warning messages:
1: In mean.default(y) : argument is not numeric or logical: returning NA
2: In mean.default(y) : argument is not numeric or logical: returning NA"

I also tried to create a reprex for convenience and got another error message. All of this is outlined in the screenshot below. I've been on multiple forums and looked at several different approaches to both problems. Any help would be massively appreciated - thanks

Please post the output of running

summary(Panel_long)

Do not post an image of the output. Copy it from the console and paste it into your response, placing lines with three back ticks just before and after the output, like this:
```
pasted output of summary() goes here
```

[quote="FJCC, post:2, topic:181697"]

   Importer           Exporter          Commodity            Month          
 Length:142780      Length:142780      Length:142780      Length:142780     
 Class :character   Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character   Mode  :character  
                                                                            
                                                                            
                                                                            
     Value               UKFTA             Expcom          Expmon    
 Min.   :      0.0   Min.   :0.00000   Min.   :10001   Min.   :1010  
 1st Qu.:     15.7   1st Qu.:0.00000   1st Qu.:12612   1st Qu.:1235  
 Median :    387.2   Median :0.00000   Median :14846   Median :1462  
 Mean   :   8166.4   Mean   :0.01055   Mean   :14985   Mean   :1482  
 3rd Qu.:   2668.2   3rd Qu.:0.00000   3rd Qu.:17582   3rd Qu.:1734  
 Max.   :2012001.3   Max.   :1.00000   Max.   :19988   Max.   :1968  

Thanks

None of your variables are non-numeric, so I can't explain why you are getting a warning about that. Even Expcom and Expmon are numeric, though you describe them as factors.
Your call to hdfeppml() ends with fixed = "Expcom, "Expmon") that causes the fixed argument to be set to "Expcom" and cluster, which is the next argument, to be set to "Expmon". Is that what you want? If you want both columns to be passed to fixed use `fixed = c("Expcom, "Expmon"))

Thanks for this. I've changed my code accordingly but the error persists:

> Reg <- hdfeppml(data = Panel_long, dep = "Value", indep = "UKFTA", fixed = c("Expcom", "Expmon") )
Error in stats::lm.wfit(x_resid, z_resid, mu) : 0 (non-NA) cases
In addition: Warning messages:
1: In mean.default(y) : argument is not numeric or logical: returning NA
2: In mean.default(y) : argument is not numeric or logical: returning NA

I've also double checked all depends and imports. Any further advice on this would be great? Happy to share data if it helps.

Thanks

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.