0
$\begingroup$

So I have some (x,y) data from an oscilloscope. These numbers form a more or less gaussian shape. I am trying to extract the skewness of this shape, but the skewness functions only seem to accept density functions and I can't figure out how to switch it over. I've tried WeightedData[] using the time axis as the main, and the voltage axis as the weight, but it just gives a straight line in the density function. Everything I try just acts on the individual columns.

Here is the data,

Dn = {{0.9750137`, 0.`}, {0.97501375`, 
   0.0002734299999999981`}, {0.9750138`, 
   0.0003125000000000003`}, {0.97501385`, 
   0.0003125000000000003`}, {0.9750139`, 
   0.0003125000000000003`}, {0.97501395`, 
   0.0003515599999999973`}, {0.975014`, 
   0.0003906199999999978`}, {0.97501405`, 
   0.0005468699999999979`}, {0.9750141`, 
   0.0009374999999999974`}, {0.97501415`, 
   0.001210929999999999`}, {0.9750142`, 
   0.001210929999999999`}, {0.97501425`, 
   0.0014062499999999978`}, {0.9750143`, 
   0.0016406199999999989`}, {0.97501435`, 
   0.001796869999999999`}, {0.9750144`, 
   0.0019140599999999987`}, {0.97501445`, 
   0.0020312499999999983`}, {0.9750145`, 
   0.0021874999999999985`}, {0.97501455`, 
   0.0019531199999999992`}, {0.9750146`, 
   0.0016406199999999989`}, {0.97501465`, 
   0.0015234299999999992`}, {0.9750147`, 
   0.0012499999999999976`}, {0.97501475`, 
   0.0008984299999999987`}, {0.9750148`, 
   0.0005859299999999984`}, {0.97501485`, 
   0.0005468699999999979`}, {0.9750149`, 
   0.00046874999999999695`}, {0.97501495`, 
   0.0003906199999999978`}, {0.975015`, 
   0.00019530999999999715`}, {0.97501505`, 
   0.0002734299999999981`}, {0.9750151`, 
   0.00019530999999999715`}, {0.97501515`, 
   0.00023436999999999764`}, {0.9750152`, 
   0.00019530999999999715`}, {0.97501525`, 
   0.0003515599999999973`}, {0.9750153`, 0.0003125000000000003`}}

This is a plot of the data, I want it converted to a probability function so that I can get the skewness and probably kurtosis as well

This is a plot of the data, I want it converted to a probability function so that I can get the skewness and probably kurtosis as well.

I have tried

WeightedData[Dn[[All, 1]], Dn[[All, 2]]]

But when I plot it it just gives me this:

enter image description here

I've also tried HistogramDistribution, and EmpiricalDistribution, none of these work. If there was some way of making the computer think this was a histogram that would be all I would need.

$\endgroup$
5
  • $\begingroup$ If you don't have a random sample from a probability distribution so you shouldn't be using summary statistics built to describe probability distributions. It appears that you have voltage over time which maybe suggests a regression analysis with a curve form with a shape that might be a of the form $a + b e^{-(t-c)^2/d}$. $\endgroup$
    – JimB
    Aug 7 '20 at 20:26
  • $\begingroup$ Technically it is a probability distribution from the nitrogen ions in the bunches of a particle beam. I'm trying to measure out the way the bunch evolves over time, where it develops a noticeable skew. I already fitted it to a gaussian, I'm trying to go deeper than that. $\endgroup$
    – SciFlyGal
    Aug 7 '20 at 20:31
  • $\begingroup$ "Evolving over time" sure sounds like a regression or time series to me (and both of those do involve probability distributions). But if you could share the data and/or show what you've done so far, that would help in knowing what to provide for an answer. $\endgroup$
    – JimB
    Aug 7 '20 at 20:56
  • $\begingroup$ I've updated the initial question. Basically this is one of many snapshots of the beam bunch as it evolves, which is what I'm trying to measure. $\endgroup$
    – SciFlyGal
    Aug 7 '20 at 21:11
  • $\begingroup$ (-1) It wouldn't be the first time that I've been completely wrong but I think that skewness and kurtosis belong to probability distributions and that's not what you have. (Yes, there is some randomness associated with each measurement over time but doesn't correspond to calling a plot of voltage over time something equivalent to a probability distribution.) My suggestion is to get a second opinion at stats.stackexchange.com as your question is really the need to find a measure of symmetry and peakedness for a set of points. Then back here to implement in Mathematica. $\endgroup$
    – JimB
    Aug 7 '20 at 22:23
0
$\begingroup$

OK so I figured it out. Basically I make an InterpolatingFunction out of the distribution.

G=Interpolation[Dn];
R=ProbabilityDistribution[G[x],{x,Dn[[1,1]],Dn[[Length[Dn[[All,1]]],1]]},Method->"Normalize"];
N[Skewness[R]]
N[Kurtosis[R]]

You have to normalize or it won't work. Thanks to these folks for that: Generate data through RandomVariate from an interpolated distribution

Essentially I am taking a measured histogram and extracting statistical data from it.

I figured it out when a friend suggested I use this method: https://mathematica.stackexchange.com/a/131762

It would have worked as well, this is just simpler.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.