Forum: help
Monitor Forum | Start New ThreadMC [ Reply ] By: plan b on 2017-06-16 12:06 | [forum:45198] |
Dear all! Please help with implementation of the following algorithm of banking crtedit portfolio stress-testing. Initial data*: [idclient], [idcredit], [sumcredit], [sumprovision] *current client can have more then one credit, in this case is duplicated in all rows 1) on initial data calculate the column sumprovision2, which is formed according to the rule (for example, if sumprovision=1%, then sumprovision2=5% with probability (p1=90%) or sumprovision2=50% with a probability (p1=10%). I.e. in this case it is necessary to use first pseudo-random number generator (PRNG). 2) after calculation of sumprovision2 column it is necessary to obtain a sample (temp_subsmpl) on initial data, containing 25% of clients (and all associated client's credits) and calculate: x <- sum( temp_subsmpl$sumcredit * temp_subsmpl$sumprovision2). I.e. in this case it is necessary to use second PRNG. 3) repeat steps 1 and 2 many times (500000) accumulating the calculated statistic x I am a beginner and have little experience in the language. I will be grateful for any help! Sincerely. |