nonnullPropEst <- function(x,u,sigma)
{
# x is a vector
# u is the mean
# sigma is the standard deviation
z = (x - u)/sigma
xi = c(0:100)/100
tmax=sqrt(log(length(x)))
tt=seq(0,tmax,0.1)
epsest=NULL
for (j in 1:length(tt)) {
t=tt[j]
f = t*xi
f = exp(f^2/2)
w = (1 - abs(xi))
co = 0*xi
for (i in 1:101) {
co[i] = mean(cos(t*xi[i]*z));
}
epshat = 1 - sum(w*f*co)/sum(w)
epsest=c(epsest,epshat)
}
return(epsest=max(epsest))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.