cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Capturing Simulation Results

ChemEng
1-Visitor

Capturing Simulation Results

Dear Mathcad Collegues,

I have created a Monte Carlo simulation (rnd) that bootstraps a non-linear two parameter function and solves for the parameters using the maximum likelihood estimation method with Mathcad's maximum function. My problem is that I want to run 1000 independent computations or simulations and capture,store or save the solved two parameter results.

I can only run one computation at the a time by pressing F9 to run a single simulation. I need to compute it 1000 times and to get 1000 independent solved parameters. I would appreciate if someone could give me some pointers on how to automate this process. I am willing to post my mcd sheet if needed.
Thank you.
13 REPLIES 13
StuartBruff
23-Emerald III
(To:ChemEng)

On 12/24/2009 12:54:10 PM, Stevenlee wrote:
== I can only run one computation at the a time by
pressing F9 to run a single simulation. I need to
compute it 1000 times and to get 1000 independent
solved parameters. I would appreciate if someone
could give me some pointers on how to automate
this process. I am willing to post my mcd sheet if
needed.

Without seeing your worksheet, it is difficult to
give specific advice. One possibility is to use
the Animation facility to run through the
worksheet; another is to use a component to change
key variables.

However, it may be better to restructure your
worksheet.

If you could post the worksheet, that would allow
other users to give more tailored and appropriate
advice.

Stuart

In general, you just structure the calculation as a function and then invoke the function as often as you like.
__________________
� � � � Tom Gutman
ChemEng
1-Visitor
(To:ChemEng)

I have attached the mcd sheet for some help with computing multiple simulations to solve the parameters of a non-linear function. My goal is to repeat the simulation 1000 times to get the values for alpha and beta. I plan to conduct a statistical analysis on the parameters once I get 1000 simulations run. Right now I can only repeat a simulation by pressing F9 and and copying the solved parameters. Your help would be greatly appreciated.

Tom, I posted earlier about the bootstrapping routine and you gave me a few hints on how to use the rnd function. Many thanks for that. I really grind my gears for a while figuring it out. Thanks.
StuartBruff
23-Emerald III
(To:ChemEng)

On 12/24/2009 3:36:09 PM, Stevenlee wrote:
== I plan to conduct a statistical analysis on the
parameters once I get 1000 simulations run. Right
now I can only repeat a simulation by pressing F9
and and copying the solved parameters. Your help
would be greatly appreciated.

I've only had a couple of minutes to look at your
worksheet (it's almost Christmas over on the proper
side of the Pond and the children's presents need
wrapping!), but it looks as if you should be able
to modify your sheet in a reasonably
straightforward manner - I've given an example of
how to extend the δ vector into a matrix,
where each column of the matrix holds a single run.
You can simplify some of the calculations by using
the vectorization operator and by expressing some
expressions as functions.

Stuart

In the same line of Stuart's work.

Nice Christmas.

Alvaro.


Bravo! Thanks for showing how to iterate using the functions. I was actual able to run 1000 simulations, but got lost in the solve block routine. Your functions in the solve block sure handled the vectors nicely. However, I am confused about the jj in the solve block. jj=number of simulations. Typing an extra j seems to connect the iterations, but why? I have never seen this.
Anyway, Merry Christmas

Actually you're right, it is not a good option adding the 3rd parameter to the target function, and introduce some hard issues this technique.

But in the attached the reasson to do that. Basically it's to preserve the continous space-time and save the universe 🙂

Regards. Alvaro.

Alvaro,
Could you resend your last mcd file in version 13. I am unable to open the file. Could this technique be used for in for a give or minner solve block for a system of equations?

Uploaded again.

There are an issue passing index array to target function, and is that sometimes the solver don't takes the desired vector or matrix element. So, I don't know if can be applied to a system.

Regards. Alvaro.

Still unable to upload becaue it is a newer version. I have ver. 13. Try saving to 13 or earlier.
Thanks.

Ups, sorry, bad file. Uploaded again.

Regards. Alvaro.
ChemEng
1-Visitor
(To:ChemEng)

Stuart,

I interested in how you would take the vectors through the maximum function if you have the time. It is interesting to so how others approach a problem to arrive at the same answer using Mathcad.

My house is surrounded with 5 foot drifts of snow and can't get out. So I have plenty time to tinker.

I'm not sure to agree with the proposal, but have no time to disagree. Even considering the swine flue for which you would only "guestimate" despite the massive amount of information already collected, I would rather trust Markov. MLE was presented earlier and seemed reasonable fit for very few points in hand. If the MLE proposal sounds viable, it should then be easy to prove with repeated experiments and few more data collected.

jmG
Announcements

Top Tags