Re: [R] generating sets of parameters when some parameters are vectors

2012-11-27 Thread James Rudge
Not to worry, I just worked it out (seems obvious now, apologies). #Function for generating parameters genparms<-function() { list( x = c(runif(1,2,3),runif(1,2,3)) ,y = runif(1,2,3) ) } #Create N parameter sets N<- 10 set<-rep(list("NA"),N) for (i in 1:N) { set[[i]]<-genparms() } > From: j

[R] generating sets of parameters when some parameters are vectors

2012-11-27 Thread James Rudge
I'm trying to generate N lists of randomly selected parameter values. Some of the parameters are vectors while other are single values. I've tried to use the approach below but it doesn't work for parameter x, which should be a vector. Thanks in advance! James #Define names of par

[R] generating sets of parameters, when some parameters are vectors

2012-11-27 Thread James Rudge
Hello, I'm trying to generate N lists of randomly selected parameter values. Some of the parameters are vectors while other are single values. I've tried to use the approach below but it doesn't work for parameter x, which should be a vector. Thanks in advance! James #Define names

[R] creating matrices from vectors

2008-11-15 Thread James Rudge
If I have 4 vectors (a, b, c, and d) each of length 1000, how do I then create 1000 two by two matrices from these vectors, such that: myMatrix[i] = matrix(c(a[i],b[i],c[i],d[i]),2) Then I'd like to create a single vector containing the largest eigenvalues of each matrix? (Sorry I am quite