作者binchung (ideal)
看板Statistics
标题Re: [问题] R 两个问题
时间Tue Jul 8 11:09:23 2008
1. If you can calulate the inverse function of the cumulative function easily,
then randomly sample U1,...,Un from Uniform distribution and compute values of
the inverse function at U1,...,Un.
Or try gibb's sampling.
2. I think there should be a function for arctan in R.
※ 引述《laba1014 (嘿哟~加油!!!)》之铭言:
: 不好意思有两个R的问题要请教 :
: 1. 请问若已知某分配的 p.d.f 型态 ,
: 譬如 f(x) =1/a(√π)^(-1) * gamma(m)/gamma(m-1) *(1+ x^2/a^2)^(-m)
: 要怎麽写程式才能从该分配中进行抽样本的动作 ?
: 2. 反函数要怎麽写 ?
: 譬如 已知x 但想知道 tan^(-1)(x) 应该怎麽做 ?
: 希望版上前辈能不吝指教 <(_ _)>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 208.125.17.166
1F:→ laba1014:感谢 <(_ _)> 我去找找 gibb's sampling要怎麽用 07/08 16:39
2F:→ clickhere:这跟Gibb无关吧?! 07/09 08:13
3F:→ clickhere:如果m是正整数,那这是cauchy的变型,在R用rcauchy就行了. 07/09 08:21
4F:→ clickhere:上面是错的, m=2才是cauchy 07/09 08:23
5F:→ clickhere:sorry, m=1才是 07/09 08:24
6F:推 clickhere:所以你这是t分布的变型. m应该是a的函数吧? 07/09 08:29
7F:→ clickhere:在R中,用 rt(), 再套用rejection method就行了. 07/09 08:30
8F:推 laba1014:C大眼光真是有够利 我是想从pearson type 4 的分配取 07/09 17:25
9F:→ laba1014:r.v 这分配的确包含上述所提的分配只是参数多不少 07/09 17:26