How to simulate correlations

Discuss statistics related things
Post Reply
Vit
Posts: 65
Joined: Fri Apr 19, 2019 11:51 am

How to simulate correlations

Post by Vit »

Hi there,

Simulating data is becoming more and more common practice for both teaching stats and research plannig. I highly appreciate that jamovi is capable of generating data of various distributions. But I would like to know whether there is a way to generate correlated data. Let's say I would like to generate a dataset with body height (normally distributed around mean of 175cm with SD=5cm) and body weight (normally distributed around mean of 75 kg with SD = 5kg), where the height and weight are positively correlated (r ~8; i.e. taller people are also heavier).

Is there some way other than writing R code?

If there isn't one, is it in the plan to provide jamovi user with some data simulation tool (a new module maybe) or tutorial on how to?

Thanks for keeping up the great work!
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: How to simulate correlations

Post by jonathon »

hi vit,

how about,

variable height with the formula

NORM(175, 5)

variable weight with the formula

NORM(75, 5) + X * (height - VMEAN(height))

by varying the value of X, you can increase or decrease the strength of the correlation.

i'm not entirely sure how to achieve a specific correlation (i.e. 0.8 ...) i'd have to think about it, maybe write some formulas out, and i'm a bit too lazy for that at the moment.

but hopefully this is enough to get you started.

jonathon
Vit
Posts: 65
Joined: Fri Apr 19, 2019 11:51 am

Re: How to simulate correlations

Post by Vit »

Jonathon, you are golden! Thank you very much. I'll tinker with the formula.
Vit
Posts: 65
Joined: Fri Apr 19, 2019 11:51 am

Re: How to simulate correlations

Post by Vit »

If I may, I would like to develop on this.

Generating one set of data is great and all. I can design my analysis plan, see how data works perfectly. But I wondered whether there wouldn't be an option to prepare data simulation, choose a test and have this iterate for couple times. Effectively, have a "brute force" power analysis tool.

Does it make sense, is it doable and would it fit into jamovi development plan?
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: How to simulate correlations

Post by jonathon »

hmm ... in general, there's a world of difference between a general idea, and a concrete proposal. the general idea seems ok, but i think once we begin nailing down specifics, i expect it would mean making pretty radical changes to the jamovi paradigm.

not sure.

jonathon
Vit
Posts: 65
Joined: Fri Apr 19, 2019 11:51 am

Re: How to simulate correlations

Post by Vit »

I can (or maybe better I can't even) imagine the difficulties it would rise. It is just a brainstorming idea. I am more than thankful for what jamovi can do.
Post Reply