search for: logical_flag

Displaying 1 result from an estimated 1 matches for "logical_flag".

2011 Mar 29
2
normal distribution and floating point traps (?): unexpected behavior
...ct, but all.equal(qnorm(1-1e-100) , -qnorm(1e-100)) # turns FALSE: Indeed # qnorm(1e-100) is -21.27345, and # qnorm(1-1e-100) is Inf # as a consequence there was an infinitive (I would expect a 21.27) running in my program which was very annoying and hard to detect. ##### issue 2 dnorm(...,log=logical_flag) ##### simple normal likelihood set.seed(1) x <- rnorm(100) # sample 100 normal data mu <- seq(-4,4,length=51) # get a grid for mu sigma <- seq(.01,4,length=51) # get a grid for sigma lik <- function(theta,x) sum( dnorm(x,theta[1],theta[2],log=T)) # log likelihood Lik <- function(th...