jasp-stats / jasp-issues

This repository is solely meant for reporting of bugs, feature requests and other issues in JASP.
58 stars 29 forks source link

Model check - Consider adding the Q-Q plots and histograms based on studentized residuals #562

Open chantelanuit opened 4 years ago

chantelanuit commented 4 years ago
* Enhancement: JASP 0.11.1 only allows the computation of standardized residuals * Purpose: "Studentized deleted residuals (SDRESID), as discussed by Norusis, p. 515, take advantage of the fact that you can see the impact of a case on the slope by calculating a regression with and without the slope. As the name implies the studentized deleted residual is the Studentized residual when the case is excluded from the regression. Norusis argues that you can see departures from regression assumptions more easily with studentized deleted residuals than other residuals. **Fox refers to these residuals as studentized residuals (rstudent in R). Fox considers these to be the appropriate residuals to examine. See Fox (An R and S-Plus Companion to Applied Regression, Thousand Oaks, CA: Sage, 2002, page 192) for a discussion of how these residuals are calculated.**" (source: https://www2.bc.edu/william-stevenson/MB875/mb875_Analyzing%20Residuals.htm) * Use-case: **Is your feature request related to a problem? Please describe.** **Describe the solution you'd like** ``` model.1 <- lm(DV ~ IV, data=xyz) library(MASS) sresid <- studres(model.1) ``` ...then use sresid for building histogram & q-q plot **Describe alternatives you've considered** **Additional context**

Thanks !

chantelanuit commented 4 years ago

Maybe it would be beneficial to also add a dotted normal curve over the histogram of the residuals. In the present version, only a density curve of the data is included (that one use is useful though).

tomtomme commented 7 months ago

@chantelanuit the link above does not work anymore. Could you update?

@Kucharssim @fqixiang What do you think of this request? Seems valid, no?

chantelanuit commented 7 months ago

distribution of studentized residuals

library(MASS)

data(Animals, package="MASS") RegModel.1 <- lm(brain~body, data=Animals) summary(RegModel.1)

sresid <- studres(RegModel.1) hist(sresid, freq=FALSE, main="Distribution of Studentized Residuals") xfit<-seq(min(sresid),max(sresid),length=40) yfit<-dnorm(xfit) lines(xfit, yfit)

chantelanuit commented 7 months ago

Fox (2002) indicates in his book:

"The standard statistics for detecting regression outliers are the studentized residuals for the model" 1

"1. Unfortunately, although the terminology that I employ is the most common, it is not universal. What I call 'studentized residuals' are sometimes termed 'externally studentized residuals' or 'deleted studentized residuals' ". (p. 192).