mharinga / insurancerating Goto Github PK
View Code? Open in Web Editor NEWR-package for actuarial pricing
Home Page: https://mharinga.github.io/insurancerating
R-package for actuarial pricing
Home Page: https://mharinga.github.io/insurancerating
Thank you for developing your insurancerating
project, and also for removing code execution yesterday.
premiums4 <- model_data(burn_restricted3) |>
construct_model_points() |>
add_prediction(burn_restricted3)
head(premiums4)
It caused a consistent error:
"j (the 2nd argument inside [...]) is a single symbol but column name '%1$s' is not found. If you intended to select columns using a variable in calling scope, please try DT [, ..%1$s]. The .. prefix conveys one-level-up similar to a file system path."
It would be nice in chunck
```{r normalitysim, message = FALSE, eval = TRUE}
check_residuals(model_freq1, n_simulations = 1000) |>
autoplot()
set this parameter to less than 1000,for example, n_simulations = 100. Since it is unclear why the phrase follows
โIf that is the case, it could help to increase the number of simulations (e.g. $n = 1000$).โ
Moreover, with n_simulations = 1000, the execution time of this code is long on some old PCs or Posit Cloud.
I dare to offer you the most compact code, instead of creating two additional variables:
MTPL2 |> # use an anonymous function
( \(d) mutate(d, year = sample(2016:2019, nrow(d), replace = TRUE)) )() |>
univariate(x = area, nclaims = nclaims,
exposure = exposure, by = year) |>
autoplot(show_plots = 1)
The rating_factors1 function returns all smoothed and restricted coefficients equal to 1 when used on a 'refitsmooth' or 'refitrestricted' class of GLM.
I've added a code example as attachment,
this is a bug in the insurancerating::rating_factors1() function in version 0.7.2.
In line 160 of model_rating_factors.R:
'uit$values <- ifelse(is.na(uit$pvalues), 0, uit$values)'
I think should be:
'uit$pvalues <- ifelse(is.na(uit$pvalues), 0, uit$pvalues)'
Hi Martin,
we're revising our API, and thereby want to rename some functions, in particular insight::format_table()
should become insight::export_table()
in the long run, while we feel that insight::parameters_table()
should be actually named format_table()
.
Thus, can you please change this code line:
insurancerating/R/model_performance.R
Line 61 in 38968d2
insight::format_table()
with insight::export_table()
? The updated insight is on CRAN and has both names as aliases, so submitting an update for your package should work without problems.
This is no urgent request, but maybe you can try to update your package by mid of January 2021, so we can plan a smooth transition in renaming our functions from February 2021 on...
Daniel
Thanks for awesome package. Sorry for asking so basic question - "What's the definition of Exposure in your example?". Is it the expected insured claim amount per claim?
Hi MHaringa, thank you for building this package, it is very useful for our insurance application. I have just one question - it appears that the add_prediction function works for glms fitted with poisson or gamma, but when I tried to fit a tweedie model, the add_prediction gives an error about names not the same length as the vector. Is there any way to fix it or am I not supposed to use a Tweedie distribution for this?
Thanks a lot!
The univariate function in version 0.7.2 of insurancerating gives a datatable error when one of the categories of function argument column 'x' has 0 total 'nclaims' or 0 total 'severity'.
I've attached a text file with a code example.
Fitting GAM for pure premium is not documented, so I'm not sure if it's officially supported. Regardless I gave a try.
This may not make huge difference if most of exposures are 1, but thought there would be a better way to calculate aggregated pure premium before fitting GAM.
Currrently:
df <- aggregate(list(exposure = df$exposure,
pure_premium = df$pure_premium),
by = list(x = df$x),
FUN = sum,
na.rm = TRUE,
na.action = NULL)
df$avg_premium <- df$pure_premium / df$exposure
I wonder if it's better to calculate avg_premium for each x by doing sum(pure_premium * exposure) / sum(exposure) instead of sum(pure_premium) / sum(exposure).
Separate question: How is confidence interval in the autoplot for GAM calculated? It seems to use aggregated data without underlying data points. Does it use exposure for CI or look at variability in the underlying data?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.