I have two columns in my dataset: Health and Weight, both being of numeric type:

    Health<-number of days when health is not good,

All I want to check if there is a relationship between Health and Weight. In other words, does a Weight increase yield an increase of the number of days where Health is not good, or the converse? I just want to check the relation between those two columns in dataset by plotting some graphs.

Here my sample dataset:

| Health     | Weight      | 
| 0          |      30     |        
| 3          |      63     |        
| 2          |      31     |          
| 10         |      169    |            
| 1          |      9      |    
|0           |     139     |   
  • $\begingroup$ What have you tried? Something as simple as plotting one against the other? plot(newdata$Weight, newdata$Health)? $\endgroup$
    – Spacedman
    Aug 20, 2016 at 12:50
  • $\begingroup$ @Sumanth Sharma I have somehow rephrased your question. I hope I have kept your initial goals $\endgroup$ Aug 20, 2016 at 12:51
  • $\begingroup$ Also, I'd call your "Health" variable "Sickness" or "BadHealth", because the larger the value, the less healthy the subject is. $\endgroup$
    – Spacedman
    Aug 20, 2016 at 16:02
  • $\begingroup$ @Spacedman, i used the above thing which you said but as it is very big data base i can see the exact picture. How the graph is floating. $\endgroup$ Aug 20, 2016 at 17:20
  • $\begingroup$ How many points? This would be useful information to edit into your question. $\endgroup$
    – Spacedman
    Aug 21, 2016 at 14:31

4 Answers 4



You could bin the 'Health' vector to make a categorical variable (ideally consisting of similar number of observations, for example : 2-bin would be median-split of 'high' and 'low', 3-bin would be tertiles of 'high', 'medium' and 'low', and so on), and then do box plots of 'Weight' per bin. You might see that the bin of 'low' is different from the bin of 'high'. The number of bins you choose depends on the distribution of the 'Health' variable and you can play around with that.


library(dplyr) # for modifying datasets 
library(ggplot2) # for plotting 
library(magrittr) # for piping
stackodato <- data.frame("Health" = sample(0:10, 10), "Weight" = sample(0:200, 10)) # creating a pseudo dataset

stackodato %>% 
mutate(binnedHealth = factor(dplyr::ntile(Health, 2), labels=c("low", "high"))) %>% # add "binnedHealth" column which has the "Health" variable categorized into two factors : "high" and "low"
ggplot()+geom_boxplot(aes(x=binnedHealth, y=Weight)) # boxplot showing the distribution of "Weight" split by the "binnedHealth" factor

Boxplot of median-split Health - x-axis is binned Health

You can also try this :

stackodato %>% mutate(binnedHealth = factor(dplyr::ntile(Health, 2), labels=c("low", "high"))) %>% ggplot()+geom_boxplot(aes(x=Health, y=Weight, group = binnedHealth))

Boxplot of median-split Health - x-axis is Health


I second Arun Aniyan's answer. Look at how the two features are related to each other by computing Pearson's correlation coefficient. Another option would be to visualize your data by plotting a scatterplot


You could perform unsupervised clustering on the data(k-means), this will give you relationships like weights of the people whose health is not good for a particular number of days.


When it comes to health and weight, it's important to understand that the relationship between the two is not as simple as it may seem. While weight can be a factor in assessing overall health, it's not the only thing that matters.

Here's the deal: Health is influenced by various factors, like body composition, which refers to the proportion of fat, muscle, and other tissues in your body. Some people may have a higher weight because they have more muscle, which can actually be a sign of good health.

We often hear about Body Mass Index (BMI) as a measure of weight status, but it has its limitations. BMI doesn't consider individual differences in body composition, such as muscle mass or bone density. So, it might not give a complete picture of someone's health.

Instead of solely focusing on weight, it's important to pay attention to other aspects of health, like metabolic health. Factors such as blood pressure, blood sugar levels, cholesterol, and insulin sensitivity are crucial indicators. Even if someone has a higher weight, they can still be metabolically healthy by adopting a balanced diet, being physically active, and making healthy lifestyle choices.

Now, it's true that excessive weight, especially when it's accompanied by high levels of body fat, can increase the risk of certain health conditions like diabetes or heart disease. But it's also important to remember that not everyone with higher weight will develop these conditions, and there are people with lower weight who may still face health challenges. health apps can also help track your weight and fitness.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.