create_theta_mvn: A Function to Create Variables from a Multivariate Normal...

View source: R/create_theta_mvn.R

create_theta_mvnR Documentation

A Function to Create Variables from a Multivariate Normal Distribution

Description

Given a vector means, standard deviation, and interfactor correlation, create_theta_mvn() creates theta values from a multivariate normal distribution with the number of dimensions equal to the length of the vector of standard deviation.

Usage

create_theta_mvn(size, mean_vec, sd_vec, ifcor_vec, seed_num)

Arguments

size

A sample size, which is a positive integer value.

mean_vec

A vector of means of the variables.

sd_vec

A vector of standard deviation.

ifcor_vec

This vector contains a pair-wise interfactor correlation values, which are arranged for the pair Factors i and j, where i = 1, 2,...,m-1, j = 2, 3,...,m, and m is the total number of dimensions. For example, with three factors, the pair facotrs i and j is arranged as follows: Factor 1 and Factor 2, Factor 1 and Factor 3, and Factor 2 and Factor 3.

seed_num

A integer value used as a seed number for random number generation.

Value

It will return two data sets: a raw data set and a scaled data set. A scale data set has each dimension standardized. That is each dimension is mean centered by the dimension's mean and scaled by the dimension's standard deviation (standardized).

See Also

to_cormatrix(),to_covmatrix(), TSK()

Examples

# example: Three-factor model
library(AUTTT)
mean_vec <- c(-0.1, 0, 0.1) # mean vector for each dimension
sd_vec <- c(0.95, 0.98, 1.1) # sd vector for each dimension
f_cor <- c(0.3, 0.5, 0.75) # interfactor correlation vector

output <- create_theta_mvn(size = 300, 
                 mean_vec = mean_vec, 
                 sd_vec = sd_vec, 
                 ifcor_vec = f_cor, 
                 seed_num = 45679)


Boklauth/AUTTT documentation built on Dec. 9, 2022, 7:37 a.m.