Package: catmodeling 0.0.1

Stephen Jewson

catmodeling: Catastrophe Model Simulation and Adjustment

Manipulation of catastrophe model outputs, including tasks such as simulating year loss tables (YLTs) from event loss tables (ELTs), adjusting the frequencies of events in YLTs to create new YLTs, applying catastrophe exceedance of loss contracts (catXL), applying hours clauses, and calculating diagnostics from ELTs and YLTs, such as average annual loss and exceedance probability curves. Frequency adjustment routines are based on the paper "A new simulation algorithm for more precise estimates of change in catastrophe risk models, with application to hurricanes and climate change", Jewson, S. (2023); <doi:10.1007/s00477-023-02409-0>. Uses the compiled language 'Rust' in places and so requires a Rust compiler to be installed, or a binary installation.

Authors:Stephen Jewson [aut, cre]

catmodeling_0.0.1.tar.gz
catmodeling_0.0.1.zip(r-4.7-x86_64)
catmodeling_0.0.1.tar.gz(r-4.7-arm64)catmodeling_0.0.1.tar.gz(r-4.7-x86_64)catmodeling_0.0.1.tar.gz(r-4.6-arm64)catmodeling_0.0.1.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html
DESCRIPTION
card.svg |card.png
catmodeling/json (API)

