Skip to content

Releases: leeper/prediction

CRAN Patch

22 May 10:19
Compare
Choose a tag to compare

This is a patch to address failing tests on CRAN.

CRAN Release

12 Apr 04:36
Compare
Choose a tag to compare

User-visible changes

  • Changed internal behavior of build_datalist(). The function now returns an an at_specification attribute, which is a data frame representation of the at argument.
  • The at argument in build_datalist() now accepts a data frame of combinations for limiting the set of levels.
  • build_datalist() gains an as.data.frame argument, which - if TRUE - returns a stacked data frame rather than a list. This argument is now used internally in most prediction() functions in an effort to improve performance. (#18)
  • Most prediction() methods gain a (experimental) calculate_se argument, which regulates whether to calculate standard errors for predictions. Setting to FALSE can improve performance if they are not needed.
  • Added a summary.prediction() method to interact with the average predicted values that are printed when at != NULL.

Support for new model classes

  • Added prediction.knnreg() method for "knnreg" objects from caret. (#1)
  • Added prediction.gausspr() method for "gausspr" objects from kernlab. (#1)
  • Added prediction.ksvm() method for "ksvm" objects from kernlab. (#1)
  • Added prediction.kqr() method for "kqr" objects from kernlab. (#1)
  • Added prediction.earth() method for "earth" objects from earth. (#1)
  • Added prediction.rpart() method for "rpart" objects from rpart. (#1)
  • Added prediction.glmML() method for "glimML" objects from aod. (#1)
  • Added prediction.glmQL() method for "glimQL" objects from aod. (#1)
  • Added prediction.truncreg() method for "truncreg" objects from truncreg. (#1)
  • Noted implicit support for "tobit" objects from AER. (#1)
  • Added prediction.bruto() method for "bruto" objects from mda. (#1)
  • Added prediction.fda() method for "fda" objects from mda. (#1)
  • Added prediction.mars() method for "mars" objects from mda. (#1)
  • Added prediction.mda() method for "mda" objects from mda. (#1)
  • Added prediction.polyreg() method for "polyreg" objects from mda. (#1)
  • Added prediction.speedglm() and prediction.speedlm() methods for "speedglm" and "speedlm" objects from speedglm. (#1)
  • Added prediction.bigLm() method for "bigLm" objects from bigFastlm. (#1)
  • Added prediction.biglm() and prediction.bigglm() methods for "biglm" and "bigglm" objects from biglm, including those based by "ffdf" from ff. (#1)
  • Added prediction.train() method for "train" objects from caret. (#1)
  • Due to a change in gam_1.15, prediction.gam() is now prediction.Gam() for "Gam" objects from gam. (#1)

Expanded functionality and new methods

19 Apr 09:39
Compare
Choose a tag to compare

Features

This release primarily expands the functionality of prediction() and adds support for additional new model classes. Specifically:

  • prediction() methods gain an at argument (like in margins::margins()) so that predicted values can be calculated for counterfactual datasets with specified values of covariates. (#13)
  • prediction() methods for models of multilevel outcomes (e.g., ordered probit, etc.) gain a category argument to be used to dictate which level is expressed as the "fitted" column. Predicted probabilities for all levels are returned as named columns; this simply toggles which column is additionally included as the "fitted" column. (#14)

New model classes supported:

  • Added prediction.zeroinfl() method for "zeroinfl" objects from pscl. (#1)
  • Added prediction.hurdle() method for "hurdle" objects from pscl. (#1)
  • Added prediction.lme() method for "lme" and "nlme" objects from nlme. (#1)
  • Added prediction.mnp() method for "mnp" objects from MNP. (#1)
  • Added prediction.mnlogit() method for "mnlogit" objects from mnlogit. (#1)
  • Added prediction.gee() method for "gee" objects from gee. (#1)
  • Added prediction.lqs() method for "lqs" objects from MASS. (#1)
  • Added prediction.mca() method for "mca" objects from MASS. (#1)
  • Added prediction.plm() method for "plm" objects from plm. (#1)
  • Added prediction.princomp() method for "princomp" objects from stats. (#1)
  • Added prediction.ppr() method for "ppr" objects from stats. (#1)
  • Added prediction.naiveBayes() method for "naiveBayes" objects from e1071. (#1)
  • Added prediction.rlm() method for "rlm" objects from MASS. (#1)
  • Added prediction.qda() method for "qda" objects from MASS. (#1)
  • Added prediction.lda() method for "lda" objects from MASS. (#1)
  • Noted (built-in) support for "brglm" objects from brglm via the prediction.glm() method. (#1)
  • Documented prediction.merMod().

Other changes and bug fixes

  • find_data() now respects the subset argument in an original model call. (#15)
  • find_data() now respects the na.action argument in an original model call. (#15)
  • find_data() now gracefully fails when a model is specified without a formula. (#16)
  • prediction() methods no longer add a "fit" or "se.fit" class to any columns. Fitted values are identifiable by the column name only.
  • Made mean_or_mode() and median_or_mode() S3 generics and added .data.frame() methods for both.
  • Fixed a bug in mean_or_mode() and median_or_mode() where incorrect factor levels were being returned.
  • Expanded test suite considerably and updated CONTRIBUTING.md to reflect expected test-driven development.

Expanded model support and improved data return

01 Mar 11:32
Compare
Choose a tag to compare

This release includes support for a number of additional model classes, bringing the complete list to:

  • "lm" from stats::lm()
  • "glm" from stats::glm(), MASS::glm.nb(), glmx::glmx(), glmx::hetglm()
  • "ar" from stats::ar()
  • "Arima" from stats::arima()
  • "arima0" from stats::arima0()
  • "betareg" from betareg::betareg()
  • "clm" from ordinal::clm()
  • "coxph" from survival::coxph()
  • "crch" from crch::crch()
  • "gam" from gam::gam()
  • "gls" from nlme::gls()
  • "hxlr" from crch::hxlr()
  • "ivreg" from AER::ivreg()
  • "loess" from stats::loess()
  • "nls" from stats::nls()
  • "nnet" from nnet::nnet(), nnet::multinom()
  • "polr" from MASS::polr()
  • "rq" from quantreg::rq()
  • "selection" from sampleSelection::selection()
  • "survreg" from survival::survreg()
  • "svm" from e1071::svm()
  • "svyglm" from survey::svyglm()

The release also attempts to better standardize the response object returned by prediction(), so that it always includes the original data (being passed at data or retrieved by find_data()). This should make it easier to pass the output of prediction() directly into further data manipulation or plotting functions. find_data() itself is now also generic, making it easier to add model-specific versions.

Various utility functions have also been added:

  • seq_range(), generates a sequence of n values within a specified range
  • build_datalist() constructs a list of data frames with specified value modifications (an elaboration of expand.grid()
  • mean_or_mode() and median_or_mode() provide simply ways of generating a summary statistic from both factor and numeric variables. Uses cases are of the form: lapply(mtcars, mean_or_mode), etc.

The test suite has also been expanded.