1

I need to extract residuals from a model in R where I have used

lm_robust(XS1 ~ rmrf + smb + hml + umd, data=df)

Does anybody know how to do it, please?

The use of residuals(), resid(), rstandard() don't work with this function.

Vinícius Félix
  • 8,448
  • 6
  • 16
  • 32

1 Answers1

2
library(estimatr)
model <- lm_robust(XS1 ~ rmrf + smb + hml + umd, data = df)
df$residuals <- (model$fitted.values - df$XS1)

Can you calculate the residuals like this?

Isaiah
  • 2,091
  • 3
  • 19
  • 28