Skip to content

Commit

Permalink
Add auditorData
Browse files Browse the repository at this point in the history
  • Loading branch information
agosiewska committed Aug 26, 2018
1 parent b0d00d9 commit a3f8d10
Show file tree
Hide file tree
Showing 47 changed files with 1,114 additions and 25 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ materials
jupyter-notebooks
^codecov\.yml$
binder
^_pkgdown\.yml$
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# auditor 0.3.0
* Five new vignettes with examples.
* New five vignettes with examples.
* Second pipeline with new computational functions: `modelResiduals()`, `modelEvaluation()`, `modelFit()`, `modelPerformance()`, `observationInfluence()`.
* New plot: `plotResidualBoxplot()`

Expand Down
12 changes: 12 additions & 0 deletions R/auditorData.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#' @title auditorData
#' @description The auditor Data is an artificial data set.
#' It consists of 2000 observations.
#' First four of simulated variables are treated as continuous while the fifth one is categorical.
#'
#' @name auditorData
#' @docType data
#'
#' @examples
#' data("auditorData", package = "auditor")
#' head(auditorData)
NULL
11 changes: 11 additions & 0 deletions R/modelEvaluation.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
#' @param object An object of class ModelAudit.
#' @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).
#'
#' @examples
#' library(mlbench)
#' data("PimaIndiansDiabetes")
#' Pima <- PimaIndiansDiabetes
#' Pima$diabetes <- ifelse(Pima$diabetes == "pos", 1, 0)
#' glm_model <- glm(diabetes~., family=binomial, data=Pima)
#' glm_au <- audit(glm_model, data = Pima, y = Pima$diabetes)
#'
#' modelEvaluation(glm_au)
#'
#'
#' @export
modelEvaluation <- function(object, variable = NULL){
if(!("modelAudit" %in% class(object))) stop("The function requires an object created with audit().")
Expand Down
7 changes: 7 additions & 0 deletions R/modelFit.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
#' @param quant.scale if TRUE values on axis are on quantile scale.
#' @param ... other parameters passed do \code{\link[hnp]{hnp}} function.
#'
#' @examples
#' library(MASS)
#' model.glm <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
#' audit.glm <- audit(model.glm)
#'
#' mf.glm <- modelFit(audit.glm)
#'
#' @export
modelFit <- function(object, quant.scale = FALSE, ...){
if(!("modelAudit" %in% class(object))) stop("The function requires an object created with audit().")
Expand Down
9 changes: 9 additions & 0 deletions R/modelPerformance.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
#' @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.
#' @param ... other parameters.
#'
#'
#' @examples
#' library(MASS)
#' model.glm <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
#' audit.glm <- audit(model.glm)
#'
#' mp.glm <- modelPerformance(audit.glm)
#'
#'
#' @export
modelPerformance <- function(object, scores = c("MAE", "MSE", "REC", "RROC"), new.score = NULL){
if(!("modelAudit" %in% class(object))) stop("The function requires an object created with audit().")
Expand Down
7 changes: 7 additions & 0 deletions R/modelResiduals.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
#' @param object An object of class ModelAudit.
#' @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).
#'
#' @examples
#' library(MASS)
#' model.glm <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
#' audit.glm <- audit(model.glm)
#'
#' mr.glm <- modelResiduals(audit.glm)
#'
#' @export
modelResiduals <- function(object, variable = NULL){
if(!("modelAudit" %in% class(object))) stop("The function requires an object created with audit().")
Expand Down
7 changes: 7 additions & 0 deletions R/observationInfluence.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
#' @param object An object of class ModelAudit.
#' @param ... other parameters.
#'
#' @examples
#' library(MASS)
#' model.glm <- glm(Postwt ~ Prewt + Treat + offset(Prewt), family = gaussian, data = anorexia)
#' audit.glm <- audit(model.glm)
#'
#' oi.glm <- observationInfluence(audit.glm)
#'
#' @export
observationInfluence <- function(object, ...){

Expand Down
Empty file added _pkgdown.yml
Empty file.
Binary file added data/auditorData.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/articles/model_evaluation_audit.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/articles/model_fit_audit.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/model_performance_audit.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/articles/model_residuals_audit.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions docs/articles/observation_influence_audit.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pandoc: 1.19.2.1
pkgdown: 1.1.0
pkgdown_sha: ~
pkgdown: 1.1.0.9000
pkgdown_sha: b2798656f04ce282edea3e12734ba5588c6acd6e
articles:
model_evaluation_audit: model_evaluation_audit.html
model_fit_audit: model_fit_audit.html
Expand Down
151 changes: 151 additions & 0 deletions docs/reference/auditorData.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a3f8d10

Please sign in to comment.