init(path.in = "", path.out = "", port.name = "portfolio.csv",
rating.scale.name = "rating_pd.csv", sec.var.name = "pd_sector_var.csv",
sec.var.est = 5, loss.unit = 1e+06, Niter.max = 0, alpha.max = 0.9999,
Niter.max.global = 1e+05, alpha = c(0.999), PLOT.PDF = TRUE,
export.to.file = FALSE, calc.rc = FALSE, PLOT.scale = 1e+06,
PLOT.range.x = c(0, 0), PLOT.range.y = c(0, 0), save.memory = FALSE,
file.format = "csv", portfolio = data.frame(), rating.scale = data.frame(),
sec.var = data.frame())
port.name
for the .csv files. If not provided, the file is read from path.in
.
rating.scale.name
for the .csv files. If not provided, the file is read from path.in
.
sec.var.name
for the .csv files. If not provided, the file is read from path.in
.
init
, please have a look at portfolio
, rating.scale
or sec.var
below.
export.to.file
= TRUE
, ending with "...\\" or ".../".
Be aware, that actually, by writing any output, the model will create a subdirectory in path.out
with its name. So you can use your path.in
as path.out
(which is the default case), create different models from the same input data (or from different files, lying in the same directory), without worrying about the output path or overwriting other results.
sec.var.est
=5. The rating classes have to be integer values. A class '0' is allowed. All counterparties in this class are removed before analyzing the portfolio. Take care of the right spelling of the column titles and capitalization.sec.var.est
!= 5.
Sum of (weights * SD)
2: [Sum of (weights * SD)] / MU(k)
3: Sum of (sqrt(weights) * SD)
4: [Sum of ((sqrt(weights) * SD)] / MU(k)
5: Read variances from external file
with: MU.(k)=sum(W[,k+1]*PD)
Niter.max
, one can also define the maximum CDF level.alpha.max
is provided. Be aware, that a high value can have high memory costs during the algorithm, even if the calculation of the CDF stops very much earlier.plot
directly.path.out
.rc.vares
or rc.sd
directly.
PLOT.range.x /-.y
(0,0) have the meaning, that R will choose axis range by itself.PLOT.range.x
above for vertical axis.save.memory
=TRUE, loss
and CDF
will not be stored permanently. If needed, the CDF is recalculated from the PDF. The same happens to a
and B
at the end of loss.dist
if calc.rc
=FALSE.crp.CSFP
MyModel=init(path.in=system.file("data",package="crp.CSFP"),loss.unit=1e6,
calc.rc=TRUE)
# or pass portfolio directly and use random sector variances
Path=system.file("data",package="crp.CSFP")
portfolio=read.csv(paste(Path,"/portfolio.csv",sep=""))
rating.scale=read.csv(paste(Path,"/rating_pd.csv",sep=""))
sec.var=data.frame(Var=runif(3,0,2))
MyModel=init(portfolio=portfolio,rating.scale=rating.scale,sec.var=sec.var,
loss.unit=1e6,calc.rc=TRUE)
Run the code above in your browser using DataLab