Help with model calibration

Use this forum to post Vensim related questions.
Administrator
Super Administrator
Posts: 4589
Joined: Wed Mar 05, 2003 3:10 am

Re: Help with model calibration

Post by Administrator »

Please upload a XLSX file (XLS can contain macros).

And can you convert the data you have so it matches the Vensim example?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

I've uploaded the xlsx file

Vensim format: Is it like this?
Driver1 Time 1 2 3 4 5 6
Variable1 data data data data
Variable2 data data data data
Driver2
Time
Variable1 data data data data
Variable2 data data data data

Thanks so much for all your help
Attachments
icdata2.xlsx
(9.9 KiB) Downloaded 177 times
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

You could reformat your data that way, but it's easier to import it as tidy data.

I've attached an example.
Drivers.zip
(20.12 KiB) Downloaded 224 times
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

In the example:
- see the spreadsheet driver_data tab of the .csv file for the required format
- the command script import.cmd can be used to import the data
- the model uses the data to calculate a Poisson likelihood from an expected (constant) error rate per driver
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

Thanks so much for all your help.
This is more complex than I thought.

I'm still unable to load the data.
This is what I did:
Model>Import Dataset> then I chose the name of the csv file. It did not work
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

How is the command script import.cmd used?
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

I'm sorry I'm not getting this thing. You have done everything you can and I really appreciate. I guess I'm totally lost, I don't have a background in computer science

You have attached 3 different files: data.csv, data.xlsx, data.vdf

I don't even know how you went from the excel file to the vdf format.
Could you please pick the csv or xlsx file (which I'm familiar with) and explain how to load the data in lay terms? Remember I have my model built in Vensim and want to load the data to the model
I was able to load the vdf into the software but it opened in a different window. I could not integrate it to the model. Also, it would be a learning for me, if you use the csv or xlsx and explain how to load the data to my model in very lay terms.

Again, I'm sorry I have been using a lot of your time
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

Don't be hard on yourself - it's complex.

Use File>Edit File to load the import.cmd script.

Then use File>Run Commands to make the conversion.

For tidy data, the format is always:
- columns with subscripts
- a Time column
- columns of data with variable names in the header row
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

I did what you described. I don't know if it worked. When I double checked the data loaded, I realize they are different from the data I have. So, I don't know.
I emailed you the model, please check if it really loaded
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

Different how?
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

I clicked on monthly driving in the model, then clicked on graph to check the numbers. But based on what you said, the data is not in the model. So those numbers were not the data.
It seems like the model itself cannot run anymore. I guess I did something wrong. How can I delete/remove the subscript? I would like to start over again
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

We need a little more information here.

- What happens when you load the import.cmd script?
- Have you loaded the resulting data.vdf?
- What error message do you get when you try to run the model?
- Can you revert to an earlier version of the model (like the one you emailed)?
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

When I followed what you described, I got this "MENU>TIDY2VDF|data.csv" in the editor. I don't know where is the data because I don't see anything else other than "MENU>TIDY2VDF|data.csv" in a blank page. I then clicked on a variable in the model, then clicked on graph to check, but I saw numbers different from the data.
Like I said before I don't have a background in computer science; so it would be really helpful for me if things are explained in very lay terms.

When I tried to simulate the model it says model has errors and cannot be simulated. I've tried different approaches (including GET XLS DATA) to import the data, I guess I may have done some wrong. I can revert the model if I know how to remove/delete the subscript I set up
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

Did you use file>run commands? Running the script will translate data.csv to data.vdf. To see the data, you need data.vdf loaded in the Dataset Control.
https://www.vensim.com/documentation/in ... tasets.htm

Check out
http://vensim.com/building-a-simple-vensim-model/
http://vensim.com/causal-tracing-in-vensim/
http://vensim.com/model-analysis-world-dynamics/
for more basic Vensim skills.

When a model has errors, the equation editor will tell you what the specific errors are. We can't help further without knowing that.

You should remove any GET XLS statements from your model, if you're not using them.
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

Thanks for sending these videos, I think they are very helpful.
I've attached what I got when I used the file>run commands

I would like to delete/remove the array and start over. Any suggestions on how I can delete the array?
Attachments
Doc1.docx
(35.44 KiB) Downloaded 173 times
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

Look at this as well
Attachments
Doc2.docx
(92.83 KiB) Downloaded 167 times
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

I think you're trying to use the Model>Import dataset commands on the import.cmd script. That won't work.

Use File>Edit File to load the import.cmd script into the built-in text editor.

Then use File>Run Commands to import the data.

If your source data is called somefile.csv, the result will be named somefile.vdf (unless you change the arguments to the TIDY2VDF command).
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

Removing subscripts can be messy. There are several ways:

1. use a text editor to search & replace all instances of [driver] with nothing.
2. use the equation editor to visit all the equations and remove the driver references one at a time.
3. select the variables in question on the diagram, then use the Edit>Set Subscripts menu with the "Removing" option.

After you've removed all the driver references, you can delete the subscript equation itself.
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

I did exactly what you said. I used File>Edit File. I did not use Model>Import dataset commands at all. It's kind of strange that it's so hard to load data into the software
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

It shouldn't be hard at all. The symptom here is that your empty dataset is called "import.vdf" not "data.vdf". That suggests that the source file was import.xxx (xxx = tab, csv, etc.) rather than data.csv

What version are you using? TIDY2VDF is a fairly new feature (6.3 or 6.4, I think) so it's possible that older versions misinterpret the command.
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

I'm using the newer version (6.4).

I removed the subscripts and put them back again. The model is OK now.

I think the problem is probably me, I'm missing some basic steps.

1) Let's say the name of the dataset I'm trying to import is data.csv
2) Then I used File>Edit file and selected the file "data.csv". I could see the data loaded in the text editor.
3) Then I used File, and I don't see Run Commands anymore

