Page 1 of 1

Data import: Interpolate but not Extrapolate..?

Posted: Mon Jan 27, 2020 1:14 pm
by kaveh.dianati
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.

Re: Data import: Interpolate but not Extrapolate..?

Posted: Mon Jan 27, 2020 1:24 pm
by Administrator
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 )

Re: Data import: Interpolate but not Extrapolate..?

Posted: Mon Jan 27, 2020 2:26 pm
by tomfid
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).

Re: Data import: Interpolate but not Extrapolate..?

Posted: Mon Jan 27, 2020 3:00 pm
by kaveh.dianati
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!

Re: Data import: Interpolate but not Extrapolate..?

Posted: Mon Jan 27, 2020 3:17 pm
by kaveh.dianati
Thanks @Tom! I just saw your message. Yes, I just managed to solve the problem using GET DATA FIRST/LAST TIME.

Cheers,
Kaveh.