-1
$\begingroup$

I am analyzing airbnb data to understand which variable is most correlated and in doing so build a model. Upon tackling qualitative variables I decided to use dummies to assign quantitative values to my categories to get this: enter image description here enter image description here I am trying to see the correlation "property_type" has on availability of the airbnb. So, I selected "entire home" as the dummy for "property type". Why is my graph doing that, what am I doing wrong ?

$\endgroup$
2
  • 4
    $\begingroup$ I'd suggest adding code as formatted text using ```. You have not described the data in df but since you're setting the property type column to $1$, isn't it expected that the plot of property type vs availability will be a vertical scatter plot? $\endgroup$ Jul 28, 2023 at 4:25
  • 1
    $\begingroup$ I'd suggest giving this question a more specific name. Users are unlikely to discover this post with such a vague title. $\endgroup$ Jul 31, 2023 at 18:10

1 Answer 1

1
$\begingroup$

The "X" you created here is a column with the same value in all rows, in the line df["Entire home/apt"] = 1. This is why all the points are on the same place on the X axis.

Regression only makes sense if there are multiple values in the independent variable, and these values are ordinal in some way, i.e. not qualitative (also called categorical) variables. There are various options for plotting relationships with independent categorical variables, such as bar plots of the mean, or boxplots showing the distribution for each category.

$\endgroup$

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