# Example 1
R <- matrix(.35, 6, 6)
diag(R) <- 1
Rout <- Ravgr(Rseed = R,
rdist = "U", SEED = 123)$R
Rout |> round(3)
mean( Rout[upper.tri(Rout, diag = FALSE)] )
# Example 2
Rout <- Ravgr(Rseed = .35, NVar = 6,
rdist = "U", SEED = 123)$R
Rout |> round(3)
mean( Rout[upper.tri(Rout, diag = FALSE)] )
# Example 3
# Generate an R matrix with a larger var(rij)
Rout <- Ravgr(Rseed = .35,
NVar = 6,
rdist = "B",
alpha = 7,
beta = 2)$R
Rout |> round(3)
mean( Rout[upper.tri(Rout, diag = FALSE)] )
# Example 4: Demonstrate the function of u
sdR <- function(R){
sd(R[lower.tri(R, diag = FALSE)])
}
Rout <- Ravgr(Rseed = .35,
NVar = 6,
u = 0,
SEED = 123)
sdR(Rout$R)
Rout <- Ravgr(Rseed = .35,
NVar = 6,
u = .5,
SEED = 123)
sdR(Rout$R)
Rout <- Ravgr(Rseed = .35,
NVar = 6,
u = 1,
SEED = 123)
sdR(Rout$R)
Run the code above in your browser using DataLab