Description Usage Arguments Value Author(s) Examples
View source: R/oclCombo1col1.R
Function to call OpenCL to calculate posterior means and standard deviations of random effects in models with 1 structure matrix.
1 | oclCombo1col1(a, D, tausqy, tausqphi, By)
|
a |
Eigenvector matrix of 1st Q matrix. |
D |
atrix of eigenvalues from the structure matrix. |
tausqy |
Vector of samples of measurement error precision. |
tausqphi |
Matrix sampled values of spatial precisions. |
By |
Vector resulting from premultiplication of data vector y b transpose of kronecker sum of eigenvector matrices. |
phimean |
Vector of means of posterior densities of random effects |
phisd |
Vector of standard deviations of marginal posterior |
Michael Seedorff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (a, D, tausqy, tausqphi, By)
{
if (!is.numeric(a))
stop("a must be a numeric matrix")
na1 <- nrow(a)
nc1 <- length(tausqy)
if (is.null(ncol(tausqphi)))
F1 <- 2
else F1 <- ncol(tausqphi) + 1
mresults <- rep(0, 2 * na1)
out <- .C("oclCombo1col1", a = as.double(as.vector(t(a))),
D = as.double(as.vector(t(D))), tausqy = as.double(tausqy),
tausqphi = as.double(as.vector(t(tausqphi))), By = as.double(By),
results = as.double(mresults), na1 = as.integer(na1),
nc1 = as.integer(nc1), F1 = as.integer(F1))
return(list(phimean = out$results[1:na1], phisd = sqrt(out$results[(na1 +
1):(2 * na1)]/(nc1 - 1))))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.