heteroskedasticity-consistent (HC) standard errors
-
- Posts: 1
- Joined: Sat Jun 13, 2020 9:22 am
heteroskedasticity-consistent (HC) standard errors
Hi together,
I recognized that some of my predictors does not fulfill the assumption of homoskedasticity.
As far as I know, robust standard errors or heteroskedasticity-consistent (HC) standard errors are one possibility to cope with this issue.
Is there any possibility to compute a regression analysis with such HC standard errors? I have already downloaded the module walrus, but can only find t-tests and anova.
Thanks in advance & regards from Germany
Nathalie
I recognized that some of my predictors does not fulfill the assumption of homoskedasticity.
As far as I know, robust standard errors or heteroskedasticity-consistent (HC) standard errors are one possibility to cope with this issue.
Is there any possibility to compute a regression analysis with such HC standard errors? I have already downloaded the module walrus, but can only find t-tests and anova.
Thanks in advance & regards from Germany
Nathalie
Re: heteroskedasticity-consistent (HC) standard errors
hi,
not something i know about, sorry.
kind regards
jonathon
not something i know about, sorry.
kind regards
jonathon
Re: heteroskedasticity-consistent (HC) standard errors
Hi, @NathalieGier.
I am attaching a jamovi file where with a small scrip r for the Rj module you can calculate heteroskedasticity-consistent (HC) standard errors as in STATA.
I hope you find it useful, let me know.
Regards from Italy.
Maurizio
I am attaching a jamovi file where with a small scrip r for the Rj module you can calculate heteroskedasticity-consistent (HC) standard errors as in STATA.
I hope you find it useful, let me know.
Regards from Italy.
Maurizio
Re: heteroskedasticity-consistent (HC) standard errors
Hi @Magojam et al,
It is very odd that robust SEs are not a feature, seeing as they are so commonly used.
I tried your code, but it seems to just output the same set of non-robust standard errors. See attached.
Any thoughts?
Thanks
Tom
It is very odd that robust SEs are not a feature, seeing as they are so commonly used.
I tried your code, but it seems to just output the same set of non-robust standard errors. See attached.
Any thoughts?
Thanks
Tom
Re: heteroskedasticity-consistent (HC) standard errors
Hi Tom.
I am attaching you .omv files with Rj scripts and screenshots that should help.
For the script's summary.lm () function that overrides summary (), take a look here:
https://economictheoryblog.com/2016/08/ ... -function/
Sorry if I run, but if it doesn't help, go back. Cheers,
Maurizio
I am attaching you .omv files with Rj scripts and screenshots that should help.
For the script's summary.lm () function that overrides summary (), take a look here:
https://economictheoryblog.com/2016/08/ ... -function/
Sorry if I run, but if it doesn't help, go back. Cheers,
Maurizio
Re: heteroskedasticity-consistent (HC) standard errors
Thanks so much. The code is failing on something very simple - I'm not sure how to refer to the data - forgive me, I'm a Stata person, not an R person.
If I want to run the code on an open Jamovi dataset (.omv), how do I do that? I tried something like
But this returns an error. I'm sure this is completely simple but I'm not how to solve it.
Thanks
Tom
If I want to run the code on an open Jamovi dataset (.omv), how do I do that? I tried something like
Code: Select all
my_data <- lab_data_baseline.dta ('/Users/tk1/Dropbox/teaching/BUS135_QUANT/data/lab_data_baseline.dta')
my_model <- lm(grsswk ~ sexx + ttushr + sc10mmj, data = my_data)
Thanks
Tom
Re: heteroskedasticity-consistent (HC) standard errors
Hi, Tom.
Sorry if I tell you things you know, but I don't wish I had misinterpreted your question.
The Stata files (.dta), are files that jamovi is able to import without particular problems by going from the Import->This PC (Hamburger menu).
From the combobox Data files select one of the available formats, in your case it will be Stata files (.dta) and then with Browse go to the folder where the file you want to use is present.
In the Rj editor, you can refer to the dataset with data.
If you prefer to use the Rj editor with a blank jamovi, you can refer to your Stata data with this lightweight code:
Cheers,
Maurizio
Sorry if I tell you things you know, but I don't wish I had misinterpreted your question.
The Stata files (.dta), are files that jamovi is able to import without particular problems by going from the Import->This PC (Hamburger menu).
From the combobox Data files select one of the available formats, in your case it will be Stata files (.dta) and then with Browse go to the folder where the file you want to use is present.
In the Rj editor, you can refer to the dataset with data.
Code: Select all
# Your code:
my_data <- lab_data_baseline.dta ('/Users/tk1/Dropbox/teaching/BUS135_QUANT/data/lab_data_baseline.dta')
my_model <- lm(grsswk ~ sexx + ttushr + sc10mmj, data = my_data)
# it should be this:
my_data <- data
my_model <- lm(grsswk ~ sexx + ttushr + sc10mmj, data = my_data)
# or even just this:
my_model <- lm(grsswk ~ sexx + ttushr + sc10mmj, data = data)
Code: Select all
library(haven)
library(lmtest)
# Import Stata file
my_data <- read_dta('C:/Users/tk1/Dropbox/teaching/BUS135_QUANT/data/lab_data_baseline.dta')
my_model <- lm(grsswk ~ sexx + ttushr + sc10mmj, data = my_data)
Maurizio
Re: heteroskedasticity-consistent (HC) standard errors
Again, many thanks Maurizio - I really appreciate your help.
I copied and pasted your code (adjusting the path slightly - I'm on a Mac not a pc), but no matter how I adjust, or which version of your code I use, literally nothing happens. I get no output, and no error.
For instance- running the following:
I get the attached output (nothing). I also tried this with the data already loaded. Same non-result.
So confusing! Any thoughts?
Best,
Tom
I copied and pasted your code (adjusting the path slightly - I'm on a Mac not a pc), but no matter how I adjust, or which version of your code I use, literally nothing happens. I get no output, and no error.
For instance- running the following:
Code: Select all
library(haven)
library(lmtest)
# Import Stata file
my_data <- read_dta('/Users/tk1/Dropbox/teaching/BUS135_QUANT/data/lab_data_baseline.dta')
my_model <- lm(grsswk ~ sexx + ttushr + sc10mmj, data = my_data)
So confusing! Any thoughts?
Best,
Tom
- Attachments
-
- Screenshot 2021-02-26 at 10.04.03.png (100.6 KiB) Viewed 4592 times
Re: heteroskedasticity-consistent (HC) standard errors
put
my_model
on a line at the end by itself.
jonathon
my_model
on a line at the end by itself.
jonathon
Re: heteroskedasticity-consistent (HC) standard errors
Hi Tom.
I saw that Jonathon has already answered you (thanks J).
I think he will help you to have the file (attached) with all the code again (to answer the original question).
Check that the file path is correct for your MAC.
If there are any problems, come back here.
Cheers,
Maurizio
I saw that Jonathon has already answered you (thanks J).
I think he will help you to have the file (attached) with all the code again (to answer the original question).
Check that the file path is correct for your MAC.
If there are any problems, come back here.
Cheers,
Maurizio