# Install 'catmodeling' in R:
install.packages('catmodeling', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/stephenjewson/catmodeling/issues

On CRAN:

Conda:

rustcargo

1.00 score 53 exports 18 dependencies

Last updated from:e2621c6c84. Checks:6 OK, 2 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK143
linux-devel-x86_64OK158
source / vignettesOK196
linux-release-arm64OK144
linux-release-x86_64OK158
windows-devel-arm64FAIL184
windows-devel-x86_64OK235
wasm-releaseFAIL167

Exports:bootstrap_ep_uncertaintycalc_beta_paramscatxlcompare_distance_routinesdefineregionelt_add_nahu_catelt_collapse_regionselt_diagnostics_aaeaalelt_diagnostics_aaeaal_by_catelt_diagnostics_aaeaal_with_adjelt_diagnostics_epcurveselt_diagnostics_epcurves_with_adjelt_rate_adjustments_cat_2_eventelt_rate_adjustments_regcat_2_eventfiletesthours_clausehours_clause_apply_part2hours_clause_wrapper_ylthours_clause_write_settingsinput_checksmake_2_ep_by_sortingmake_eltmake_ep_by_sortingmake_yltnahu_define_gmst_scenariosnahu_define_k2020_zenodo_landfall_adjnahu_k2020_rates_interpolationnahu_write_settingsnahu_ylt_surgerytemplatewhatregwriteNresults2csvws2catfylt_add_cat_2_longyltylt_add_region_2_longyltylt_check_for_2_events_on_same_dayylt_check_for_same_events_in_one_yearylt_diagnostics_aaeaalylt_diagnostics_aaeaal_by_cat_change_printfylt_diagnostics_aaeaal_by_cat_printfylt_diagnostics_aaeaal_by_catfylt_diagnostics_aaeaal_change_printfylt_diagnostics_aaeaal_printfylt_diagnostics_loss_thresholdsylt_diagnostics_nchangesylt_long2shortylt_rate_adjustments_cat_2_rowylt_rate_adjustments_catreg_2_rowylt_write2results2csvyltsimyltsim_incyltsurgeryyltsurgery_groups

Dependencies:clidplyrgenericsgeospheregluelifecyclemagrittrpillarpkgconfigpracmaR6Rcpprlangtibbletidyselectutf8vctrswithr

Readme and manuals

Help Manual

Help pageTopics
Adds two vectors element-wise up to length n.addvectors
Bootstrap EP uncertaintybootstrap_ep_uncertainty
Calculate Beta Distribution Parameters for a List of Eventscalc_beta_params
Applies CatXL Layers to a YLTcatxl
Function for testing that R and Rust give the same distances between eventscompare_distance_routines
Defines the 19 Global Regions from My BAMS Paperdefineregion
Adds a cat column to an elt, calculated from wind speed.elt_add_nahu_cat
For an ELT with multiple occurrences of each event, collapses to 1 per eventelt_collapse_regions
Calculates AAE and AAL from an ELTelt_diagnostics_aaeaal
Calculates AAE and AAL from an ELT, and by catelt_diagnostics_aaeaal_by_cat
Calculates AAE and AAL from an ELTelt_diagnostics_aaeaal_with_adj
Converts ELT rates into plotting positions for CEP, EEF and OEPelt_diagnostics_epcurves
Converts ELT rates into plotting positions for CEP, EEF and OEP, with rate adjustmentselt_diagnostics_epcurves_with_adj
Converts rate adjustments from cat to event, for events in an ELTelt_rate_adjustments_cat_2_event
Converts rate adjustments from region and cat to event, for events in an ELTelt_rate_adjustments_regcat_2_event
Testing using filesfiletest
Applies an hours clause to a long YLT, and returns a YLThours_clause
Function that loops through events in one year and applies an hours clausehours_clause_apply_part2
Applies an hours clause to a long YLT stored in csv file, and returns the adjusted YLT in memory and to a csv filehours_clause_wrapper_ylt
When using 'hours_clause_wrapper', writes out the settings to a file.hours_clause_write_settings
Importsimports
Checks the columns in an input data frame.input_checks
Make 2 EP curves by sorting lossesmake_2_ep_by_sorting
Make an ELT in memorymake_elt
Make an EP curve by sorting lossesmake_ep_by_sorting
Make an YLT in memorymake_ylt
Defines 4 GMST Scenariosnahu_define_gmst_scenarios
Define Jewson landfall rates Scenarios from the BAMS papernahu_define_k2020_zenodo_landfall_adj
Interpolates rates in timenahu_k2020_rates_interpolation
Writes out settings to file for 'nahu_ylt_surgery'nahu_write_settings
An example workflow for applying 'ylt_surgery_groups' or 'ylt_surgery_groups' to NAHU.nahu_ylt_surgery
Function to calculate the Haversine distance between two points. This matches the functionality of geosphere::distHaversine in R.rust_dist_haversine
Return string '"Hello world!"' to R. Just a test.rust_hello_world
Hours clause function For a given start event, calculates all possible hours clauses, returns new losses AND a counterrust_hours_clause_apply_part2
Square an integer. Just an example.rust_square
Stops code intentionally, with message that says thatstopi
A template for R codetemplate
Converts US state and country region abbreviations into numbers from 1 to 7.whatreg
Writes results from N YLTs to csv format.writeNresults2csv
Convert windspeed in knots into a generalized version of the SSHWS category.ws2catf
Adds a cat column to a long ylt, based on windspeedylt_add_cat_2_longylt
Adds a region column to a longylt, based on the lat-lons already in the longyltylt_add_region_2_longylt
Checks a YLT for two events on the same dayylt_check_for_2_events_on_same_day
Checks a YLT for the same event occurring twice in one yearylt_check_for_same_events_in_one_year
Long YLT Diagnosticsylt_diagnostics_aaeaal
Prints changes in AAE and AAL from a two YLTs to the screenylt_diagnostics_aaeaal_by_cat_change_printf
Prints AAE and AAL from a YLT to the screenylt_diagnostics_aaeaal_by_cat_printf
Calculates YLT AAE and AAL by Catylt_diagnostics_aaeaal_by_catf
Prints changes in AAE and AAL from a two longylts to the screenylt_diagnostics_aaeaal_change_printf
Prints AAE and AAL from a Long YLT to the screenylt_diagnostics_aaeaal_printf
Counts number of events per year above loss thresholdsylt_diagnostics_loss_thresholds
Sees how many years have changed between a YLT and an adjusted YLTylt_diagnostics_nchanges
Calculate a Short YLT from a Long YLTylt_long2short
Makes rates adjustments by event, for events in a YLTylt_rate_adjustments_cat_2_row
Makes rates adjustments by event, for events in a YLTylt_rate_adjustments_catreg_2_row
Writes results from 2 YLTs to csv format.ylt_write2results2csv
Simulates a long YLT from a Poisson ELTyltsim
Simulates an Adjusted long YLT using Incremental Simulation, based on an input ELT and long YLTyltsim_inc
Adjusts a long YLT to make a new long YLT using the surgery algorithmyltsurgery
Adjusts a long YLT to make a new long YLT using the grouped surgery algorithmyltsurgery_groups