, December 21, 2009 3:33 PM
To: Daniel Malter
Subject: RE: [R] how can generate h(u)=min{a,log(u)} for 0u1 in R ?
Hello Dear
thank you for your answer, but I need to generate a sample from the
function h(u) not compute the h(u).
best
khazaei
Hi, see the example below. There must be a way to do
Malter
Subject: RE: [R] how can generate h(u)=min{a,log(u)} for 0u1 in R ?
Ok. For example let for itration i=4 whe have u1=.1,u2=.2,u3=.3,u4=.6
and u5=.8
then
gi(u)=h(u1) when0.1u0.2
=h(u2) when0.2u0.3
=h(u3) when0.3u0.6
=h(u4) when0.6u0.8
where h(ui)=min{a=1,-log
Hello,
How can generate a sample from h(u)=min{a,log(u)} for 0u1 in R,please?
thank you
khazaei
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
, 2009 5:17 AM
To: r-help@r-project.org
Subject: [R] how can generate h(u)=min{a,log(u)} for 0u1 in R ?
Hello,
How can generate a sample from h(u)=min{a,log(u)} for 0u1 in R,please?
thank you
khazaei
__
R-help@r-project.org mailing list
https
Use pmin like this:
set.seed(123)
pmin(-0.1, log(runif(25)))
[1] -1.2462628 -0.2378700 -0.8940966 -0.1244104 -0.100 -3.0888020
[7] -0.6384592 -0.1138195 -0.5952313 -0.7839153 -0.100 -0.7911258
[13] -0.3892415 -0.5575096 -2.2737578 -0.100 -1.4020672 -3.1686692
[19] -1.1149834
5 matches
Mail list logo