I am running a simulation and need to refer to a matrix of parameters from a large object. Here is a snippet of the object structure itself:
Formal class 'mi' [package "mi"] with 3 slots
..@ call : language .local(y = y, n.chains = ..2, max.minutes = 20000)
..@ data :List of 100
.. ..$ chain:1 :'data.frame': 10000 obs. of 76 variables:
Formal class 'missing_data.frame' [package "mi"] with 17 slots
.. .. .. ..@ .Data : list()
.. .. .. ..@ variables :List of 76
.. .. .. .. ..$ y.obs.tx:Formal class 'binary' [package "mi"] with 27 slots
...
The parameter list I need can be referenced by:
mi.control.i@data$'chain:1'@variables$y.obs.tx@parameters[30,]
Since this is a simulation, I would like to grab the parameters from each chain and join them together in a matrix. I have this:
tf <- vector("list", numberofchains)
for (j in 1:numberofchains){
s <- paste("'chain:",j,"'" ,sep="")
tf[[j]] = mi.control.i@data$s@variables$y.obs.tx@parameters[30,]
}
Within the loop, however, the reference to the object (tf[[j]]
) does not work. I get an error that reads
Error: trying to get slot "variables" from an object of a basic class ("NULL") with no slots
Any ideas?
's throughout. I had trouble posting. – user1638567 Aug 28 '15 at 02:33