1
$\begingroup$

I have the following doubt: suppose you have a categorical variable called 'neighborhood' with 20 categorical levels/values ("vila madalena", "mooca", etc). and I want to check for linearity with a y response variable Price of House. I count how many houses are in each neighborhood in my dataset (e.g. 'vila madalena' neighbor are 120 house prices, 'mooca' 200 house prices). I can't plot a scatterplot because the data is categorical, but I could plot a Histogram and if my histogram looks like a Normal curve does it mean that I can assume a linear relationship between the variables?

I am trying to be as clear as I think.

Explaining more...Let us suppose I want to apply a regression method to predict a Y continuous variable and I have a categorical explanatory variable. If I can draw a line I could use linear regression for example, but I can't plot a scatterplot (to investigate if datapoints are linear) because my explanatory variable is categorical. What I can do is plot I think is a Bar Graph or a Histogram, right? Now let's ADD another explanatory variable, let's suppose house size in meteres^2. So now I have 2 explanatory variables 1 is categorical the other 1 is continuous. I still would like to use y=ax +b model. But I suppose to use this model variables need to linear, right? So how do I check if I can use this categorical variable in this model? I thougth an aprox. gaussian curve of this categorical variable would be a green light to use this var in my linear regression model. I can inspect an association between House Price and House Size m² VISUALLY with a Scatterplot. Can I do the same VISUALLY with a Barplot, hist, any visual tool? Thank you

$\endgroup$
  • 1
    $\begingroup$ You can make a bar plot of the data, but a histogram would need a quantitative variable. $\endgroup$ – CFD Sep 2 at 15:25
  • 3
    $\begingroup$ Could you please explain what "linearity" might possibly mean in this setting? $\endgroup$ – whuber Sep 2 at 15:33
  • $\begingroup$ What I mean by linearity is when you plot an independent variable and a dependent variable that both are continuous and the scatter aproximates to a line. Like this:stat.yale.edu/Courses/1997-98/101/scatex.gif $\endgroup$ – João Vitor Gomes Sep 2 at 15:40
  • 1
    $\begingroup$ But you ask explicitly about a "categorical" variable--and that's certainly not continuous. It is difficult to see how the concept of linearity could possibly apply. $\endgroup$ – whuber Sep 2 at 15:46
  • 1
    $\begingroup$ Thank you all for your questions, just by questioning things are becoming more clear now. $\endgroup$ – João Vitor Gomes Sep 2 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.