0
$\begingroup$

I have distribution which I want to calculate the third order moment function of my distribution. I got confused what is different between Moment third order and skewness and which one are correct for my purpose.

this is what I am writing?

data1 = RandomVariate[NormalDistribution[2, 2.5]];
data2 = RandomVariate[NormalDistribution[1, 0.5],];
i = Abs[Moment[data1, 3]];
i1 = Abs[Moment[data2, 3]];

or I can

Skewness[RandomVariate[NormalDistribution[2.5, 2.5]]]?
$\endgroup$
2
  • $\begingroup$ Which third order moment? Raw, Central or other? These aspects of the question are not related to Mathematica. $\endgroup$
    – wolfies
    Commented Feb 10, 2021 at 3:05
  • $\begingroup$ @wolfies Is it right that the second, third and fourth central moments can be expressed in terms of the raw moments: which here i need the third one which is skewness. Am i right? $\endgroup$
    – Mreza
    Commented Feb 10, 2021 at 3:17

1 Answer 1

2
$\begingroup$

"which one are correct for my purpose" Depends, what is your purpose?

SeedRandom[1234];

dist1 = NormalDistribution[2, 2.5];

data must have more than one sample. Using sample size of 100

data1 = RandomVariate[dist1, 100];

dist2 = NormalDistribution[1, 0.5];

data2 = RandomVariate[dist2, 100];

{Style[#, 14, Bold], v = ToExpression[#]; Moment[v, 3], CentralMoment[v, 3], 
     Skewness[v]} & /@ {"dist1", "data1", "dist2", "data2"} //
  Prepend[#, 
    Style[#, 14, Bold] & /@
     {"", Moment[3], CentralMoment[3], 
      Skewness}] & //
 Grid[#, Frame -> All] &

enter image description here

EDIT: Skewness is a "normalized" (dimensionless) third central moment.

SeedRandom[1234];

dist1 = NormalDistribution[Quantity[2, "Meter"], Quantity[2.5, "Meter"]];

data1 = RandomVariate[dist1, 100];

dist2 = NormalDistribution[Quantity[1, "Meter"], Quantity[0.5, "Meter"]];

data2 = RandomVariate[dist2, 100];

{Style[#, 14, Bold], v = ToExpression[#]; Moment[v, 3], CentralMoment[v, 3], 
     Skewness[v]} & /@ {"dist1", "data1", "dist2", "data2"} // 
  Prepend[#, 
    Style[#, 14, Bold] & /@ {"", Moment[3], CentralMoment[3], Skewness}] & // 
 Grid[#, Frame -> All] &

enter image description here

$\endgroup$
2
  • $\begingroup$ @ Bob Hanlon Thanks for your help , My purpose is calculate the third order moment function for a l distribution which its mean is not zero. I am little get confused why the skewness and third order of central moment are different? should they be same? $\endgroup$
    – Mreza
    Commented Feb 10, 2021 at 4:42
  • 2
    $\begingroup$ @Mreza - As stated in the documentation for Skewness, "Skewness[ ... ] is equivalent to CentralMoment[ ..., 3]/CentralMoment[ ..., 2]^(3/2)". $\endgroup$
    – Bob Hanlon
    Commented Feb 10, 2021 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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