### External model (for the example the function Model defined below will be used externaly)
### Model definition: y= 1 + Phi_1(x1)*Phi_1(x2) + Phi_3(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]))+
unlist(polynomial.values(PHerm[4],x[,2]))/sqrt(factorial(3))
return(y)
}
### 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)
###
Run the code above in your browser using DataLab