Wolfram 언어

확률과 통계의 수량

수량을 사용한 파생 분포 구축

TransformedDistribution을 사용하여 수량 값 함수의 분포를 지정합니다.

In[1]:=
Click for copyable input
speed = \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "speed of sound in air", Typeset`boxes$$ = TemplateBox[{ InterpretationBox[" ", 1], "\"speeds of sound in dry air at 20 \[Degree]C and 1 \ atmosphere pressure\"", "speeds of sound in dry air at 20 \[Degree]C and 1 atmosphere \ pressure", "\"SpeedOfSound\""}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {{ "type" -> "MultiClash", "word" -> "", "template" -> "Assuming ${word1} is referring to ${desc1}. \ Use as ${desc2} instead. Use \"${word3}\" as ${desc3}. Use \"${word4}\ \" as ${desc4}.", "count" -> "4", "Values" -> {{ "name" -> "Unit", "word" -> "the input", "desc" -> "a unit", "input" -> "*MC.%7E-_*Unit-"}, { "name" -> "Formula", "word" -> "the input", "desc" -> "a formula", "input" -> "*MC.%7E-_*Formula-"}, { "name" -> "Thermodynamic", "word" -> "air", "desc" -> "a thermodynamic material", "input" -> "*MC.%7E-_*Thermodynamic-"}, { "name" -> "Chemical", "word" -> "air", "desc" -> "a chemical compound", "input" -> "*MC.%7E-_*Chemical-"}}}}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 0.8160297`7.363250959003981, "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->{398., {30., 18.}}, 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[2]:=
Click for copyable input
distance\[ScriptCapitalD] = TransformedDistribution[speed*Quantity[t, "Seconds"], t \[Distributed] UniformDistribution[{2, 4}]]
Out[2]=

분포의 단위를 킬로미터로 변환합니다.

In[3]:=
Click for copyable input
UnitConvert[distance\[ScriptCapitalD], "Kilometers"]
Out[3]=

TransformedDistribution을 사용하여 확률 변수를 수량과 함께 결합합니다.

