foo_of_a_List_of_Arrays: Variance of a List of Arrays

Description Usage Arguments Details Value Examples

View source: R/foo_of_a_List_of_Arrays.R

Description

Then the function calculates the variance over all list for each array component.

Usage

1
foo_of_a_List_of_Arrays(x, name.of.function)

Arguments

x

A List of Arrays. The dimension of array is fixed for all list component.

name.of.function

This is an operator, such as mean, var, sum,... Note that user no need to surround the input by "". For example, mean instead of "mean".

Details

Of course variance can change to sum or mean or any other functions whose entry is a vector.One can find this function in the Stack over flow, since I ask there, and thus the example given in here can also find also there. In my hierarchical Bayesian Model, the estimates has the format arrays. For example the hit rate are array whose subscript is confidence level, modality, and reader. So, when one desire to validate the estimates, it needs to calculate such variance of arrays. When I validate the estimates, I used the function.

Value

An array being reduced form use input list of array via user input operator such as mean, var, sum,...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#Suppose that x is the following list of arrays:

  a <- array(1,c(2,3,4));
  b <- array(2,c(2,3,4));
  c <- array(3,c(2,3,4));
  d <- array(4,c(2,3,4));
  x <- list(a=a,b=b,c=c,d=d)

foo_of_a_List_of_Arrays(x,sum)
foo_of_a_List_of_Arrays(x,mean)
foo_of_a_List_of_Arrays(x,stats::var)




#Note that the component of list can be vectors with fixed same length.

  y <- list(c(1,2,3),
            c(11,22,33),
            c(1111,2222,3333))


  a <- foo_of_a_List_of_Arrays(y,sum)

BayesianFROC documentation built on Jan. 13, 2021, 5:22 a.m.