1

I am currently working on the estimation of spatial models and got a problem with my robust SLX model. Technically you do not need to know anything about spatial econometrics, I created all spatial effects manually and wanted to estimate a robust linear regression with the lm_robust command from the estimatr package. This is a plain robust linear estimation and I really don't know why it does not work.

It works for instance for the rlm command from the MASS package, but I want to use the lm_robust since it offers the opportunity to choose the type of HAC estimator.

library(estimatr)
library(stats4)
lmro <- lm_robust(eq1, data=mydata, se_type = "HC0")
summary(lmro)
AIC(lmro)
BIC(lmro)

Error in UseMethod("logLik") : no applicable method for 'logLik' applied to an object of class "lm_robust"

I don't get it why the logLik cannot be applied to this specific command for robust linear estimation.

Thanks in advance for any help! :)

kangaroo_cliff
  • 6,067
  • 3
  • 29
  • 42
  • It could be useful if you can provide a reproducible example. – kangaroo_cliff Aug 12 '19 at 23:07
  • Thank you for your response! I am using a simple cross-sectional dataset with a Y and several X's. I would send you one, but the only dataset I got right now on my computer is my research set which I am not allowed to publish. Regardless the data I assume the problem occurs with any data being estimated with these commands. – SpatialNovice Aug 12 '19 at 23:52
  • You don't have to use private data. Create an artificial one or find a public one. – kangaroo_cliff Aug 13 '19 at 02:05
  • I do not know how to upload a data file (as I read it is not possible). So when I reproduced my problem plain and simple (creating random numbers in Excel for some Y and multiple X values and copying them), the same problem as described above occured. '''' my_data <- read.table(file = "clipboard", sep = "\t", header=TRUE) View(my_data) eq1 <- Y~X1+X2+X3 install.packages("estimatr") install.packages("stats4") library(estimatr) library(stats4) lmro <- lm_robust(eq1, data=my_data, se_type = "HC0") summary(lmro) AIC(lmro) BIC(lmro) '''' – SpatialNovice Aug 13 '19 at 20:16
  • See [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on how to make a reproducible example. – kangaroo_cliff Aug 13 '19 at 22:59
  • Hi Suren and sorry for my late response. I read under your link that R contains already sample data sets. So I adjusted the code with one of these to obtain the same error as described above. ''''dput(mtcars) eq1 <- mpg~hp+drat+wt install.packages("estimatr") install.packages("MASS") install.packages("stats4") library(estimatr) library(MASS) library(stats4) lmro <- lm_robust(eq1, data=mtcars, se_type = "HC0") summary(lmro) AIC(lmro) BIC(lmro)'''' – SpatialNovice Aug 18 '19 at 21:44

0 Answers0