Combing variables with computed variable f(x)

Discuss statistics related things
Post Reply
mrpetch
Posts: 2
Joined: Thu Apr 07, 2022 7:14 am

Combing variables with computed variable f(x)

Post by mrpetch »

I want to combine two 2 variables, 'vegetables eaten' (1 = low vegetable intake, 7 = high vegetable intake )and 'junk food eaten', (1= low junk food intake, 10= high junk food intake) into one predictor variable called 'physical health'. By the way I can't change how these variables are set up.

Now, obviously the higher 'vegetables eaten' is, the higher physical health should be. And, the lower 'junk food eaten' is, the higher physical health should be, and that's the problem I'm having.

I've tried computing a new variable with the function: vegetables * (1 / junkfood), but this gives a very low end bias. When you look at the distribution of scores for this new variable, it shows my sample has an on average bad physical health when in reality, when you look at a density plot for both vegetables and junk food individually, on average people eat a decent amount of vegetables and very little junk food.


Need help coming up with a suitable function for my combined predictor variable, 'physical health'.
User avatar
jonathon
Posts: 2622
Joined: Fri Jan 27, 2017 10:04 am

Re: Combing variables with computed variable f(x)

Post by jonathon »

oh this is a fun exercise.

i'd start with your four corners:

vegetables eaten = 1, junk food = 10, health = ???
vegetables eaten = 7, junk food = 10, health = ???
vegetables eaten = 1, junk food = 1, health = ???
vegetables eaten = 7, junk food = 1, health = ???

once you define those 4, try coming up with a simple function which joins them all.

cheers
mrpetch
Posts: 2
Joined: Thu Apr 07, 2022 7:14 am

Re: Combing variables with computed variable f(x)

Post by mrpetch »

Hey thanks man, I think i figured out a good one: vegetables * (11-junkfood)

But out of curiosity what exactly do you mean by 'defining' those four corners?
User avatar
jonathon
Posts: 2622
Joined: Fri Jan 27, 2017 10:04 am

Re: Combing variables with computed variable f(x)

Post by jonathon »

so using the formula you provide, we can see how it behaves at the four extremes:

vegetables eaten = 1, junk food = 10, health = 1
vegetables eaten = 7, junk food = 10, health = 7
vegetables eaten = 1, junk food = 1, health = 10
vegetables eaten = 7, junk food = 1, health = 70

this might be appropriate, but perhaps you want something more like this:

vegetables eaten = 1, junk food = 10, health = 0
vegetables eaten = 7, junk food = 10, health = 5
vegetables eaten = 1, junk food = 1, health = 5
vegetables eaten = 7, junk food = 1, health = 10

then you could work backwards to find a formula that fits these four data points.

jonathon
User avatar
reason180
Posts: 276
Joined: Mon Jul 24, 2017 4:56 pm

Re: Combing variables with computed variable f(x)

Post by reason180 »

I would first put both variables on the same, 0-to-1 scale.

Where V is vegetables eaten, J is junk food eaten, and H is health:

V' = (V - 1) / 6
J' = (J - 1) / 9

Then I would subtract J' from 1 to reverse the J' scale:

J'' = 1 - J'

Then I would average:

H = (V' + J'') / 2
Post Reply