In[4]:=
Click for copyable input
TransformedDistribution[ Subscript[x, 0] + v*t, {Subscript[x, 0] \[Distributed] NormalDistribution[\!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "2 m", Typeset`boxes$$ = TemplateBox[{"2", "\"m\"", "meters", "\"Meters\""}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {{ "type" -> "Clash", "word" -> "m", "template" -> "Assuming \"${word}\" is ${desc1}. Use as \ ${desc2} instead", "count" -> "2", "Values" -> {{ "name" -> "Unit", "desc" -> "a unit", "input" -> "*C.m-_*Unit-"}, { "name" -> "Variable", "desc" -> "a variable", "input" -> "*C.m-_*Variable-"}}}, { "type" -> "Unit", "word" -> "m", "template" -> "Assuming ${desc1} for \"${word}\". Use \ ${desc2} instead", "count" -> "3", "Values" -> {{ "name" -> "Meters", "desc" -> "meters", "input" -> "UnitClash_*m.*Meters--"}, { "name" -> "MinimsUS", "desc" -> "US minims of volume", "input" -> "UnitClash_*m.*MinimsUS--"}, { "name" -> "Minutes", "desc" -> "minutes of time", "input" -> "UnitClash_*m.*Minutes--"}}}}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 1.4079785`7.600141016624048, "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->{86., {8., 16.}}, 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]\), \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "2 cm", Typeset`boxes$$ = TemplateBox[{"2", "\"cm\"", "centimeters", "\"Centimeters\""}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 3.2360033`7.961553949319721, "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->{70., {8., 16.}}, 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]\)], v \[Distributed] RayleighDistribution[\!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "5 kmph", Typeset`boxes$$ = TemplateBox[{"5", RowBox[{"\"km\"", " ", "\"/\"", " ", "\"h\""}], "kilometers per hour", FractionBox["\"Kilometers\"", "\"Hours\""]}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 0.3549929`7.00176466057457, "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->{86., {8., 16.}}, 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]\)], t \[Distributed] GammaDistribution[3, \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "5 min", Typeset`boxes$$ = TemplateBox[{"5", "\"min\"", "minutes", "\"Minutes\""}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {{ "type" -> "Clash", "word" -> "min", "template" -> "Assuming \"${word}\" is ${desc1}. Use as \ ${desc2} instead", "count" -> "3", "Values" -> {{ "name" -> "Unit", "desc" -> "a unit", "input" -> "*C.min-_*Unit-"}, { "name" -> "OptimizationWord", "desc" -> " referring to optimization", "input" -> "*C.min-_*OptimizationWord-"}, { "name" -> "HistoricalCountry", "desc" -> "a historical country", "input" -> "*C.min-_*HistoricalCountry-"}}}, { "type" -> "Unit", "word" -> "min", "template" -> "Assuming ${desc1} for \"${word}\". Use \ ${desc2} instead", "count" -> "3", "Values" -> {{ "name" -> "Minutes", "desc" -> "minutes of time", "input" -> "UnitClash_*min.*Minutes--"}, { "name" -> "MinimsUS", "desc" -> "US minims of volume", "input" -> "UnitClash_*min.*MinimsUS--"}, { "name" -> "ArcMinutes", "desc" -> "minutes of arc", "input" -> "UnitClash_*min.*ArcMinutes--"}}}}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 0.4070055`7.0611452715258896, "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->{101., {8., 16.}}, 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]\)]}]
Out[4]=

TransformedDistribution을 사용하여 확률 변수의 크기를 결합합니다.

In[5]:=
Click for copyable input
TransformedDistribution[QuantityMagnitude[t, "Celsius"], t \[Distributed] NormalDistribution[Quantity[293.15, "Kelvins"], Quantity[5.2, "Kelvins"]]]
Out[5]=

또는 Quantity[x, unit]의 분포를 x가 지정된 unit의 확률 변수의 크기를 나타내는 바와 같이 정의 할 수있습니다.

In[6]:=
Click for copyable input
TransformedDistribution[t, Quantity[t, "Celsius"] \[Distributed] NormalDistribution[Quantity[293.15, "Kelvins"], Quantity[5.2, "Kelvins"]]]
Out[6]=

예를 들어, 일리노이 주 시카고의 겨울 기온과 풍속의 분포를 가정하여 화씨로 북미의 풍속 냉각 도수 분포를 표현합니다.

In[7]:=
Click for copyable input
wcTemp\[ScriptCapitalD] = TransformedDistribution[ 35.74 + 0.6215 QuantityMagnitude[Ta, "DegreesFahrenheit"] + (0.4275 QuantityMagnitude[Ta, "DegreesFahrenheit"] - 35.75) QuantityMagnitude[V, "Miles"/"Hours"]^+0.16, {V \[Distributed] WeibullDistribution[2.81, \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "4.846 m/s", Typeset`boxes$$ = TemplateBox[{"4.846", RowBox[{"\"m\"", " ", "\"/\"", " ", "\"s\""}], "meters per second", FractionBox["\"Meters\"", "\"Seconds\""]}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {{ "type" -> "MultiClash", "word" -> "", "template" -> "Assuming ${word1} is referring to ${desc1}. \ Use \"${word2}\" as ${desc2}.", "count" -> "2", "Values" -> {{ "name" -> "Unit", "word" -> "m/s", "desc" -> "a unit", "input" -> "*MC.m%2Fs-_*Unit-"}, { "name" -> "Variable", "word" -> "m", "desc" -> "a variable", "input" -> "*MC.m%2Fs-_*Variable-"}}}, { "type" -> "Unit", "word" -> "m/s", "template" -> "Assuming ${desc1} for \"${word}\". Use \ ${desc2} instead", "count" -> "2", "Values" -> {{ "name" -> "MetersPerSecond", "desc" -> "meters per second", "input" -> "UnitClash_*m%2Fs.*MetersPerSecond--"}, { "name" -> "MinutesPerSecond", "desc" -> "minutes per second", "input" -> "UnitClash_*m%2Fs.*MinutesPerSecond--"}}}}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 0.5190047`7.166716284243896, "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->{133., {8., 16.}}, 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]\)], Ta \[Distributed] TriangularDistribution[{\!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "20 Fah", Typeset`boxes$$ = TemplateBox[{ "20", "\"\[Degree]F\"", "degrees Fahrenheit", "\"DegreesFahrenheit\""}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 0.5190113`7.166721806978768, "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->{78., {8., 16.}}, 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]\), \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "48 Fah", Typeset`boxes$$ = TemplateBox[{ "48", "\"\[Degree]F\"", "degrees Fahrenheit", "\"DegreesFahrenheit\""}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 1.3720224`7.588906195330978, "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->{78., {8., 16.}}, 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]\)}, \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "30 Fah", Typeset`boxes$$ = TemplateBox[{ "30", "\"\[Degree]F\"", "degrees Fahrenheit", "\"DegreesFahrenheit\""}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 0.2719958`6.8861071914606615, "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->{78., {8., 16.}}, 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]\)]}]
Out[7]=

모집단 표본에서의 풍속 냉각 도수의 평활 커널 밀도 추정을 플롯합니다.

전체 Wolfram 언어 입력 표시하기
In[8]:=
Click for copyable input
SmoothHistogram[RandomVariate[wcTemp\[ScriptCapitalD], 10^5], Filling -> Axis, AxesLabel -> {"\[Degree]F"}, Epilog -> {Directive[Dashed, Red], InfiniteLine[{{32, 0}, {32, 1}}]}]
Out[8]=

관련 예제

de en es fr ja pt-br ru zh