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
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
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
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
4 matches
Mail list logo