Cumulative probability in R The probability density function I have is as following:
 
Now, I want to rewrite the cumulative probability function bellow into R.

The variables ($S$, $\mu$, $\sigma$) are constant variables. For $t$ i.e. t <- seq(0.1,1,0.1)
How the cumulative probability would look like in R? Non of my solutions yields desired output!
EDIT:
f1 = function(t,S,sigma,mu){((mu*t+S)/(sigma*sqrt(t)))}
f2 = function(t,S,sigma,mu){((mu*t-S)/(sigma*sqrt(t)))}

1-(pnorm(f1(t,S,sigma,mu),mu,sigma,1,0)-exp(-(2*S*mu/sigma^2))*pnorm(f2(t,S,sigma,mu),mu,sigma,1,0))

This kind of gives me reasonable results but not sure if correct.
 A: A CDF is defined as non-decreasing, right continuous function F, with


*

*$\lim_{x\to -\infty}F(x)=0,$ and

*$\lim_{x\to +\infty}F(x)=1.$
I am just stating the obvious here, but when we let $t<0$ we have already a problem as your real-valued function contains square roots of t. Similarly, we need $\sigma >0$ and perhaps a lot of other things.
In either case, I will just go ahead and assume you know what you are doing, and show you the code you asked for.
# custom cdf
custom.cdf <- function(S,sigma,mu,t)
{
    q1 <- pnorm((mu*t + S)/(sigma*sqrt(t)))
    q2 <- pnorm((mu*t - S)/(sigma*sqrt(t)))
    e.term <- exp(-((2*S*mu)/(sigma^2)))
    res <- q1 - e.term*q2
    return(res)
}    

# set parameters
S <- 1
sigma <- 1
mu <- 2    

t <- seq(0.1,1,0.1)
plot(t,custom.cdf(S,sigma,mu,t),typ="l")    

I have chosen a larger support to see a bit more of the curve. Check the formula (mine and yours) for any mistakes.
t <- seq(1e-6,1,1e-6)
plot(t,custom.cdf(S,sigma,mu,t),typ="l")

A: This would implement your function in R. What part of the output didn't make sense when you tried? 
 cumulative = function(t){
      S = somenumber
      mu = somenumber
      sigma = somenumber
      cd = pnorm((mu*t+S)/(sigma*sqrt(t)))-exp(-2*S*mu/sigma^2)*pnorm((mu*t-S)/(sigma*sqrt(t)))
      return(cd)
    }

That being said, what are your parameter values? For combinations I've tried, this seems like a decreasing function of t.
