Why do my scatterplots look exactly the same though I am transforming a predictor?

This is the dataset I'm using: http://archive.ics.uci.edu/ml/datasets/Wine+Quality

I use R to create two scatterplots:

> plot(chlorides~(1/alcohol),data=redwinedata)
> plot(chlorides~alcohol,data=redwinedata)

but both graphs look exactly the same (axes, points, everything). Does anyone know why this is happening?

+4
source share
3 answers

The graph of $ x $ vs $ y $ should not be similar to the graph of $ 1 / x $ against $ y $. I think you made a code error. The code you provided does not convert the predictor.

You need to calculate the variable separately and pass it to the chart or use a function I. The following is an example.

x = runif(100)
y = runif(100)
plot(y ~ x)
plot(y ~ (1/x)) # looks exactly the same. It a plot of y vs. x.....
plot(y ~ I(1/x)) # does not look exactly the same
z = 1/x
plot(y ~ z) # looks just like the last call but not like the plot of y vs. x
+9
source

, ... .

:

plot(dist~speed,cars)
plot(dist~1/speed,cars)

, , ( ~ ), , , , , . , .

GoF_logistic, :

plot(dist~I(1/speed),cars)

( , ), :

with(cars,plot(1/speed,dist))

, "1/x". I() , ; plot(x,y ...) , .

- - plot(dist~(speed^2)) .

[ ANOVA, , , - ( , ). plot(y~x^2) plot(y~1/x) -, , , , ?]

+1

.

-2

Source: https://habr.com/ru/post/1671730/


All Articles