階段関数、経験分布関数
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
COLOR(red){SIZE(20){階段関数、経験分布関数}}
([[グラフィックス参考実例集]]に戻る。[[Rのグラフィックス...
R の標準ライブラリの一つである COLOR(magenta){stepfun} は...
#contents
~
** データから経験分布関数を計算する関数 ecdf() [#cf815d6d]
R の標準ライブラリの一つである COLOR(magenta){stepfun} は...
- COLOR(magenta){用法}
-- COLOR(red){ecdf(x)} 数値データをクラス "ecdf" のオブジ...
-- COLOR(red){plot(x, ..., ylab="Fn(x)", verticals = FALS...
-- COLOR(red){print(x, digits= getOption("digits") - 2, ....
- COLOR(magenta){引数}
-- COLOR(red){x} クラス ecdf の観測値数値ベクトル
-- COLOR(red){...} 'plot.stepfun' に引き渡される追加引数
-- COLOR(red){ylab} y-軸ラベル
-- COLOR(red){verticals} 'plot.stepfun' を見よ
-- COLOR(red){ol.01line} 線 y=0, y=1 に引かれる水平線の色...
-- COLOR(red){digits} 用いられる有効数字桁数
- COLOR(magenta){詳細}
-- e.c.d.f. (累積経験分布関数, empirical cumulative distr...
Fn(t) = #{x_i <= t} / n = 1/n sum(i=1,n) Indicator(xi ...
-- 関数 'plot.ecdf' は "ecdf" オブジェクトに対する 'plot'...
COLOR(magenta){返り値} クラス "ecdf" の関数で、"stepfun" ...
*** 例1 [#e5031203]
> sf <- ecdf(sort(runif(15))) # ecdf そして stepfun は実...
> sf(0.23)
[1] 0.2666667
*** 例2 [#fb38f0b2]
library(stepfun) # ライブラリ stepfun を読み込み
y <- round(rnorm(12),1); y[3] <- y[1] # 参考データ(わざ...
Fn12 <- ecdf(y) # クラス ecdf のオブジェクトに変換
par(mfrow=c(3,1), mgp=c(1.5, 0.8,0), mar= .1+c(3,3,2,1))...
F10 <- ecdf(rnorm(10)) # もう一つの参考データ
plot(F10)
plot(F10, verticals= TRUE, do.p = FALSE)
plot(Fn12)# , lwd=2) dis-regarded
#ref(階段関数、経験分布関数/stepfun1.jpg, left)
*** 例3 [#y818c94a]
library(stepfun) # ライブラリ stepfun を読み込み
xx <- unique(sort(c(seq(-3,2, length=201), knots(Fn12))))
lines(xx, Fn12(xx), col='blue')
abline(v=knots(Fn12),lty=2,col='gray70')
plot(xx, Fn12(xx), type='b', cex=.1) #- plot.default
plot(Fn12, col.h='red', add= TRUE) # データ位置に縦線を...
abline(v=knots(Fn12),lty=2,col='gray70')
plot(Fn12, verticals=TRUE, col.p='blue', col.h='red',col...
#ref(階段関数、経験分布関数/stepfun2.jpg, left)
*** 例4 [#o4781191]
library(stepfun) # ライブラリ stepfun を読み込み
plot.ecdf(rnorm(24)) # 自動的に ecdf(.) を呼び出す
#ref(階段関数、経験分布関数/stepfun3.jpg, left)
** 与えられた結び目を通る階段関数を計算する stepfun() 関...
-COLOR(magenta){説明} ベクトル (x[1],..., x[n]) と (y[0],...
fn(t) = c[i] (定数) for t in (x[i], x[i+1])
fn(x[i]) = y[i] 'right = FALSE' (既定)のとき、
fn(x[i]) = y[i-1] 'right = TRUE' の時
定数 c[i] の値は「連続性パラメータ」COLOR(red){f} に依存...
-COLOR(magenta){使用法}
--COLOR(red){stepfun(x, y, f = as.numeric(right), ties = ...
--COLOR(red){is.stepfun(x)}
--COLOR(red){knots(Fn, ...)}
--COLOR(red){as.stepfun(x, ...)}
--COLOR(red){print(x, digits = getOption("digits") - 2, ....
--COLOR(red){summary(object, ...)}
-COLOR(magenta){引数}
--COLOR(red){x} ジャンプ点を表す数値ベクトル。
--COLOR(red){y} x より一つ長い数値ベクトル。x の値の間の...
--COLOR(red){f} 0 と 1 の間の値。境界での y 値の補間方法...
--COLOR(red){ties} x のタイ値の扱い。処理方法を与える関数...
--COLOR(red){right} 論理値。各区間が右に閉(そして左に開)...
--COLOR(red){Fn} '"stepfun"' を継承する R オブジェクト
--COLOR(red){digits} 有効数字桁数
--COLOR(red){...} 潜在的に可能な追加引数(構文的に必要)
-COLOR(magenta){返り値} クラス COLOR(red){stepfun} の関数...
COLOR(red){plot.stepfun} を参照)。関数の環境は次のような...
--COLOR(red){"x"}, COLOR(red){"y"} 元データ
--COLOR(red){"n"} ノット(x の長さ)数
--COLOR(red){"f"}: 連続性パラメータ
--COLOR(red){"yleft"}, COLOR(red){"yright"} ノットの外部...
--COLOR(red){"method"} 常に '== "constant"'
--COLOR(red){normal-bracket109bracket-normal} ノットはま...
***例 [#u83487a2]
library(stepfun)
par(mfrow=c(2,2))
x <- sort(runif(10)); y <- runif(11)
plot(stepfun(x, y, f=0))
plot(stepfun(x, y, f=0.3))
plot(stepfun(x, y, f=0.7))
plot(stepfun(x, y, f=1.0))
#ref(階段関数、経験分布関数/stepfun4.jpg, left)
終了行:
COLOR(red){SIZE(20){階段関数、経験分布関数}}
([[グラフィックス参考実例集]]に戻る。[[Rのグラフィックス...
R の標準ライブラリの一つである COLOR(magenta){stepfun} は...
#contents
~
** データから経験分布関数を計算する関数 ecdf() [#cf815d6d]
R の標準ライブラリの一つである COLOR(magenta){stepfun} は...
- COLOR(magenta){用法}
-- COLOR(red){ecdf(x)} 数値データをクラス "ecdf" のオブジ...
-- COLOR(red){plot(x, ..., ylab="Fn(x)", verticals = FALS...
-- COLOR(red){print(x, digits= getOption("digits") - 2, ....
- COLOR(magenta){引数}
-- COLOR(red){x} クラス ecdf の観測値数値ベクトル
-- COLOR(red){...} 'plot.stepfun' に引き渡される追加引数
-- COLOR(red){ylab} y-軸ラベル
-- COLOR(red){verticals} 'plot.stepfun' を見よ
-- COLOR(red){ol.01line} 線 y=0, y=1 に引かれる水平線の色...
-- COLOR(red){digits} 用いられる有効数字桁数
- COLOR(magenta){詳細}
-- e.c.d.f. (累積経験分布関数, empirical cumulative distr...
Fn(t) = #{x_i <= t} / n = 1/n sum(i=1,n) Indicator(xi ...
-- 関数 'plot.ecdf' は "ecdf" オブジェクトに対する 'plot'...
COLOR(magenta){返り値} クラス "ecdf" の関数で、"stepfun" ...
*** 例1 [#e5031203]
> sf <- ecdf(sort(runif(15))) # ecdf そして stepfun は実...
> sf(0.23)
[1] 0.2666667
*** 例2 [#fb38f0b2]
library(stepfun) # ライブラリ stepfun を読み込み
y <- round(rnorm(12),1); y[3] <- y[1] # 参考データ(わざ...
Fn12 <- ecdf(y) # クラス ecdf のオブジェクトに変換
par(mfrow=c(3,1), mgp=c(1.5, 0.8,0), mar= .1+c(3,3,2,1))...
F10 <- ecdf(rnorm(10)) # もう一つの参考データ
plot(F10)
plot(F10, verticals= TRUE, do.p = FALSE)
plot(Fn12)# , lwd=2) dis-regarded
#ref(階段関数、経験分布関数/stepfun1.jpg, left)
*** 例3 [#y818c94a]
library(stepfun) # ライブラリ stepfun を読み込み
xx <- unique(sort(c(seq(-3,2, length=201), knots(Fn12))))
lines(xx, Fn12(xx), col='blue')
abline(v=knots(Fn12),lty=2,col='gray70')
plot(xx, Fn12(xx), type='b', cex=.1) #- plot.default
plot(Fn12, col.h='red', add= TRUE) # データ位置に縦線を...
abline(v=knots(Fn12),lty=2,col='gray70')
plot(Fn12, verticals=TRUE, col.p='blue', col.h='red',col...
#ref(階段関数、経験分布関数/stepfun2.jpg, left)
*** 例4 [#o4781191]
library(stepfun) # ライブラリ stepfun を読み込み
plot.ecdf(rnorm(24)) # 自動的に ecdf(.) を呼び出す
#ref(階段関数、経験分布関数/stepfun3.jpg, left)
** 与えられた結び目を通る階段関数を計算する stepfun() 関...
-COLOR(magenta){説明} ベクトル (x[1],..., x[n]) と (y[0],...
fn(t) = c[i] (定数) for t in (x[i], x[i+1])
fn(x[i]) = y[i] 'right = FALSE' (既定)のとき、
fn(x[i]) = y[i-1] 'right = TRUE' の時
定数 c[i] の値は「連続性パラメータ」COLOR(red){f} に依存...
-COLOR(magenta){使用法}
--COLOR(red){stepfun(x, y, f = as.numeric(right), ties = ...
--COLOR(red){is.stepfun(x)}
--COLOR(red){knots(Fn, ...)}
--COLOR(red){as.stepfun(x, ...)}
--COLOR(red){print(x, digits = getOption("digits") - 2, ....
--COLOR(red){summary(object, ...)}
-COLOR(magenta){引数}
--COLOR(red){x} ジャンプ点を表す数値ベクトル。
--COLOR(red){y} x より一つ長い数値ベクトル。x の値の間の...
--COLOR(red){f} 0 と 1 の間の値。境界での y 値の補間方法...
--COLOR(red){ties} x のタイ値の扱い。処理方法を与える関数...
--COLOR(red){right} 論理値。各区間が右に閉(そして左に開)...
--COLOR(red){Fn} '"stepfun"' を継承する R オブジェクト
--COLOR(red){digits} 有効数字桁数
--COLOR(red){...} 潜在的に可能な追加引数(構文的に必要)
-COLOR(magenta){返り値} クラス COLOR(red){stepfun} の関数...
COLOR(red){plot.stepfun} を参照)。関数の環境は次のような...
--COLOR(red){"x"}, COLOR(red){"y"} 元データ
--COLOR(red){"n"} ノット(x の長さ)数
--COLOR(red){"f"}: 連続性パラメータ
--COLOR(red){"yleft"}, COLOR(red){"yright"} ノットの外部...
--COLOR(red){"method"} 常に '== "constant"'
--COLOR(red){normal-bracket109bracket-normal} ノットはま...
***例 [#u83487a2]
library(stepfun)
par(mfrow=c(2,2))
x <- sort(runif(10)); y <- runif(11)
plot(stepfun(x, y, f=0))
plot(stepfun(x, y, f=0.3))
plot(stepfun(x, y, f=0.7))
plot(stepfun(x, y, f=1.0))
#ref(階段関数、経験分布関数/stepfun4.jpg, left)
ページ名: