GPCE.sparse: Adaptive sparse generalized polynomial chaos expansion

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/GPCE.sparse.R

Description

The GPCE.sparse function implements a polynomial chaos expansion of a given model or an external model. The strategy for the expansion of the model into a polynomial chaos basis is the adaptive sparse method where the sampled design is iteratively enriched until the expansion coefficients estimation, by regression, is accurate. Meanwile a relevant selection of the polynomial basis to keep in the expansion is carried out. A statistical and a global sensitivity analysis of the model is then carried out.

Usage

1
2
3
4
5
GPCE.sparse(Model = NULL, PCSpace = "Uniform", InputDim = 3, InputDistrib = c(),
                 ParamDistrib = NULL, Q2tgt = 1 - 10^(-6), Eps = 10^(-2) * (1 -
                 Q2tgt), EpsForw = Eps, EpsBack = Eps, EnrichStep = 50, jmax
                 = InputDim, pmaxi = 12, DesignLength = 8, SeedSob =
                 sample(1:1000, 1))

Arguments

Model

A function defining the model to analyze or NULL if the model is external

PCSpace

The space where the expansion is achieved. Options are Gaussian, Uniform and Physic. Physic use the same distributions as the input ones for the expansion

InputDim

Dimension of the input

InputDistrib

Distribution of the input. Options are Gaussian, Uniform, Beta, Gamma

ParamDistrib

Parameters of the input distributions

Q2tgt

Fix the accuracy of the expansion fitting. By default 1-10(^-6)

Eps

Common epsilon for the selection of the basis. By default set to 10^(-2)*(1-Q2tgt)

EpsForw

Epsilon used for the forward selection of the basis. By default set to Eps

EpsBack

Epsilon used for the forward selection of the basis. By default set to Eps

EnrichStep

Number of samples to add to the experimental design. By default set to 50

DesignLength

The length of the input design. By default set to 8

jmax

The maximum interaction order between the input variables

pmaxi

The maximum degree of the polynomial basis

SeedSob

Seed for the Sobol design generation

Value

Designs

A list containing the Sobol design, the input distributions design, the polynomial chaos design and the design length

Output

Vector of the model output

TruncSet

Matrix of the kept sparse polynomial basis. TruncSet_ij is the jth polynomial degree associated to the ith variable

CoeffPCE

Vector of the expansion coefficients associated to the TruncSet. CoeffPCE_j is the jth coefficient associaed to the jth polynomial basis.

R2

The R2 PCE approximation error

Q2

The Q2 PCE approximation error

Moments

A list containing the fourth first moments of the output: mean, variance, standard deviation, skweness and kurtosis

Sensitivity

A list containing the sobol sensitivity indices and the sobol total sensitivity indices

OutputDistrib

A list containing a kernel estimation of the output distribution and the associated bandwidth

Author(s)

Munoz Zuniga Miguel

References

G. Blatman and B. Sudret, 2010, An adapive algorithm to build up sparse polynomial chaos expansions for stochastic finite element analysis, Probabilistic Engineering Mechanics, 25, 183–197.

See Also

tell.GPCE.sparse

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
36
37
38
39
40
41
### CASE 1: model is a R function. 
### Model definition: y= 1 + Phi_1(x1)*Phi_1(x2) + Phi_3(x2)
Model <- function(x){
  PHerm = hermite.he.polynomials(7, normalized=FALSE)
  y=1+unlist(polynomial.values(PHerm[2],x[,1]))*unlist(polynomial.values(PHerm[2],x[,2]))+
  unlist(polynomial.values(PHerm[4],x[,2]))/sqrt(factorial(3))
  return(y)
}

### Run the algorithm with the sparse regression method
ResultObject=GPCE.sparse(Model=Model, PCSpace="Gaussian", InputDim=3, 
                         InputDistrib=rep("Gaussian",3))
names(ResultObject)
###

### CASE 2: external model (for the example the function Model will be used externaly).

### initialized Output
Output=c()

### Get a first design
ResultObject=GPCE.sparse(PCSpace="Gaussian",InputDim=3,InputDistrib=rep("Gaussian",3))
names(ResultObject)

### Calculate the model output for the given design and concatenate the model output results
### into the output vector 
Output=c(Output,Model(ResultObject$Design2Eval))

### Give the design and the calculated ouput to the tell function
ResultObject=tell(ResultObject,Output)
names(ResultObject)

### If the expansion has been calculated the function tell return the full expansion 
### paramaters, the moments analysis, the sensitivity analysis and the output distribution
### If not the function tell() return an enriched design. 
Output=c(Output,Model(ResultObject$Design2Eval))

### Give the design and the calculated ouput to the tell function
ResultObject=tell(ResultObject,Output)
names(ResultObject)
###

Example output

Loading required package: randtoolbox
Loading required package: rngWELL
This is randtoolbox. For an overview, type 'help("randtoolbox")'.
Loading required package: orthopolynom
Loading required package: polynom
Loading required package: ks
Loading required package: lars
Loaded lars 1.2

[1] "h problem"
[1] "Entering PostProcessReg"
[1] "Entering EvalPCE"
 [1] "TruncSet"     "R2"           "Q2"           "Designs"      "CoeffPCE"    
 [6] "Moments"      "Sensitivity"  "OutputDistib" "Args"         "Output"      
[1] "Designs"     "Design2Eval" "Args"       
[1] "Designs"     "Design2Eval" "Output"      "Args"       
[1] "Entering PostProcessReg"
[1] "Entering EvalPCE"
 [1] "TruncSet"     "R2"           "Q2"           "Designs"      "CoeffPCE"    
 [6] "Moments"      "Sensitivity"  "OutputDistib" "Args"         "Output"      

GPC documentation built on May 30, 2017, 12:50 a.m.