全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
2064 4
2016-08-10
mixn <- function (n, a=-1, b=1)
{rnorm(n, sample(c(a,b),n,replace=T))}

请问在rnorm中,又加入了sample函数,应该怎么理解呢?

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-8-10 11:24:46
The random number is generated n times, each element in n has a mean of +1 or -1.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-8-10 11:49:59
waterhorse 发表于 2016-8-10 11:24
The random number is generated n times, each element in n has a mean of +1 or -1.
thx a lot!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-8-10 15:45:04
waterhorse 发表于 2016-8-10 11:24
The random number is generated n times, each element in n has a mean of +1 or -1.
btw, what about the variance of the random number?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-8-11 00:04:42
By default the variance (standard deviation) is set to 1; rnorm(n, mean, sd).
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群