R/dspml.R

Defines functions dspml

Documented in dspml

dspml <- function(x, mu, rads = FALSE, logden = FALSE) {
  if ( !rads )  x <- x * pi/180
  x <- cbind( cos(x), sin(x) )
  tau <- tcrossprod(mu, x)
  ptau <- pnorm(tau) 
  gam <- sum(mu^2)
  f <-  - 0.5   ;   con <- sqrt(2 * pi) 
  den <-  - 0.5 * gam + log1p( tau * ptau * con / exp(f * tau^2) ) - log(2 * pi)
  if ( !logden )  den <- exp(den)
  den
}

Try the Directional package in your browser

Any scripts or data that you put into this service are public.

Directional documentation built on Oct. 12, 2023, 1:07 a.m.