R/ULS3.R

Defines functions ULS3

ULS3 <-
function(theta, Xim, DXm, SSk) {
  R <- ncol(Xim)
  S <- cov(cbind(DXm, Xim))
  f <- matrix(0, R+1, R+1)
  f[1,1] <- sqrt(0.5)*(S[1,1] - theta[1]^2-theta[R+3]-SSk*S[1,1])
  for (i in 2:(R+1)) {
    f[i,1] <- S[i,1] - theta[i]*theta[1]
    f[i,i] <- sqrt(0.5)*(S[i,i]-theta[i]^2-theta[R+2])
  }
  for (i in 3:(R+1)) {
    for (j in 2:(i-1)) f[i,j] <- S[i,j] - theta[i]*theta[j]
  }
  return(f[lower.tri(f, diag = TRUE)])
  ##return(log(f[lower.tri(f, diag = TRUE)]))
}

Try the semds package in your browser

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

semds documentation built on May 2, 2019, 2:07 p.m.