<div dir="ltr"><div class="gmail_extra">Dear Peter,</div><div class="gmail_extra"><br></div><div class="gmail_extra">As far as I understand, the multiple (1000 for each KernelES*) plot is due to the line:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra"> for (i in 1:(n - 1)) {</div><div class="gmail_extra">      VaR[i] <- KernelVaRTriangleKernel(PandL, cl + i * <a href="http://delta.cl" target="_blank">delta.cl</a>)</div><div class="gmail_extra">  }</div><div class="gmail_extra"><br></div><div class="gmail_extra">Since n is 1000, I can imagine each iteration of loop resulted in a new plot in the Dowd-Ex.pdf. Though running it in the R, only the final plot remains visible. (similar to Dowd's code in Matlab)</div><div class="gmail_extra"><br></div><div class="gmail_extra">To avoid multiple plots in the Dowd-Ex.pdf, I have introduced new variable. So the problem of multiple plots in the pdf is now avoided.</div><div class="gmail_extra">e.g.</div><div class="gmail_extra"><div class="gmail_extra"> for (i in 1:(n - 1)) {</div><div class="gmail_extra">    if(i<(n-1)){</div><div class="gmail_extra">      VaR[i] <- KernelVaRTriangleKernel(PandL, cl + i * <a href="http://delta.cl/" target="_blank">delta.cl</a>, FALSE)</div><div class="gmail_extra">    } else if (i == n-1) {</div><div class="gmail_extra">      VaR[i] <- KernelVaRTriangleKernel(PandL, cl + i * <a href="http://delta.cl/" target="_blank">delta.cl</a>, TRUE)</div><div class="gmail_extra">    }</div><div class="gmail_extra">  }</div></div><div class="gmail_extra"><br></div><div class="gmail_extra">However, the execution time will still be greater than 5s and is skipped (As per my experience, using devtools and also in check log in r-forge, those 6 functions that have execution time > 5s are skipped, whereas, command line check does not skip them). Since the package passes the command line check without skipping those functions, I am not sure how important it is to consider it. </div><div class="gmail_extra"><br></div><div class="gmail_extra">If you consider it important to avoid that, one possibility is to decrease the value of "n" in the KernelES* functions from 1000 to less than 500. (Since I am using single loop only in the code and density function from stats package, I am not sure, we can optimize the code, but if you have suggestions, do let me know). The reduction in value of "n" might make plot or values obtained slightly different from that of Dowd.</div><div class="gmail_extra"><div class="gmail_extra"><br></div><div class="gmail_extra">Same can be applied to the other two functions (reduction of number of iterations) or it can be simply ignored.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Let me know what you think of this.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Sincerely,</div><div class="gmail_extra">Dinesh</div></div></div></div>