Stats

Popular Posts

Followers

Mathematica 教學 Q-Q Plot

戴忠淵 於 2010年11月28日星期日 下午12:26 發表





qqplot[data_]:=
Show[
Plot[x,{x,0,1},PlotStyle->{Red,Dashed}],
ListPlot[Transpose@{N@Range[Length@data]/Length[data],
CDF[NormalDistribution[Mean@data,StandardDeviation@data],#]&/@Sort[data]},
PlotStyle->PointSize[0.01],Joined->True,
Mesh->All],
Axes->None,Frame->True,AspectRatio->1,
FrameLabel->{Text[Style["Empirical Probability",FontSize->14]],
Text[Style["Theoretical Probability",FontSize->14]]}]

(* 觀察t分配在自由度與常態分配的關係 *)

Manipulate[qqplot[RandomReal[ChiSquareDistribution[z],500]],{z,1,200,5}]

(* 使用Mathematica8內建的QuantilePlot *)

Manipulate[
QuantilePlot[RandomReal[StudentTDistribution[z],500]],{z,1,200,5}]
Tags: , ,

讀者回應 ( 0 意見 )

發佈留言

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~