Nothing
###############################################################################################
##### expected loss
###############################################################################################
#' @name pt.exploss
#' @aliases pt.exploss
#' @title Expected loss
#' @description This function give the expected loss of given asset returns.
#' @usage pt.exploss(r,p)
#' @param r :a vector of periodic returns
#' @param p :target return
#' @examples rt <- runif(12,-1,1) # generate random number to simulate returns
#' pt.exploss(rt,0)
#' pt.exploss(rt,1)
pt.exploss <- function(r,p){
n <- length(r)
down <- sum(r[r < p])
return(down/n)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.