
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
"Tom Lane" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "walala" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > If I already know a prior that my data distribution should follow the > shape > > of Laplacian distribution... the data obtained from measurement is of > course > > a little off(not very symmtrical), how can I make the measured data more > > Laplacian distribution like(make it at least a little more symmtrical)? > > Walala, others have already responded that it's unusual to modify data to > fit a distribution. However, it is common to fit a distribution to data. > That distribution may be a "more symmetric" model for the process that > generated the data. You'd probably also want to test your assumption that > this is a good fit, either informally (maybe with a graph) or formally (with > a hypothesis test). Could it be that you really want information about how > to fit a Laplace distribution? > > Here's a bit of MATLAB code that generates some normal data and fits a > Laplace distribution to it, then compares a histogram of the data to the > re-scaled Laplace density, which is symmetric. > > % Generate normal data, just for example > N = 50; > x = 20 + 2*randn(N,1); > > % Fit the Laplace parameters > mu = median(x); > sig = mean(abs(x-mu)); > > % Compare a histogram to the fitted distribution > hist(x,floor(min(x)):ceil(max(x))) > xlim = get(gca,'xlim'); > xx = linspace(xlim(1),xlim(2),200); > yy = N * exp(-abs( (xx-mu)/sig ))/(2*sig); > hold on; plot(xx,yy,'r-'); hold off > > -- Tom > > Thanks a lot, Tom! The matlab code did really help a lot! Having been doing C programming for 10+ years I now completely rely on Matlab to do my work... By the way, the code is for fitting a Laplician to data and get the parameters from the data; do you have code for shaping data to this Laplican distribution? I just want to see you have this then I don't need to get the statistics book to dig into... :=) Rgs, -Walala
| <-- __Chronological__ --> | <-- __Thread__ --> |