Displaying 1 result from an estimated 1 matches for "rzerotruncnormal1d".
2010 Oct 25
1
if statement and truncated distribution
Hi R helpers,
I am trying to use the if statement to generate a truncated random variable
as follows:
if (y[i]==0) { v[i] ~ rnorm(1,0,1) | (-inf ,0) }
if (y[i]==1) { v[i] ~ rnorm(1,0,1) | (0, inf) }
I guess I cannot use " | ( , ) " to restrict the range of a variable in R.
Could you let me know how to write the code correctly in R?
Many thanks for your help.
Maomao
[[alternative