Nothing
dcompound <-
function(x, dist="exp", comp1=as.null(), comp2=as.null(), gamma=1, beta=1, theta1=1, theta2=1, log=FALSE)
{
if(!any(dist == c("exp","gamma","lnorm","paretoII","bisa","lomax","beta","kumar","norm","logis","cauchy","gumbel"))) stop("distribution is not recognized")
if(!any(comp1 == c("EXP","EXP2","MO","MO2","SB")) & !is.null(comp1)) stop("distribution is not recognized")
if(!any(comp2 == c("EXP","EXP2","MO","MO2","SB")) & !is.null(comp2)) stop("distribution is not recognized")
if (beta<=0) stop("beta should be positive")
if(any(dist==c("gamma","paretoII","bisa","lomax","beta","kumar")) & gamma<=0) stop("gamma should be positive")
if(any(comp1 == c("EXP","EXP2","MO","MO2")) & theta1<=0) stop("theta1 should be positive")
if(any(comp2 == c("EXP","EXP2","MO","MO2")) & theta2<=0) stop("theta2 should be positive")
if(!is.null(comp1)){if(comp1=="SB" & (theta1< -1 | theta1> 1)) stop("theta1 should be between -1 and 1")}
if(!is.null(comp2)){if(comp2=="SB" & (theta2< -1 | theta2> 1)) stop("theta2 should be between -1 and 1")}
f=get(paste("d",dist,sep=""))
F=get(paste("p",dist,sep=""))
if(!is.null(comp2)){g2=get(paste("d",comp2,sep=""))}
if(!is.null(comp1)){g1=get(paste("d",comp1,sep=""));G1=get(paste("p",comp1,sep=""))}
if(dist=="exp")
{
if(!is.null(comp2)) logf=g2(G1(F(x, gamma),theta1),theta2,log=TRUE)+g1(F(x,gamma),theta1,log=TRUE)+f(x,gamma,log=TRUE)
if(is.null(comp2) & !is.null(comp1)) logf=g1(F(x,gamma),theta1,log=TRUE)+f(x,gamma,log=TRUE)
if(is.null(comp2) & is.null(comp1)) logf=f(x,gamma,log=TRUE)
}
if(dist!="exp")
{
if(!is.null(comp2)) logf=g2(G1(F(x, gamma, beta),theta1),theta2,log=TRUE)+g1(F(x,gamma, beta),theta1,log=TRUE)+f(x,gamma, beta,log=TRUE)
if(is.null(comp2) & !is.null(comp1)) logf=g1(F(x,gamma, beta),theta1,log=TRUE)+f(x,gamma, beta,log=TRUE)
if(is.null(comp2) & is.null(comp1)) logf=f(x,gamma, beta,log=TRUE)
}
if(log == FALSE) fy <- exp(logf)
else fy <- logf
fy
}
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.