I am using kernel marginals to fit my given input data. Hoever, it appears that the uqlab cannot accurately model my data while the matlab function ksdensity can model it well. The following picture is the histogram of the input data.
The following code is what I have done in the uqlab:
Your code is a little bit confusing to me. I am not sure if you are trying to construct your input or infer from the data. It might be helpful to start with the example: https://www.uqlab.com/input-inference-of-marginals
Thanks for your kind reply. Actually I an trying to use kernel estimation from my input data to construct an input marginal distribtuion.
Although the code runs smoothly, the estimated results do not fit my input data at all.
To be specific, I simulate some samples after creating an input object, however, these results deviate from my input data distribution as well as the results obtained from matlab function ksdensity. As you can see from the pictures above: the first one is the true data distribution, the second is the result obtained from uq_getSample, the third one is the result from ksdensity of matlab.
I thought that uqlab uses the matlab function ksdensity to conduct kernel estimation. Then why these results be so different? Thanks again.
I tested the inference function of UQLab, and it seems to be working well. Since I cannot see any data, I can only suggest checking step-by-step, looking into the “Sample” and “Object” parameters, or starting from the example that UQLab provides, as they define the Input object differently. However, I believe that both ways will reach the same result.
Sorry for the late reply. I have attached the matlab data of the Sample in the Sample.zip. My codes for using uqlab and matlab bulit-in fitdist to do kernel density estimate and draw samples are as follows:
Thank you for providing the data and pointing out this problem. We have investigated the issue and there is indeed a bug in UQLab. Fortunately, the problem is small and can be easily fixed.
Navigate to the following file in your UQLab installation: path_to_uqlab\modules\uq_input\builtin\uq_default_input\uq_initialize_uq_default_input.m.
and then change line 100 from uBounds(2) = min(KSPar) + ks.Nstd*stdKSPar;
to uBounds(2) = max(KSPar) + ks.Nstd*stdKSPar;