[R] function runif in for loop

Johannes Radinger JRadinger at gmx.at
Wed Aug 10 13:28:49 CEST 2011


Hello,

I'd like to perform a regression using MCMCregress (MCMCpack).
One variable therefore should be a function rather than a variable:

I want to use X as an input and X should be defined as a random number between to values. Therefore I want to use the function runif like:
X <-(1, Xa, Xb) but it seems that runif doesn't allow to use vectors.
So I think I've to calculate the new vector X by using a for loop.

I tried "for (i in 1:length(lT)) T<-runif(1,lT,uT)" but that doesn't work.
What is the correct for-loop function to create this new vector/variable?

Can I use that function then as an input for MCMCregress?

thank you

Johannes

--



More information about the R-help mailing list