- dnorm()
dnorm(x, mean, sd)>pnorm()
pnorm(x, mean, sd)>qnorm()
qnorm(p, mean, sd)>rnorm()
rnorm(n, mean, sd)>どこ、
– バツ 値のデータセットを表します – 平均(x) データセットの平均を表します バツ 。デフォルト値は 0 です。>– sd(x) データセットの標準偏差を表します バツ 。デフォルト値は 1 です。>– n 観測値の数です。 – p 確率のベクトルです
R で正規分布を生成する関数
dnorm()
dnorm()> R プログラミングの関数は、分布の密度関数を測定します。統計では、次の式で測定されます。>どこ、
意地悪であり、
は標準偏差です。 構文: dnorm(x, mean, sd)>例:
# creating a sequence of values> # between -15 to 15 with a difference of 0.1> x>=> seq(>->15>,>15>, by>=>0.1>)> > y>=> dnorm(x, mean(x), sd(x))> > # output to be present as PNG file> png(>file>=>'dnormExample.webp'>)> > # Plot the graph.> plot(x, y)> > # saving the file> dev.off()> |
>
>出力:
pnorm()
pnorm()> 関数は、乱数 X が x 以下の値を取る確率を測定する累積分布関数です。つまり、統計では次のように与えられます。>構文:
pnorm(x, mean, sd)>例:
# creating a sequence of values> # between -10 to 10 with a difference of 0.1> x <>-> seq(>->10>,>10>, by>=>0.1>)> > y <>-> pnorm(x, mean>=> 2.5>, sd>=> 2>)> > # output to be present as PNG file> png(>file>=>'pnormExample.webp'>)> > # Plot the graph.> plot(x, y)> > # saving the file> dev.off()> |
>
>出力:
qnorm()
qnorm()> 関数はの逆関数です pnorm()>関数。確率値を取得し、確率値に対応する出力を与えます。正規分布のパーセンタイルを見つけるのに役立ちます。 構文: qnorm(p, mean, sd)>例:
# Create a sequence of probability values> # incrementing by 0.02.> x <>-> seq(>0>,>1>, by>=> 0.02>)> > y <>-> qnorm(x, mean(x), sd(x))> > # output to be present as PNG file> png(>file> => 'qnormExample.webp'>)> > # Plot the graph.> plot(x, y)> > # Save the file.> dev.off()> |
>
>出力:
rnorm()
rnorm()> R プログラミングの関数は、正規分布する乱数のベクトルを生成するために使用されます。 構文: rnorm(x, mean, sd)>例:
# Create a vector of 1000 random numbers> # with mean=90 and sd=5> x <>-> rnorm(>10000>, mean>=>90>, sd>=>5>)> > # output to be present as PNG file> png(>file> => 'rnormExample.webp'>)> > # Create the histogram with 50 bars> hist(x, breaks>=>50>)> > # Save the file.> dev.off()> |
>
>出力: