https://github.com/DylanBrow/rate_capping_loss
https://github.com/DylanBrow/rate_capping_loss
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/DylanBrow/rate_capping_loss
- Owner: DylanBrow
- Created: 2022-10-20T15:30:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-05T13:28:17.000Z (almost 3 years ago)
- Last Synced: 2024-11-13T16:40:00.834Z (7 months ago)
- Size: 1.73 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - DylanBrow/rate_capping_loss - (HTML)
README
# Rate Capping Worksheet Loss Forecast
### `sql/base_lr.sql`
`sql/base_lr.sql` computes the base loss ratios by tenure that are used in the original version of the worksheet. These are the loss ratios to which the relativities computed in `disruption_LRR.Rmd` are to be applied. These loss ratios are derived from the six-month rolling OLLR with tenure assumptions applied (15% t1 → t2, 3% thereafter through t5).### `disruption_LRR.Rmd`
`disruption_LRR.Rmd` does the following:
1. Reads in the "raw data" tab from the rate capping worksheet (expected to contain finalized `soure_premium` and `target_premium` by `quote_id`).
2. Combines these premia with loss information from `EDW.fact_financials_accumulating`.
3. Fits a monotonic spline (using the [scam](https://cran.r-project.org/web/packages/scam/scam.pdf) package) in a Tweedie GAM using rate change to predict loss ratio.
4. Uses this fit to get a loss ratio relativity that can then be used to segment the forecast loss ratio by premium disruption.
5. Outputs the loss ratio relativity predictions in both a lookup table (visualized in Exhibit B) and by `quote_id`.#### State Update Instructions
Update the cell containing the header "User-defined Inputs"#### SQL Connection
1. Ensure there is a config file in the path "~/.pg_service.conf"
2. Here is how to structure your config file:
[dw]
host=data-warehouse.joinroot.com
port=5439
dbname=root
user=
password=#### Parameters
Disruption at the top and bottom of the exhibits is grouped to eliminate small volume bands.
* `MIN_RATE_CHANGE_FOR_CUVE_EXHIBIT` - The lower end of the bottom disruption band in Exhibit A.
* `MAX_RATE_CHANGE_FOR_CUVE_EXHIBIT` - The lower end of the top disruption band in Exhibit A.
* `RATE_CHANGE_GRANULARITY_FOR_EXHIBIT` - Width of disruption bands in Exhibit A.
* `MAX_SOURCE_VALUE` - Max value eligible to be printed on the y-axis of the left graph in Exhibit A.⚠️ **Note:** Be careful to set the correct as of date and exposure window (previous year) when pulling data from FFA!
#### Exhibits / Example
The following exhibits are the result of using the "raw data" tab in the Maryland run of original worksheet in Jan. 2022 (`example/md_raw_data.csv`).
###### Exhibit A
###### Exhibit B