If I followed what you said:
1) I used File>Edit file and selected the file "import.cmd". I could see MENU>TIDY2VDF|data.csv in the text editor. Where is the import.cmd coming from? I downloaded it from the example you attached and sent to me. So I don't know if that's what I should directly use
2) Then I used File>Run Commands and got the empty dataset I attached to you
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

Thanks for laying out the steps exactly. Not sure how this could be happening.
1) Let's say the name of the dataset I'm trying to import is data.csv
2) Then I used File>Edit file and selected the file "data.csv". I could see the data loaded in the text editor. CORRECT
3) Then I used File, and I don't see Run Commands anymore CORRECT - you won't see Run Commands unless the file has extension .cmd
If I followed what you said:
1) I used File>Edit file and selected the file "import.cmd". I could see MENU>TIDY2VDF|data.csv in the text editor. CORRECT Where is the import.cmd coming from? It's a script that I created. I downloaded it from the example you attached and sent to me. So I don't know if that's what I should directly use As long as the data file name matches, you can use my copy; otherwise just edit to match.
2) Then I used File>Run Commands and got the empty dataset I attached to you
If you're using 6.4 instead of the latest 6.4e, that could be the problem. Do you get any errors/warnings when the empty dataset is created?
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Help with model calibration

Post by tomfid »

I'd try upgrading to 6.4e before doing anything else.

As an interim measure, you can use the data.vdf in the .zip file I posted. It will be compatible.
leon
Senior Member
Posts: 192
Joined: Tue Feb 21, 2017 11:11 pm
Vensim version: PRO

Re: Help with model calibration

Post by leon »

Sorry for the confusion, I think I'm using the latest version 6.4E(x32).

I don't know what's wrong. I've attached what I got, which is what I have been getting. What should I expect to see when I click on OK?
Attachments
Doc3.docx
(108.33 KiB) Downloaded 115 times
Post Reply