Correlation and Regression
Correlation and Regression
RETENTION 🟧🟧🟧🟧🟧🟧
NEXT REP. October 29, 2023
notes
R-STUDIO COMMANDS
1. Scatterplot
>cor(X,Y)
3. Regression line:
fit<-lm(Y~X)
* intercept → slope of the function
>abline(fit)
>abline(lm(Y~X)
To calculate the score of a student that got a 70 on the midterm for example:
>summary(lm(Y~X))
* hay que hacer la raiz cuadrada del valor, no me acuerdo para qué
RESIDUAL PLOT
FIRST WAY
>identify(Y~X) (And you can click on the cases you want to identify as outliers
in the scatter plot con el ratón del ordenador). You will see clearly which are
the outliers.
Press "esc" TWICE to get out of the screen and it will show the values x that
you have clicked on.
SECOND WAY
>plot(Y~X, col=”lightblue”)
>text(Y~X, labels=rownames(dataset))
To eliminate the cases, now assign to a new data frame the info
without the outliers: