Hi,
I was wondering whether there is a way to import data and have it return NA for empty cells, but still let it interpolate in between the data points (when the TIME STEP is smaller than the interval between data points). I guess this would be something in between the RAW and INTERPOLATE options.
Many thanks,
Kaveh.
Data import: Interpolate but not Extrapolate..?
-
- Senior Member
- Posts: 50
- Joined: Tue Dec 15, 2015 1:52 pm
- Vensim version: DSS
-
- Super Administrator
- Posts: 4573
- Joined: Wed Mar 05, 2003 3:10 am
Re: Data import: Interpolate but not Extrapolate..?
Can you upload an example? I'm not sure I understand what you want to do.
At a guess, you can mark the imported data as RAW. Then use IF THEN ELSE, maybe something like
interpolated data := imported data
data to use = if then else (imported data = :NA:, interpolated data, imported data )
At a guess, you can mark the imported data as RAW. Then use IF THEN ELSE, maybe something like
interpolated data := imported data
data to use = if then else (imported data = :NA:, interpolated data, imported data )
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Data import: Interpolate but not Extrapolate..?
It sounds like you want interpolation in the middle of the series, and :NA: before/after there's any data.
You could do that by combining the interpolated data with a logical test for the start end (using GET DATA FIRST TIME etc.). Be sure to wrap those statements in an INITIAL for efficiency (if it matters).
You could do that by combining the interpolated data with a logical test for the start end (using GET DATA FIRST TIME etc.). Be sure to wrap those statements in an INITIAL for efficiency (if it matters).
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 50
- Joined: Tue Dec 15, 2015 1:52 pm
- Vensim version: DSS
Re: Data import: Interpolate but not Extrapolate..?
Apologies for the not-fully-clear question. I have attached an example now.
My model starts in 1980, but my data starts in 2007. My time step is 0.125.
How do I get the 'mortgages' variable to stay at zero when data in not available? I tried using the RAW setting for data import, but then it doesn't behave the way I want it to either: 'mortgages' goes up at the beginning of every year and drops back down to zero after one time step, which I do not want. I want it to behave as if I chose the INTERPOLATE option in between the years where data is available (in other words just connect my data points linearly).
I hope my question is clear now.
Many thanks!
My model starts in 1980, but my data starts in 2007. My time step is 0.125.
How do I get the 'mortgages' variable to stay at zero when data in not available? I tried using the RAW setting for data import, but then it doesn't behave the way I want it to either: 'mortgages' goes up at the beginning of every year and drops back down to zero after one time step, which I do not want. I want it to behave as if I chose the INTERPOLATE option in between the years where data is available (in other words just connect my data points linearly).
I hope my question is clear now.
Many thanks!
- Attachments
-
- Raw data.mdl
- (1.07 KiB) Downloaded 170 times
-
- INTERPOLATE.vdf
- (5.66 KiB) Downloaded 170 times
-
- Data.xlsx
- (9.25 KiB) Downloaded 159 times
-
- Senior Member
- Posts: 50
- Joined: Tue Dec 15, 2015 1:52 pm
- Vensim version: DSS
Re: Data import: Interpolate but not Extrapolate..?
Thanks @Tom! I just saw your message. Yes, I just managed to solve the problem using GET DATA FIRST/LAST TIME.
Cheers,
Kaveh.
Cheers,
Kaveh.