ProfessorAmanda / econsimulations

This repository provides the code underlying simulations for teaching statistics and econometrics. The project site, which includes teaching materials as well as the link to the simulations, is located here: https://amandagreggeconomics.com/statistics-simulations-project/
Other
1 stars 0 forks source link

plot distribution of f-statistic #195

Closed ethansaxenian closed 3 years ago

ethansaxenian commented 3 years ago

closes #193

ProfessorAmanda commented 3 years ago

Neato! It has the right shape for sure. I'm struck that the lower bound for the F values in the replication tends to be the F value shown in the test. That might be right, just by chance, but seems unlikely given the number of attempts I tried. Let's check to make sure a) that the F-statistic is being calculated properly (should only depend on sample numbers) and that b) a new sample is drawn for each replication.

ProfessorAmanda commented 3 years ago

I'll also come up with some text to describe what is being plotted. (It's not a type 1 error simulation).

ethansaxenian commented 3 years ago

A new sample is definitely being drawn for each population. As to the correctness of the F-Statistic, this is the pseudocode I'm using:

overallSampleMean = mean(all sample observations)
SSTR = sum(for each population p, size(p) * (mean(p) - overallSampleMean)^2)
MSTR = SSTR / (number of populations - 1)
SSE = sum(for each population p, (size(p) - 1) * standardDev(p)^2)
MSE = SSE / (sum(size of each population) - number of populations)
F = MSTR / MSE

Let me know if this makes sense/is correct

ProfessorAmanda commented 3 years ago

Yes, that's correct.

I think that, seeing this, I've realized that what I really want is a Type I error simulation. So, scrap the replication for now, but keep the code, as you will need it to simulate Type I error. I'm going to make a separate issue to outline how to do it.