As I mentioned before, in PC-Kriging, the trend term in the Kriging formulation is a PCE. This PCE in turn is determined by the LARS algorithm (this is the default; See PCE User Manual Section 1.5.2 for details on the algorithm). The coefficients of the trend term obtained by this iterative algorithm depend on the particular experimental design points. If the design points change, there’s a good chance that the coefficients differ; not only their values but the whole structure of the PC expansion as well.
Now in your code, the specification of the experimental design is this line:
MetaOpts.ExpDesign.NSamples = 50;
Using this specification, UQLab will automatically (and internally) generate 50 experimental design points based on
myModel (the full computational model) and
myInput (the probabilistic input model) you created before. Every time you call
uq_createModel for PCK, a new experimental design is generated. So it is normal that you get a different number of coefficients because the LARS algorithm operates on a different set of points. In the convential Kriging model, you set the trend to be quadratic, and because there’s only one form of quadratic in UQLab, the trend always has 15 coefficients.
If you want to get the same results from each time you call
uq_createModel for PCK, there are two ways:
- Set the random seed number before you call
uq_createModel. This will ensure that the same experimental design points will be the same every time
uq_createModel is called.
- Generate the experimental design points separately and use the same design to create the PCK model. You can do this by specifying a pre-generated experimental design to
MetaOpts.ExpDesign.Y configuration options, instead of specifying
Also note that the option you set on Line 32:
MetaOpts.Trend.Type = 'quadratic'; is irrelevant for a PCK model because the trend is not quadratic (as defined in the Kriging manual) but a PCE.
This, as you notice, won’t disrupt the calculation but you should be aware that the resulting trend is not quadratic in the PCK model as set by the option.
Because PCK uses both PCE and Kriging, it is important to understand for each method the underlying formulation, algorithms involved, as well as the default of the relevant options used in UQLab.
I’m a bit curious though, what is it that you’re trying to do? Maybe you can tell a bit about the big picture of your original question.
Hope this helps.