Wolfram言語

確率と統計における数量

恒星の特性を調べる

StarDataは,105 個を超える数の恒星の特性へのアクセスを提供する.3000個の恒星をランダムサンプルとして選ぶ.

In[1]:=
Click for copyable input
stars = StarData[{"RandomEntities", 3000}];

それぞれの実体について数多くの特性が提供されている.

In[2]:=
Click for copyable input
sun = \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "Sun", Typeset`boxes$$ = TemplateBox[{"\"Sun\"", RowBox[{"Entity", "[", RowBox[{"\"Star\"", ",", "\"Sun\""}], "]"}], "\"Entity[\\\"Star\\\", \\\"Sun\\\"]\"", "\"star\""}, "Entity"], Typeset`allassumptions$$ = {{ "type" -> "Clash", "word" -> "Sun", "template" -> "Assuming \"${word}\" is ${desc1}. Use as \ ${desc2} instead", "count" -> "4", "Values" -> {{ "name" -> "Star", "desc" -> " referring to stars", "input" -> "*C.Sun-_*Star-"}, { "name" -> "CalendarEventName", "desc" -> "a weekday", "input" -> "*C.Sun-_*CalendarEventName-"}, { "name" -> "Word", "desc" -> "a word", "input" -> "*C.Sun-_*Word-"}, { "name" -> "Surname", "desc" -> "a surname", "input" -> "*C.Sun-_*Surname-"}}}}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 1.321761`6.572697926887039, "Messages" -> {}}}, DynamicBox[ToBoxes[ AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic, Dynamic[Typeset`query$$], Dynamic[Typeset`boxes$$], Dynamic[Typeset`allassumptions$$], Dynamic[Typeset`assumptions$$], Dynamic[Typeset`open$$], Dynamic[Typeset`querystate$$]], StandardForm], ImageSizeCache->{114., {7., 15.}}, TrackedSymbols:>{ Typeset`query$$, Typeset`boxes$$, Typeset`allassumptions$$, Typeset`assumptions$$, Typeset`open$$, Typeset`querystate$$}], DynamicModuleValues:>{}, UndoTrackedVariables:>{Typeset`open$$}], BaseStyle->{"Deploy"}, DeleteWithContents->True, Editable->False, SelectWithContents->True]\);
In[3]:=
Click for copyable input
StarData[sun, "Properties"] // Length
Out[3]=

ランダムに選ばれた恒星の有効温度を抽出し,そのうちでデータが利用できるものを選ぶ.

In[4]:=
Click for copyable input
temps = Flatten[ DeleteMissing[StarData[#, "EffectiveTemperature"]] & /@ Partition[stars, 100]];

温度の記述統計量をいくつか計算する.

In[5]:=
Click for copyable input
stats = {Min, Max, Mean, Median, StandardDeviation}; TableForm[{Map[#[temps] &, stats]}, TableHeadings -> {None, stats}]
Out[5]//TableForm=

恒星温度のヒストグラムをプロットする.

In[6]:=
Click for copyable input
h = Histogram[temps, 25, PDF, AxesLabel -> Automatic]
Out[6]=

ノンパラメトリック分布で温度の分布を推定する.

In[7]:=
Click for copyable input
skd = SmoothKernelDistribution[temps, "Oversmooth"]
Out[7]=

長い裾を持つパラメトリック分布で温度の分布を推定する.

In[8]:=
Click for copyable input
edist = EstimatedDistribution[temps, StableDistribution[a, b, c, d]]
Out[8]=

確率密度関数の推定値を比べ,太陽の温度に関連付ける.

完全なWolfram言語入力を表示する
In[9]:=
Click for copyable input
pdf = PDF[skd, Quantity[x, "Kelvins"]]; sunTemp = {Directive[Red, Dashed], InfiniteLine[{{#, 0}, {#, 1}} &[ QuantityMagnitude[sun["EffectiveTemperature"]]]]}; Show[h, Plot[{pdf, PDF[edist, Quantity[x, "Kelvins"]]}, {x, 0, QuantityMagnitude@Max[temps]}, PlotRange -> All, PlotLegends -> {"Smooth Kernel Distribution Estimate", "Stable Distribution Estimate"}], Epilog -> {sunTemp, Inset[Style["Sun", Red, 12], {6800, .00034}]}]
Out[9]=

関連する例

de en es fr ko pt-br ru zh