Skip to content

Commit 93bba56

Browse files
authored
Uncertainty estimates: Move common docu to template (#280)
1 parent a327faf commit 93bba56

4 files changed

+50
-18
lines changed

R/f_interface_predict_clvfittedspending.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
#'
2828
#' To predict for new customers, the output of \link[CLVTools:newcustomer]{newcustomer.spending} has to be given to \code{newdata}. See examples.
2929
#'
30+
#'
31+
#' @template template_predict_uncertainty
32+
#'
33+
#'
3034
#' @seealso models to predict spending: \link{gg}.
3135
#' @seealso models to predict transactions: \link{pnbd}, \link{bgnbd}, \link{ggomnbd}.
3236
#' @seealso \code{\link[CLVTools:predict.clv.fitted.transactions]{predict}} for transaction models

R/f_interface_predict_clvfittedtransactions.R

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,8 @@
7676
#' To account for time units which are not annual, the continuous rate has to be further adjusted
7777
#' to delta=ln(1+d)/k, where k are the number of time units in a year.
7878
#'
79-
#' @section Uncertainty Estimates:
80-
#' Bootstrapping is used to provide confidence intervals of all predicted metrics.
81-
#' These provide an estimate of parameter uncertainty.
82-
#' To create bootstrapped data, customer ids are sampled with replacement until reaching original
83-
#' length and all transactions of the sampled customers are used to create a new \code{clv.data} object.
84-
#' A new model is fit on the bootstrapped data with the exact same specification as used when
85-
#' fitting \code{object} (incl. start parameters and `optimx.args`) and it is then used to predict on this data.
86-
#'
87-
#' It is highly recommended to fit the original model (\code{object}) with a robust optimization
88-
#' method, such as Nelder-Mead (\code{optimx.args=list(method='Nelder-Mead')}).
89-
#' This ensures that the model can also be fit on the bootstrapped data.
90-
#'
91-
#' All prediction parameters, incl \code{prediction.end} and \code{continuous.discount.factor}, are forwarded
92-
#' to the prediction on the bootstrapped data.
93-
#' Per customer, the boundaries of the confidence intervals of each predicted metric are the
94-
#' sample quantiles (\code{quantile(x, probs=c((1-level)/2, 1-(1-level)/2)}).
95-
#'
96-
#' See \link{clv.bootstrapped.apply} to create a custom bootstrapping procedure.
9779
#'
80+
#' @template template_predict_uncertainty
9881
#'
9982
#'
10083
#' @seealso models to predict transactions: \link{pnbd}, \link{bgnbd}, \link{ggomnbd}.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#'
2+
#'
3+
#'
4+
#' @section Uncertainty Estimates:
5+
#' Bootstrapping is used to provide confidence intervals of all predicted metrics.
6+
#' These provide an estimate of parameter uncertainty.
7+
#' To create bootstrapped data, customer ids are sampled with replacement until reaching original
8+
#' length and all transactions of the sampled customers are used to create a new \code{clv.data} object.
9+
#' A new model is fit on the bootstrapped data with the exact same specification as used when
10+
#' fitting \code{object} (incl. start parameters and `optimx.args`) and it is then used to predict on this data.
11+
#'
12+
#' It is highly recommended to fit the original model (\code{object}) with a robust optimization
13+
#' method, such as Nelder-Mead (\code{optimx.args=list(method='Nelder-Mead')}).
14+
#' This ensures that the model can also be fit on the bootstrapped data.
15+
#'
16+
#' All prediction parameters, incl \code{prediction.end} and \code{continuous.discount.factor}, are forwarded
17+
#' to the prediction on the bootstrapped data.
18+
#' Per customer, the boundaries of the confidence intervals of each predicted metric are the
19+
#' sample quantiles (\code{quantile(x, probs=c((1-level)/2, 1-(1-level)/2)}).
20+
#'
21+
#' See \link{clv.bootstrapped.apply} to create a custom bootstrapping procedure.
22+
#'
23+
#'
24+
#'

man/predict.clv.fitted.spending.Rd

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)