# calibration

0th

Percentile

##### Probability Calibration Plot

For classification models, this function creates a 'calibration plot' that describes how consistent model probabilities are with observed event rates.

Keywords
hplot
##### Usage
calibration(x, ...)## S3 method for class 'formula':
calibration(x, data = NULL, class = NULL, cuts = 11, subset = TRUE, lattice.options = NULL, ...)## S3 method for class 'calibration':
xyplot(x, data, ...)panel.calibration(...)
##### Arguments
x
a lattice formula (see xyplot for syntax) where the left-hand side of the formula is a factor class variable of the observed outcome and the right-hand side specifies one or model
data
For calibration.formula, a data frame (or more precisely, anything that is a valid envir argument in eval, e.g., a list or an environment) containing values for any variables in the formula, as well as groups
 class a character string for the class of interest cuts the number of splits of the data are used to create the plot. By default, it uses as many cuts as there are rows in data subset An expression that evaluates to a logical or integer indexing vector. It is evaluated in data. Only the resulting rows of data are used for the plot. lattice.options A list that could be supplied to lattice.options ... options to pass through to xyplot or the panel function (not used in calibration.formula). 
 
 Details calibration.formula is used to process the data and xyplot.calibration is used to create the plot.To construct the calibration plot, the following steps are used for each model:The data are split intocuts - 1roughly equal groups by their class probabilitiesthe number of samples with true results equal toclassare determinedthe event rate is determined for each bin xyplot.calibration produces a plot of the observed event rate by the mid-point of the bins. This implementation uses the lattice function xyplot, so plot elements can be changed via panel functions, trellis.par.set or other means. calibration uses the panel function panel.calibration by default, but it can be changed by passing that argument into xyplot.calibration.The folowing elements are set by default in the plot but can be changed by passing new values into xyplot.calibration: xlab = "Bin Midpoint", ylab = "Observed Event Percentage", type = "o", ylim = extendrange(c(0, 100)),xlim = extendrange(c(0, 100)) and panel = panel.calibration Value calibration.formula returns a list with elements:datathe data used for plottingcutsthe number of cutsclassthe event classprobNamesthe names of the model probabilitiesxyplot.calibration returns a lattice object See Also xyplot, trellis.par.set Aliases calibration calibration.formula calibration.default xyplot.calibration panel.calibration Examples data(mdrr) mdrrDescr <- mdrrDescr[, -nearZeroVar(mdrrDescr)] mdrrDescr <- mdrrDescr[, -findCorrelation(cor(mdrrDescr), .5)] inTrain <- createDataPartition(mdrrClass) trainX <- mdrrDescr[inTrain[], ] trainY <- mdrrClass[inTrain[]] testX <- mdrrDescr[-inTrain[], ] testY <- mdrrClass[-inTrain[]] library(MASS) ldaFit <- lda(trainX, trainY) qdaFit <- qda(trainX, trainY) testProbs <- data.frame(obs = testY, lda = predict(ldaFit, testX)$posterior[,1], qda = predict(qdaFit, testX)$posterior[,1]) calibration(obs ~ lda + qda, data = testProbs) calPlotData <- calibration(obs ~ lda + qda, data = testProbs) calPlotData xyplot(calPlotData, auto.key = list(columns = 2)) Documentation reproduced from package caret, version 5.15-052, License: GPL-2 Community examples Looks like there are no examples yet. Post a new example: 
 
 
 R package Rdocumentation.org Created by DataCamp.com 
 Learn R at work MathJax.Hub.Config({ messageStyle: "none", jax: ["input/TeX","output/CommonHTML"], extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"], TeX: { extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] }, tex2jax: { inlineMath: [ ['$','$'], ['\$','\$'] ], displayMath: [ ['$$','$$'] ], processEscapes: true, preview: 'none' } }); var $jq = jQuery.noConflict(); ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[]; p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments) };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o);n.async=1; n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//cdn.datacamp.com/sp/2.9.3.js","snowplow")); var options = { appId: 'rdocumentation', platform: 'web', post: true, discoverRootDomain: true, contexts: { webPage: true, performanceTiming: true } }; options.forceSecureTracker = true; options.postPath = '/spevent'; window.snowplow('newTracker', 'co', "www.datacamp.com", options); window.snowplow('enableActivityTracking', 10, 10); // Ping every 10 seconds after 10 seconds window.snowplow('enableLinkClickTracking'); window.snowplow('trackPageView', null, [ { schema: 'iglu:com.datacamp/user/jsonschema/1-0-0', data: { anonId:$jq.cookie('dc_aid'), } } ]); var config = { forms: { whitelist: ["snowplow_tracked"] }, fields: { blacklist: ['password', 'password_confirmation'] } }; window.snowplow('enableFormTracking', config); (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o);a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-41577880-1', 'rdocumentation.org'); ga('send', 'pageview');