Skip to content

Commit a3f8d10

Browse files
committed
Add auditorData
1 parent b0d00d9 commit a3f8d10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1114
-25
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ materials
1212
jupyter-notebooks
1313
^codecov\.yml$
1414
binder
15+
^_pkgdown\.yml$

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# auditor 0.3.0
2-
* Five new vignettes with examples.
2+
* New five vignettes with examples.
33
* Second pipeline with new computational functions: `modelResiduals()`, `modelEvaluation()`, `modelFit()`, `modelPerformance()`, `observationInfluence()`.
44
* New plot: `plotResidualBoxplot()`
55

R/auditorData.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#' @title auditorData
2+
#' @description The auditor Data is an artificial data set.
3+
#' It consists of 2000 observations.
4+
#' First four of simulated variables are treated as continuous while the fifth one is categorical.
5+
#'
6+
#' @name auditorData
7+
#' @docType data
8+
#'
9+
#' @examples
10+
#' data("auditorData", package = "auditor")
11+
#' head(auditorData)
12+
NULL

R/modelEvaluation.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
#' @param object An object of class ModelAudit.
66
#' @param variable Optional. Name of variable to order residuals. If value is NULL data order is taken. If value is "Predicted response" or "Fitted values" then data is ordered by fitted values. If value is "Observed response" the data is ordered by a vector of actual response (\code{y} parameter passed to the \code{\link{audit}} function).
77
#'
8+
#' @examples
9+
#' library(mlbench)
10+
#' data("PimaIndiansDiabetes")
11+
#' Pima <- PimaIndiansDiabetes
12+
#' Pima$diabetes <- ifelse(Pima$diabetes == "pos", 1, 0)
13+
#' glm_model <- glm(diabetes~., family=binomial, data=Pima)
14+
#' glm_au <- audit(glm_model, data = Pima, y = Pima$diabetes)
15+
#'
16+
#' modelEvaluation(glm_au)
17+
#'
18+
#'
819
#' @export
920
modelEvaluation <- function(object, variable = NULL){
1021
if(!("modelAudit" %in% class(object))) stop("The function requires an object created with audit().")

R/modelFit.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
#' @param quant.scale if TRUE values on axis are on quantile scale.
77
#' @param ... other parameters passed do \code{\link[hnp]{hnp}} function.
88
#'
9+
#' @examples
10+
#' library(MASS)
11+
#' model.glm <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
12+
#' audit.glm <- audit(model.glm)
13+
#'
14+
#' mf.glm <- modelFit(audit.glm)
15+
#'
916
#' @export
1017
modelFit <- function(object, quant.scale = FALSE, ...){
1118
if(!("modelAudit" %in% class(object))) stop("The function requires an object created with audit().")

R/modelPerformance.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
#' @param new.score A named list of functions that take one argument: object of class ModelAudit and return a numeric value. The measure calculated by the function should have the property that lower score value indicates better model.
88
#' @param ... other parameters.
99
#'
10+
#'
11+
#' @examples
12+
#' library(MASS)
13+
#' model.glm <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
14+
#' audit.glm <- audit(model.glm)
15+
#'
16+
#' mp.glm <- modelPerformance(audit.glm)
17+
#'
18+
#'
1019
#' @export
1120
modelPerformance <- function(object, scores = c("MAE", "MSE", "REC", "RROC"), new.score = NULL){
1221
if(!("modelAudit" %in% class(object))) stop("The function requires an object created with audit().")

R/modelResiduals.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
#' @param object An object of class ModelAudit.
66
#' @param variable Optional. Name of variable to order residuals. If value is NULL data order is taken. If value is "Predicted response" or "Fitted values" then data is ordered by fitted values. If value is "Observed response" the data is ordered by a vector of actual response (\code{y} parameter passed to the \code{\link{audit}} function).
77
#'
8+
#' @examples
9+
#' library(MASS)
10+
#' model.glm <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
11+
#' audit.glm <- audit(model.glm)
12+
#'
13+
#' mr.glm <- modelResiduals(audit.glm)
14+
#'
815
#' @export
916
modelResiduals <- function(object, variable = NULL){
1017
if(!("modelAudit" %in% class(object))) stop("The function requires an object created with audit().")

R/observationInfluence.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
#' @param object An object of class ModelAudit.
66
#' @param ... other parameters.
77
#'
8+
#' @examples
9+
#' library(MASS)
10+
#' model.glm <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
11+
#' audit.glm <- audit(model.glm)
12+
#'
13+
#' oi.glm <- observationInfluence(audit.glm)
14+
#'
815
#' @export
916
observationInfluence <- function(object, ...){
1017

_pkgdown.yml

Whitespace-only changes.

data/auditorData.rda

48.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)