A function to facilitate performing of simulations
一个功能,方便进行模拟
用法----------Usage----------
do(.n)
参数----------Arguments----------
参数:.n
A positive integer
一个正整数,
Details
详细信息----------Details----------
This function facilitates simulations. It is called in two steps. The first sets up a function which will to .n simulations. This function is then called with a block of commands and returns the simulation.
此功能便于模拟。这就是所谓的在两个步骤中。的设立一个函数,它将.n模拟。然后,调用此功能块命令并返回模拟。
值----------Value----------
Returns a function which will repeat a block of commands for purposes of simulation.
返回一个函数,它将重复命令的目的仿真方框图。
注意----------Note----------
do is due to Daniel Kaplan.
do是由于丹尼尔·卡普兰。
(作者)----------Author(s)----------
Daniel Kaplan
参见----------See Also----------
replicate
replicate
实例----------Examples----------
aFew <- do(5)
aLot <- do(100)
## simple call[#简单的调用]
aFew(mean(rnorm(100)))
## t-statistic simulation[#t-统计量模拟]
aFew({x <- rexp(10); t.test(x)$stat})
## view correlation of regression coefficients. Returns a data.frame[#查看回归系数的相关性。返回一个数据框]
x <- 1:10
res <- aLot({y <- rnorm(1+2*x); coef(lm(y~x))})
plot(res)