create.rand.mat {RMThreshold} | R Documentation |
Create a real-valued, symmetric random matrix
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
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 |
mean |
Desired mean of the normal distribution. Only active if |
stddev |
Desired standard deviation of the normal distribution. Only active if |
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
set.seed(777)
random.matrix <- create.rand.mat(size = 1000, distrib = "norm")$rand.matrix
dim(random.matrix)