### 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.
Run the code above in your browser using DataLab