Giter VIP home page Giter VIP logo

insurancerating's People

Contributors

mharinga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

insurancerating's Issues

Decrease the number of simulations (e.g. n_simulations = 100)

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)

Bug in rating_factors1 with smoothed or restricted GLM

bug_report_rating_factors.txt

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)'

Rename/redirect format_table

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:

cat(insight::format_table(x))

and replace 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

Definition of Exposure

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?

add_prediction error for Tweedie glm

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!

Bug in Univariate

bug_report_univariate.txt

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.

avg_premium calculation

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.