EstCorrRVs: Estimation of the auxiliary Gaussian model parameters for the...

Description Usage Arguments Value Note Examples

View source: R/estCorrRVs.R

Description

Estimation of the auxiliary Gaussian model parameters for the generation of correlated Random variables (RVs).

Usage

1
EstCorrRVs(R, dist, params, NatafIntMethod = "GH", NoEval = 9, polydeg = 8)

Arguments

R

A k x k matrix with the target Pearson correlation coefficients among the k RVs.

dist

A k-dimensional string vector indicating the quantile function of the target marginal distributions (i.e., the ICDF) of k RVs.

params

A k-dimensional named list with the parameters of the k target distributions.

NatafIntMethod

A string ("GH", "Int", or "MC") indicating the intergation method to resolve the Nataf integral.

NoEval

A scalar indicating (default: 9) the number of evaluation points for the integration methods.

polydeg

A scalar indicating the order of the fitted polynomial. If polydeg=0, then another curve is fitted.

...

Additional named arguments for the selected "NatafIntMethod" method.

Value

A list with the parameters of the auxiliary Gaussian model.

Note

Avoid the use of the "GH" method (i.e., NatafIntMethod='GH'), when the marginal(s) are discrete.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## Simulation of 3 correlated RVs with Gamma, Beta and Log-Normal distribution, respectively. 
## We assume also a target correlation matrix.
## Not run: 
set.seed(13)

# Define the target distribution functions (ICDFs) of X1, X2 and X3 RV.
FX1='qgamma'; FX2='qbeta'; FX3='qlnorm'
Distr=c(FX1,FX2,FX3) # store in a vector.

# Define the parameters of the target distribution functions 
# and store them in a list.  
pFX1=list(shape=1.5,scale=2); pFX2=list(shape1=1.5,shape2=3)
pFX3=list(meanlog=1,sdlog=0.5)

DistrParams=list()
DistrParams[[1]]=pFX1;DistrParams[[2]]=pFX2;DistrParams[[3]]=pFX3

# Define the target correlation matrix.
CorrelMat=matrix(c(1,0.7,0.5,
                   0.7,1,0.8,
                   0.5,0.8,1),ncol=3,nrow=3,byrow=T);
            
# Estimate the parameters of the auxiliary Gaussian model.
paramsRVs=EstCorrRVs(R=CorrelMat,dist=Distr,params=DistrParams, 
                        NatafIntMethod='GH',NoEval=9,polydeg=8)

# Generate 10000 synthetic realisations of the 3 correlated RVs.
SynthRVs=SimCorrRVs(n=10000,paramsRVs=paramsRVs)

# Comparison of target and simulation correlation matrix.
pairs(SynthRVs)
CorrelMatSim=cor(SynthRVs)
difference=(CorrelMat-CorrelMatSim)^2; print(difference)

## End(Not run)

itsoukal/anySim documentation built on May 7, 2020, 11:57 p.m.