| binaryloess | R Documentation | 
This function plots a smoothed line of how the average value of Y changes with X in order to check functional form for logistic regression.
binaryloess(x, y, scale = c("logit", "linear"), span = 0.7, weights = NULL, ...)
| x | tbdx | 
| y | tbdy | 
| scale | tbdscale | 
| span | smoothing parameter, passed to loess. If less than 1, the neighbourhood includes proportion a of the points. If greater than 1, all points are used, with the maximum distance assumed to be a^(1/p) times the actual maximum distance for p explanatory variables.
 | 
| weights | sampling weights, passed to loess | 
| ... | passed to plotting function | 
This function comes from Jonathan Bartlett ()https://thestatsgeek.com/2014/09/13/checking-functional-form-in-logistic-regression-using-loess/).
set.seed(1234)
n <- 1000
x <- rnorm(n)
xb <- -2+x
pr <- exp(xb)/(1+exp(xb))
y=rbern(n, pr)
par(mfrow=c(1,2))
binaryloess(x, y, scale = "logit", span = 0.7, weights = NULL, ylab="logit(p)")
binaryloess(x, y, scale = "linear", span = 0.7, weights = NULL, ylab="prob")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.