Check predicted weather values ​​after gaussian distribution or not use Matlab?

I used the Gaussian Process for my prediction. Now, suppose I have predicted a store value x

of 1900 X 1. Now I want to check if its distribution should follow a Gaussian distribution or not. I need this to compare distribution functions of other methods with predicted values ​​such as NN, KNN to judge which one follows smooth Gaussian or normal distribution functions

How can i do this? It's better if I get some result as numeric data. the code is written as follows,
       m = mean(ypred); % mean of r s = std(ypred); % stdev of r pd = makedist('Normal','mu',m,'sigma',s); % make probability distribution with mu = m and sigma = s [h,p] = kstest(ypred,'CDF',pd); % calculate probability that it is a normal distribution

The value ypred

is the output obtained fitrgp

from matlab. An example of values ​​is ypred

attached here

[figure] 2 is the residual of the qq_plot

measured and predicted values.

+3


source to share


1 answer


You can do the Kolmogorov-Smirnov Single Chamber Test :

x = 1 + 2.*randn(1000,1); % just some random normal distributed data, replace it with your actual 1900x1 vector.

m = mean(x); % mean of r
s = std(x); % stdev of r
pd = makedist('Normal','mu',m,'sigma',s); % make probability distribution with mu = m and sigma = s
[h,p] = kstest(x,'CDF',pd); % calculate probability that it is a normal distribution

      

Where p

is the probability that it follows a normal distribution and h = 1

if the null hypothesis is rejected with a value of 0.05. Since the null hypothesis "is normally distributed" h = 0

means that it is normally distributed.



Since it x

was in this example, was chosen from the normal distribution, most likely, h = 0

and p > 0.05

. If you run the code above with

x = 1 + 2.*rand(1000,1); % sampled from uniform distribution

      

h

is likely to be 1 and p<0.05

. You can of course write everything as a one-liner to avoid being created m

, s

and pd

.

0


source







All Articles