0

If I fit a uni-variate data with normal distribution, how can i get back the fitted values in MATLAB. I am using this simple example

load hospital % data
x = hospital.Weight;
[mu sigma]=normfit(x) %normal fitting
%To visualize the pdf
xval=min(x):0.1:max(x)
yval=normpdf(xval,mu,sigma)
plot(xval,yval)

yval is giving the probabilities of xval values. Now, If I would like to extract the fitted values of 'x' after approximating it with the above normal distribution, how do I do that?. As can be seen in the picture the y-axis values are the pdf and lies between 0 and 1, however I want the corresponding fitted values from the data that follows normal distribution.

Would the fitted values be x_fitted = yval*sigma + mu? !I think I am missing some basic maths here.

4

1 回答 1

1

normfit简单地为您提供拟合的正常 pdf 的musigma。从那些你用normpdf. 因此,您输入的所需yx将是

y = normpdf(x,mu,sigma)

你可以用它来绘制

hold on
plot(x,y,'ro')

在此处输入图像描述

请注意,使用此过程,数据完全位于正态 pdf 上,即使这些数据实际上并不遵循正态分布。

于 2013-11-06T11:18:57.090 回答