File: ciGS.R

package info (click to toggle)
r-cran-ctmcd 1.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,384 kB
  • sloc: cpp: 183; ansic: 19; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 574 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
ciGS <-
function (x, alpha) 
{
    draws = length(x$draws)
    n = nrow(x$draws[[1]])
    draws = length(x$draws)
    data = matrix(unlist(x$draws), n^2, draws)
    lowermat = matrix(0, n, n)
    uppermat = matrix(0, n, n)
    for (row in 1:n) {
        for (col in 1:n) {
            lowermat[row, col] = quantile(data[(col - 1) * n + 
                row, ], alpha/2)
            uppermat[row, col] = quantile(data[(col - 1) * n + 
                row, ], 1 - alpha/2)
        }
    }
    limits = list(lower = lowermat, upper = uppermat)
    limits
}