As a way to learn Python/NumPy I’m programming my SAS IML dissertation of 20 years ago in Python 2.7.11. The method involves monte carlo simulations with multiple loops inside the outer loop. I’ve been successful with a simple example. I’m at the point where I need to accumulate statistics from each iteration and I need guidance because I’m a little (or a lot) confused about how and when to use lists, arrays, and matrices and how to convert one to the other despite repeatedly looking a docs and examples.
If I was printing a report, I want a table looking like this (delimiter can be a space)
MSEa Ca MSEb Cb
1421 7 1184 3
925 2 1077 4
so I can choose the smallest MSE and C pairing in each MSE column.
What I have is
MSEV
[matrix([[ 1421]]), 7, matrix([[ 1184]]), 3, matrix([[ 925]]), 2, matrix([[ 1077]]), 4]
type(MSEPCV)
<type 'list'>
MSE is a scalar from matrix math, MSEV is initiated as MSEV = [] {type(MSEPCV) }, MSEV is created from MSE {type(MSE) } and COUNT {type(COUNT) }
I thought it would be easiest to make everything a list and tried tolist() but the squackets remain.
[]- that's just what a list is. I'm not entirely certain that you need a matrix, but I'm unfamiliar with your problem space