Creates auditor_model_halfnormal
object that can be used for plotting halfnormal plot.
model_halfnormal(object, quant = FALSE, ...) modelFit(object, quant = FALSE, ...)
object | An object of class |
---|---|
quant | if TRUE values on axis are on quantile scale. |
... | other parameters passed do |
An object of the class auditor_model_halfnormal
.
Moral, R., Hinde, J., & Demétrio, C. (2017). Half-Normal Plots and Overdispersed Models in R: The hnp Package.doi:http://dx.doi.org/10.18637/jss.v081.i10
data(titanic_imputed, package = "DALEX") # fit a model model_glm <- glm(survived ~ ., family = binomial, data = titanic_imputed) glm_audit <- audit(model_glm, data = titanic_imputed, y = titanic_imputed$survived)#> Preparation of a new explainer is initiated #> -> model label : lm ( default ) #> -> data : 2207 rows 8 cols #> -> target variable : 2207 values #> -> predict function : yhat.glm will be used ( default ) #> -> predicted values : No value for predict function target column. ( default ) #> -> model_info : package stats , ver. 4.1.1 , task classification ( default ) #> -> predicted values : numerical, min = 0.008128381 , mean = 0.3221568 , max = 0.9731431 #> -> residual function : difference between y and yhat ( default ) #> -> residuals : numerical, min = -0.9628583 , mean = -2.569729e-10 , max = 0.9663346 #> A new explainer has been created!# validate a model with auditor mh <- model_halfnormal(glm_audit)#> Binomial modelmh#> Model label: lm #> Quantiles of Residuals: #> 0% 10% 20% 30% 40% 50% 60% #> -2.5663263 -0.8822712 -0.7406192 -0.6594877 -0.5668733 -0.4933954 -0.3793048 #> 70% 80% 90% 100% #> 0.3573521 0.8379465 1.5982982 2.6043364