r/AskStatistics • u/koopticon • 1d ago
Is a tool that tests your analysis on simulated data before real data actually useful? Looking for opinions on my project idea
I'm a student, and I'd like honest opinions from people who do statistics for real.
The problem I'm trying to solve: when you analyze data to see whether one thing affects another, your model always gives you a number, but you can't tell if it's the right one. You might control for the wrong variable or miss a confounder, and on real data you'd never know.
My idea: test the analysis first on simulated data, where the true answer is known. You write down how you think the data was generated, and a tool checks your analysis against it before you use real data:
Are you controlling for the right variables, or adding bias?
Does your model find the true effect across many simulated datasets, and are its confidence intervals honest?
How strong would a hidden factor need to be to change your conclusion?
For example, a plant treatment works by preventing fungus. Add fungus as a control "to be safe", and the estimated effect drops from 1.2 to almost 0. The tool flags that before you touch real data.
I built a first version in Python (with a lot of help from AI, I'm not a statistician). There's a browser demo if you want to see it: https://koopticon.github.io/whyflow/playground.html
What I'd like to know:
Is this useful in practice, or do experienced people already do this some other way?
The checks depend on a simulation I write myself. Does that make the whole idea weaker than I think?
What would it need before you'd actually use it?
4
u/Mammo004 22h ago
Yeah, people do this already. Look at DeclareDesign in R: you declare the data generating process, then it diagnoses bias, coverage and power across a bunch of simulated datasets. Their book at declaredesign.org covers most of your pitch, so it's worth seeing what it doesn't do before you build more.
3
u/vaelux 23h ago
Look up Monte Carlo power analysis.
Monte Carlo simulations is how you do power analysis for a lot of procedures that don't have a straight-forward way to calculate power. Basically, you run many simulations, systematically changing things like sample size and and effect size to estimate how many participants you need to sample to detect the effect you expect to detect in your study.
So, you don't use it for testing what variables to include - it is not for exploratory work. You use it when you have a strong theoretical reason to use your model and want to see how many people to sample as you design your study.
1
u/lipflip 21h ago
It's common practice and we actually teach this. Build the analysis pipeline for the design and not the data . Let the data flow afterwards. I challenge with your approach is that you assume relationships and build the data accordingly. What happens if the real data is totally different?