Skip to content

Commit

Permalink
clmplus package is complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
gpitt71 committed Jul 21, 2022
1 parent 546d9e4 commit b0308c1
Show file tree
Hide file tree
Showing 18 changed files with 275 additions and 155 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
^README\.Rmd$
^.*\.Rproj$
^\.Rproj\.user$
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: clmplus
Type: Package
Title: most versatile approach for modeling the claims reserve with the chain-ladder algorithm.
Title: Versatile chain-ladder model
Version: 0.0.1
Author: Gabriele Pittarello, Munir Hiabu, Andres Villegas
Maintainer: Gabriele Pittarello <[email protected]>
Expand All @@ -12,7 +12,9 @@ Imports:
ggplot2,
forecast,
gridExtra,
grid
grid,
methods,
reshape2
Encoding: UTF-8
LazyData: true
VignetteBuilder: knitr
Expand Down
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Generated by roxygen2: do not edit by hand

S3method(plot,RtTriangle)
S3method(plot,clmplusmodel)
export(RtTriangle)
export(clmplus)
export(plotresiduals)
16 changes: 8 additions & 8 deletions R/clmplusRtTriangle.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
#' @examples
#' data(sifa.mtpl)
#' sifa.mtpl.rtt <- RtTriangle(cumulative.payments.triangle=sifa.mtpl)
#' hz.chl=xchl(sifa.mtpl.rtt, 'a')
#' hz.chl=clmplus(sifa.mtpl.rtt, 'a')
#'
#' @references
#'
#' Hiabu, Munir. “On the relationship between classical chain ladder and granular reserving.”
#' Scandinavian Actuarial Journal 2017 (2017): 708 - 729.
#'
#' @export
xchl <- function(RtTriangle,
clmplus <- function(RtTriangle,
hazard.model,
xc=NULL,
iter.max=1e+04,
tolerance.max=1e-06){

UseMethod("xchl")}
UseMethod("clmplus")}

xchl.default <- function(RtTriangle){message('The object provided must be of class RtTriangle')}
clmplus.default <- function(RtTriangle){message('The object provided must be of class RtTriangle')}

xchl.RtTriangle <- function(RtTriangle,
clmplus.RtTriangle <- function(RtTriangle,
hazard.model,
xc = NULL,
iter.max=1e+04,
Expand All @@ -58,7 +58,7 @@ xchl.RtTriangle <- function(RtTriangle,
iter.max=iter.max,
tolerance.max=tolerance.max)

kt.fit=arima(model$kt,c(0,1,0))
kt.fit=stats::arima(model$kt,c(0,1,0))

kt.fcst = forecast::forecast(kt.fit,
J)
Expand Down Expand Up @@ -183,11 +183,11 @@ xchl.RtTriangle <- function(RtTriangle,
converged=converged,
citer=citer)

class(out) <- c('xchlmodel')
class(out) <- c('clmplusmodel')

return(out)
}


setMethod("xchl", "RtTriangle", xchl.RtTriangle)
setMethod("clmplus", "RtTriangle", clmplus.RtTriangle)

144 changes: 0 additions & 144 deletions R/modelssRtTriangle.R

This file was deleted.

2 changes: 1 addition & 1 deletion R/plotresidualsclmplusmodel.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plotresiduals.clmplusmodel <- function(clmplusmodel,

if(clmplusmodel$hazard.model %in% names(pkg.env$models)){

res.m = residuals(clmplusmodel$model.fit)
res.m = stats::residuals(clmplusmodel$model.fit)
res.tr=pkg.env$c2t(res.m$residuals)
colnames(res.tr) <- rownames(res.tr) <- c(0:(dim(res.tr)[2]-1))
longdf.no.0 = ChainLadder::as.LongTriangle(res.tr)
Expand Down
5 changes: 5 additions & 0 deletions clmplus.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
32 changes: 32 additions & 0 deletions man/RtTriangle.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/amases.gtpl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/amases.mod.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/amases.mtpl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions man/clmplus.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b0308c1

Please sign in to comment.