d <- seq(0, 100, length=100)
covs <- matrix(1,length(d),1)
halfnorm.like(log(20), d, covs)
plot(d, halfnorm.like(log(20), d, covs)$L.unscaled, type="l", col="red")
lines(d, halfnorm.like(log(40), d, covs)$L.unscaled, col="blue")
# Evaluate 3 functions at once using matrix of coefficients:
# sigma ~ 20, 30, 40
coefs <- matrix(log(c(7.39,7.33, 4.48,44.80, 2.72,216.54))
, byrow = TRUE
, ncol=2) # (3 coef vectors)X(2 covars)
covs <- matrix(c(rep(1,length(d))
, rep(0.5,length(d)))
, nrow = length(d)) # 100 X 2
L <- halfnorm.like( coefs, d, covs )
L$L.unscaled # 100 X (3 coef vectors)
L$params # 100 X (3 coef vectors); ~ log(c(20,30,40))
matplot(d, L$L.unscaled, type="l")
Run the code above in your browser using DataLab