Adaptive sparse generalized polynomial chaos expansion based on least angle regression
Description
The GPCE.lar 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 based on the least angle regression. A statistical and a global sensitivity analysis of the model is then carried out.
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
jmax
The maximum interaction order between the
input variables
pmaxi
The maximum degree of the polynomial basis
DesignLength
The length of the input design. By default set to 8
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 oerror
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, 2011, Adapive sparse polynomial chaos expansion based on least angle regression, Journal of Computational Physics, 230, 2345–2367.
See Also
tell.GPCE.lar
Examples
### CASE 1: model is a R function.
### Model definition: y= 1 + Phi_1(x1)*Phi_1(x2)
Model <- function(x){
PHerm = hermite.he.polynomials(5, normalized=FALSE)
y=1+unlist(polynomial.values(PHerm[2],x[,1]))*unlist(polynomial.values(PHerm[2],x[,2]))
return(y)
}
### Run the algorithm with the lar regression method
ResultObject=GPCE.lar(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.lar(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.
### In the later case the user calculate the output externally and give them
### to the tell function with the previous ResultObject for further calculation.
### See GPCE.sparse documentation for an example.
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GPC)
Loading required package: randtoolbox
Loading required package: rngWELL
This is randtoolbox. For overview, type 'help("randtoolbox")'.
Loading required package: orthopolynom
Loading required package: polynom
Loading required package: ks
Loading required package: KernSmooth
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009
Loading required package: misc3d
Loading required package: mvtnorm
Loading required package: rgl
Loading required package: lars
Loaded lars 1.2
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GPC/GPCE.lar.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GPCE.lar
> ### Title: Adaptive sparse generalized polynomial chaos expansion based on
> ### least angle regression
> ### Aliases: GPCE.lar
>
> ### ** Examples
>
> ### CASE 1: model is a R function.
> ### Model definition: y= 1 + Phi_1(x1)*Phi_1(x2)
> Model <- function(x){
+ PHerm = hermite.he.polynomials(5, normalized=FALSE)
+ y=1+unlist(polynomial.values(PHerm[2],x[,1]))*unlist(polynomial.values(PHerm[2],x[,2]))
+ return(y)
+ }
>
> ### Run the algorithm with the lar regression method
> ResultObject=GPCE.lar(Model=Model, PCSpace="Gaussian", InputDim=3, InputDistrib=rep("Gaussian",3))
[1] "p is" "1"
[1] "p is" "2"
[1] "Entering PostProcessReg"
[1] "Entering EvalPCE"
> names(ResultObject)
[1] "TruncSet" "Q2" "Designs" "CoeffPCE" "Moments"
[6] "Sensitivity" "OutputDistib" "Args" "Output"
> ###
>
> ### CASE 2: external model (for the example the function Model will be used externaly).
>
> ### initialized Output
> Output=c()
>
> ### Get a first design
> ResultObject=GPCE.lar(PCSpace="Gaussian",InputDim=3,InputDistrib=rep("Gaussian",3))
> names(ResultObject)
[1] "Designs" "Design2Eval" "Args" "p" "SaveQmax"
[6] "SaveAmax"
>
> ### 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)
[1] "p is" "1"
[1] "p is" "2"
[1] "Entering PostProcessReg"
[1] "Entering EvalPCE"
> names(ResultObject)
[1] "TruncSet" "Q2" "Designs" "CoeffPCE" "Moments"
[6] "Sensitivity" "OutputDistib" "Args" "Output"
>
> ### 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.
> ### In the later case the user calculate the output externally and give them
> ### to the tell function with the previous ResultObject for further calculation.
> ### See GPCE.sparse documentation for an example.
>
>
>
>
>
>
> dev.off()
null device
1
>