Surrogate (version 1.7)

Pos.Def.Matrices: Generate 4 by 4 correlation matrices and flag the positive definite ones

Description

Based on vectors (or scalars) for the six off-diagonal correlations of a \(4\) by \(4\) matrix, the function Pos.Def.Matrices constructs all possible matrices that can be formed by combining the specified values, computes the minimum eigenvalues for each of these matrices, and flags the positive definite ones (i.e., valid correlation matrices).

Usage

Pos.Def.Matrices(T0T1=seq(0, 1, by=.2), T0S0=seq(0, 1, by=.2), T0S1=seq(0, 1, 
by=.2), T1S0=seq(0, 1, by=.2), T1S1=seq(0, 1, by=.2), S0S1=seq(0, 1, by=.2))

Arguments

T0T1

A vector or scalar that specifies the correlation(s) between T0 and T1 that should be considered to construct all possible \(4\) by \(4\) matrices. Default seq(0, 1, by=.2), i.e., the values \(0\), \(0.20\), …, \(1\).

T0S0

A vector or scalar that specifies the correlation(s) between T0 and S0 that should be considered to construct all possible \(4\) by \(4\) matrices. Default seq(0, 1, by=.2).

T0S1

A vector or scalar that specifies the correlation(s) between T0 and S1 that should be considered to construct all possible \(4\) by \(4\) matrices. Default seq(0, 1, by=.2).

T1S0

A vector or scalar that specifies the correlation(s) between T1 and S0 that should be considered to construct all possible \(4\) by \(4\) matrices. Default seq(0, 1, by=.2).

T1S1

A vector or scalar that specifies the correlation(s) between T1 and S1 that should be considered to construct all possible \(4\) by \(4\) matrices. Default seq(0, 1, by=.2).

S0S1

A vector or scalar that specifies the correlation(s) between S0 and S1 that should be considered to construct all possible \(4\) by \(4\) matrices. Default seq(0, 1, by=.2).

Details

The generated object Generated.Matrices (of class data.frame) is placed in the workspace (for easy access).

See Also

Sim.Data.Counterfactuals

Examples

Run this code
# NOT RUN {
## Generate all 4x4 matrices that can be formed using rho(T0,S0)=rho(T1,S1)=.5
## and the grid of values 0, .2, ..., 1 for the other off-diagonal correlations: 
Pos.Def.Matrices(T0T1=seq(0, 1, by=.2), T0S0=.5, T0S1=seq(0, 1, by=.2), 
T1S0=seq(0, 1, by=.2), T1S1=.5, S0S1=seq(0, 1, by=.2))

## Examine the first 10 rows of the the object Generated.Matrices:
Generated.Matrices[1:10,]

## Check how many of the generated matrices are positive definite
## (counts and percentages):
table(Generated.Matrices$Pos.Def.Status)
table(Generated.Matrices$Pos.Def.Status)/nrow(Generated.Matrices)

## Make an object PosDef which contains the positive definite matrices:
PosDef <- Generated.Matrices[Generated.Matrices$Pos.Def.Status==1,]

## Shows the 10 first matrices that are positive definite:
PosDef[1:10,]
# }

Run the code above in your browser using DataCamp Workspace