pmgRepeatTrials(mcaGUI)
pmgRepeatTrials()所属R语言包:mcaGUI
A function to simplify simulations
简化模拟函数
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A simple function to repeat an expression several times as an aid to simplifying simulations.
一个简单的功能,重复几次表达为简化模拟的援助。
用法----------Usage----------
pmgRepeatTrials(expr, n = 10)
参数----------Arguments----------
参数:expr
An R expression, such as rnorm(1) or {x <- rnorm(10); t.test(x)\$p.value} that will be repeated n times.
一个R的表达,如rnorm(1)或{x <- rnorm(10); t.test(x)\$p.value}将重复n倍。
参数:n
Number of times to repeat the expressions. The default is 10.
多次重复的表达式。默认为10。
Details
详情----------Details----------
This functions aids in doing simulations. Rather than explicitly write a for loop or use sapply this function will call sapply on the expression.
此功能有助于在做模拟。明确,而不是写一个for循环或使用sapply这个函数将调用sapply表达。
A GUI for this appears in pmg under the Simluation tab. The "quick action" will call the function on the results of the simulation.
针对此界面显示PMG在下Simluation标签。 “快速行动”将调用模拟结果的功能。
值----------Value----------
The output of a sapply call can be a vector, matrix, ... If it is a vector, it is transposed/
sapply呼叫的输出可以是一个向量,矩阵,...如果它是一个矢量,它是转/
注意----------Note----------
This function and GUI was suggested by Daniel Kaplan at useR!2007
此功能和GUI建议由丹尼尔·卡普兰2007年的用户!
作者(S)----------Author(s)----------
John Verzani
举例----------Examples----------
res <- pmgRepeatTrials(rnorm(1))
hist(res)
g = data.frame(
father = c(78.5, 78.5, 77.5, 76.0, 75.5),
mother = c(67.0, 68.0, 66.0, 65.5, 62.0),
sex = c("M", "M", "F", "F", "M"),
nkids = c(4, 4, 1, 2, 5)
)
res <- pmgRepeatTrials(coef(lm(father~ sex + sample(nkids),data=g)),100)
print(res)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|