rlm error (unused argument)

library(readxl)
library(janitor)
library(tidyverse)
library(gt)
library(infer)
library(psych)
library(skimr)
library(broom)
library(sandwich)
library(lmtest)
library(rlm)
library(reprex)
data <- read_csv("data_2/ohie_assignment2.csv") %>% 
  na.omit() %>% 
  clean_names()

data %>% 
rlm(ed_visits ~ medicaid, data = data)

The error message I get reads "Error in rlm(., ed_visits ~ medicaid, data = data) : unused argument (data = data)"

I'm sure I'm doing something really stupid wrong, but I can't seem to figure out what it is... any ideas?

My code works when I run the standard lm, but I want to use the robust method... Would something like this accomplish the same thing as rlm?


model <- lm(ed_visits ~ medicaid, data = data)

# This takes what I have done and saves the heteroscedastic robust standard error

robust <- 
  coeftest(model, vcov = vcovHC(model, "HC1"))

Thank you!

Created on 2020-03-16 by the reprex package (v0.3.0)

is really executing

rlm(data, ed_visits ~ medicaid, data = data)

Don't pipe in data in the call (since it is not the first argument to rlm()).

Thanks, Max! When I take out the pipe, I still get the same error.

Then I think that we'd need the data to take a closer look

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