create.rand.mat: Create a real-valued, symmetric random matrix

Description Usage Arguments Details Value Author(s) Examples

Description

The function creates a real-valued, symmetric random matrix of desired dimension. Two alternatives for the probability distribution of the matrix elements are provided.

Usage

1
create.rand.mat(size = 1000, distrib = c("norm", "unif"), mean = 0, stddev = 1)

Arguments

size

Dimension of the (quadratic) matrix.

distrib

Desired probability distribution of the matrix elements. Can be norm or unif.

mean

Desired mean of the normal distribution. Only active if distrib = 'norm' was chosen.

stddev

Desired standard deviation of the normal distribution. Only active if distrib = 'norm' was chosen.

Details

The function creates a real-valued, symmetrical random matrix of desired dimension. Two alternatives for the probability distribution of the matrix elements are provided: normal and uniform. If distrib = 'norm', the mean and the standard deviation can additionally be chosen. If distrib = 'unif', the matrix elements will be uniformly distributed in the interval (-1,1).

Value

A list containing the following components:

mean.diag

The mean of the diagonal elements of the matrix.

stddev.diag

The standard deviation of the diagonal elements of the matrix.

mean.triangle

The mean of the upper triangle of the matrix (diagonal excluded).

stddev.triangle

The standard deviation of the upper triangle of the matrix (diagonal excluded).

rand.matrix

The random matrix created.

Author(s)

Uwe Menzel <uwemenzel@gmail.com>

Examples

1
2
3
  set.seed(777)
  random.matrix <- create.rand.mat(size = 1000, distrib = "norm")$rand.matrix
  dim(random.matrix)

Example output

  Required distribution of matrix elements: norm 
  The mean of the main diagonal is 0.1006 
  The std. deviation of the main diagonal is 1.394 
  The mean of the upper triangle is 0.0008975 
  The std. deviation of the upper triangle is 1.001 
  The matrix is real and symmetric.

[1] 1000 1000

RMThreshold documentation built on May 2, 2019, 8:51 a.m.