Page 1 of 1
Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 2:22 pm
by niyousha@vt.edu
How to run sensitive analyses using the file option when the model is subscripted? I get errors when using subscripted parameters.
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 2:23 pm
by Administrator
What errors are you getting?
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 2:24 pm
by tomfid
What error are you seeing?
I'm guessing that you're putting varname[range] in the headers. I don't think that works - you need to provide a separate column for each varname[element].
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 2:45 pm
by niyousha@vt.edu
This is the error:
Bad constant-"FracDWI[Male.Age15]" in file MCMC4.txt.
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 2:55 pm
by niyousha@vt.edu
tomfid wrote: ↑Fri Aug 25, 2023 2:24 pm
What error are you seeing?
I'm guessing that you're putting varname[range] in the headers. I don't think that works - you need to provide a separate column for each varname[element].
Yes, I inserted the varnames like fracDWI[Male,Age15] in the headers (in a separate column for each of them). How they should be entered?
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 2:56 pm
by Administrator
Male.Age15 cannot be a correct subscript for Vensim, any subscript elements with a "." need to be quoted.
So the correct syntax would be
FracDWI["Male.Age15"]
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 2:56 pm
by Administrator
Or try the following, replace the "." with a ",".
FracDWI[Male,Age15]
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 3:12 pm
by niyousha@vt.edu
Administrator wrote: ↑Fri Aug 25, 2023 2:56 pm
Male.Age15 cannot be a correct subscript for Vensim, any subscript elements with a "." need to be quoted.
So the correct syntax would be
FracDWI["Male.Age15"]
sorry for the typo. I used [Male,Age15].
The model is fine; the only problem is when I use sensitivity analyses using the file option. I have separate columns for my parameters in the text file. For example fracDWI[Male,Age15], fracDWI[Male,Age16],...
I am not sure how the headers should be changed to run the sensitivity analysis using the file option.
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 3:26 pm
by Administrator
If you can upload what you have, we can take a look.
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 3:49 pm
by Administrator
Maybe the best thing to do is get a simple example working using the sensitivity wizard, that will give you a working file that you can then edit using a text editor.
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Fri Aug 25, 2023 5:35 pm
by niyousha@vt.edu
Administrator wrote: ↑Fri Aug 25, 2023 3:26 pm
If you can upload what you have, we can take a look.
I used a simple version (parameters without any subscript) and I did not get any error. As soon as I add a parameter with subscript, I get error.
I would like to share my text file that I use in my sensitivity analysis but the attachment cannot be a text file so I am attaching an excel file that I use to convert to text.
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Mon Sep 04, 2023 2:49 pm
by tomfid
When I save this as tab-delimited text, Excel quotes the column headers like
"fracDWI[Male,Age15]"
This is a nonstandard behavior, because quotes are not needed when the delimiter is tab (only csv).
Unfortunately this is not legitimate quoting in Vensim (the subscript brackets should not be included).
A quick search/replace of the text file to delete the " should solve the problem.
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Mon Sep 04, 2023 2:50 pm
by tomfid
Re: Sensitivity analysis using the file option in a subscripted model
Posted: Tue Sep 05, 2023 6:40 pm
by niyousha@vt.edu
tomfid wrote: ↑Mon Sep 04, 2023 2:49 pm
When I save this as tab-delimited text, Excel quotes the column headers like
"fracDWI[Male,Age15]"
This is a nonstandard behavior, because quotes are not needed when the delimiter is tab (only csv).
Unfortunately this is not legitimate quoting in Vensim (the subscript brackets should not be included).
A quick search/replace of the text file to delete the " should solve the problem.
Thank you Tom. Editing the text file (deleting " that excel generated and extra spaces) resolved the problem. Thanks for your help.