climpred.classes.HindcastEnsemble.bootstrap#
- HindcastEnsemble.bootstrap(*, alignment: str, metric: str | Metric, comparison: str | Comparison, dim: str | List[str] | None = None, reference: str | List[str] | None = None, groupby: str | DataArray | None = None, iterations: int | None = None, sig: int = 95, resample_dim: str = 'member', **metric_kwargs: Any | None) Dataset[source]#
Bootstrap with replacement according to Goddard et al. [2013].
- Parameters:
metric – Metric to apply for verification, see metrics
comparison – How to compare to the observations/verification data. See comparisons.
dim – Dimension(s) to apply metric over.
dimis passed on to xskillscore.{metric} and includes xskillscore’smember_dim.dimshould containmemberwhencomparisonis probabilistic but should not containmemberwhencomparison="e2o". Defaults toNonemeaning that all dimensions other thanleadare reduced.reference – Type of reference forecasts with which to verify against. One or more of
["uninitialized", "persistence", "climatology"]. Defaults toNonemeaning no reference. IfNoneor[], returns no p value.alignment – which inits or verification times should be aligned?
“”maximize: maximize the degrees of freedom by slicing
initandverifto a common time frame at each lead."same_inits": slice to a commoninitframe prior to computing metric. This philosophy follows the thought that each lead should be based on the same set of initializations."same_verif": slice to a common/consistent verification time frame prior to computing metric. This philosophy follows the thought that each lead should be based on the same set of verification dates.
iterations – Number of resampling iterations for bootstrapping with replacement. Recommended >= 500.
sig – Significance level in percent for deciding whether uninitialized and persistence beat initialized skill.
resample_dim – dimension to resample from. Default:
"member"."member": select a different set of members from hind"init": select a different set of initializations from hind
groupby – group
initbefore passinginitializedtobootstrap.**metric_kwargs – arguments passed to
metric.
- Returns:
xarray.Datasetwith dimensionsresults(holdingskill,p,low_ciandhigh_ci) andskill(holdinginitialized,persistenceand/oruninitialized):- results=”verify skill”, skill=”initialized”:
mean initialized skill
- results=”high_ci”, skill=”initialized”:
high confidence interval boundary for initialized skill
- results=”p”, skill=”uninitialized”:
p value of the hypothesis that the difference of skill between the initialized and uninitialized simulations is smaller or equal to zero based on bootstrapping with replacement.
- results=”p”, skill=”persistence”:
p value of the hypothesis that the difference of skill between the initialized and persistence simulations is smaller or equal to zero based on bootstrapping with replacement.
References
Goddard et al. [2013]
Example
Continuous Ranked Probability Score (
"crps") comparing every member forecast to the verification ("m2o") over the same initializations ("same_inits") for all leads reducing dimensionmember50 times after resamplingmemberdimension with replacement. Note that dimensioninitremains. Also calculate reference skill for the"persistence","climatology"and"uninitialized"forecast and compare whether initialized skill is better than reference skill: Returns verify skill, probability that reference forecast performs better than initialized and the lower and upper bound of the resample.>>> HindcastEnsemble.bootstrap( ... metric="crps", ... comparison="m2o", ... dim="member", ... iterations=50, ... resample_dim="member", ... alignment="same_inits", ... reference=["persistence", "climatology", "uninitialized"], ... ) <xarray.Dataset> Size: 70kB Dimensions: (skill: 4, results: 4, lead: 10, init: 51) Coordinates: * lead (lead) int32 40B 1 2 3 4 5 6 7 8 9 10 valid_time (lead, init) object 4kB 1956-01-01 00:00:00 ... 2015-01-01 00... init (init) object 408B 1955-01-01 00:00:00 ... 2005-01-01 00:00:00 * skill (skill) <U13 208B 'initialized' ... 'uninitialized' * results (results) <U12 192B 'verify skill' 'p' 'low_ci' 'high_ci' Data variables: SST (skill, results, lead, init) float64 65kB 0.1202 ... 0.07578 Attributes: prediction_skill_software: climpred https://climpred.readthedocs.io/ skill_calculated_by_function: HindcastEnsemble.bootstrap() number_of_members: 10 alignment: same_inits metric: crps comparison: m2o dim: member reference: ['persistence', 'climatology', 'uninitiali... resample_dim: member sig: 95 iterations: 50 confidence_interval_levels: 0.975-0.025