How RATS preduce FITTED values when some inputs are missing

Questions and discussions on Time Series Analysis

How RATS preduce FITTED values when some inputs are missing

Unread postby anozman » Tue May 22, 2012 3:04 am

Hi,

I have been fitting a univariate ECM model. The quarterly data is from 1990:01 to 2011:04 (04 is December quarter).

In my model, there is an input variable -> x{-4} (a lagging indicator of y{0})
(please do not worry about why I use a lagging indicator)

A simple example for illustration purpose: y(t)=b0+b1x(t+4)

From the series window, I have checked the FITTED and the residuals series,

The residuals stopped at 2010:04, which is correct, but the FITTED series has 4 additional unexpected fitted values from 2011:01 to 2011:04.

I was wondering who could tell me how RATS compute these values and under what assumptions these numbers are generated?

Thanks in advance!

anozman
anozman
 
Posts: 59
Joined: Mon Jan 30, 2012 6:16 pm

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby moderator » Tue May 22, 2012 11:44 am

You didn't mention how you estimated the model or computed the fitted values, but, generally speaking, RATS can't produce a fitted value for Y(t) if the necessary right-hand-side values aren't available.

Suppose you have just a single linear equation like:

y(t)=b0+b1x(t+4)

which is estimated using LINREG, for example, and you are using PRJ, UFORECAST, or FORECAST to computed fitted values or forecasts.

You would only be able to produce a fitted value for 2011:4 if the X series was in fact defined through 2012:4.

So, the most likely explanation is that the model is defined differently than you intended, or that your data is available over a different range than you think (perhaps you did something earlier in the program that extend the "X" series?).

In any case, the first step would be to do a PRINT instruction over the entire relevant data range--for example:

print * 2012:4 y x

to see how your data is actually defined. Then work back from there to find the source of the confusion.

Regards,
Tom Maycock
Estima
moderator
Site Admin
 
Posts: 279
Joined: Thu Oct 19, 2006 4:33 pm

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby anozman » Tue May 22, 2012 9:05 pm

Thank you very much Tom!

I think the last 4 values in the FITTED series are from a model specification that I estimated earlier without using x(-4). otherwise, it would not make sense!!! :D

If this is the case, it might raise the question whether RATS should be able to clear all the values previously stored in the FITTED series before store other values from the current model estimation.

Thank you very much again for your help!

Regards

anozman
anozman
 
Posts: 59
Joined: Mon Jan 30, 2012 6:16 pm

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby TomDoan » Tue May 22, 2012 9:25 pm

You can do a CLEAR FITTED yourself. With the exception of residuals series, most series calculations don't clear the target first.
TomDoan
 
Posts: 7236
Joined: Wed Nov 01, 2006 5:36 pm

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby Frank » Fri Jul 03, 2020 12:05 pm

Hi, Tom
You meant "generally speaking, RATS can't produce a fitted value for Y(t) if the necessary right-hand-side values aren't available",
whatif I've got a linreg model, and I want to check the fitted value of Y(t). What should I do to store the fitted value as a series.
Since I want to use the fitted value series to do other model.

Frank
Frank
 
Posts: 15
Joined: Fri Jun 11, 2010 7:18 am

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby TomDoan » Fri Jul 03, 2020 12:36 pm

You use the PRJ instruction. PRJ will always work in sample---in the original question the user was trying to do that out-of-sample where it's necessary to make sure that the "X"'s are defined.
TomDoan
 
Posts: 7236
Joined: Wed Nov 01, 2006 5:36 pm

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby Frank » Fri Jul 03, 2020 1:29 pm

If one would like to fit the value in sample,
For example, if I want to check the fitted value of the regression model, and I want to use the fitted value series to do other procedures.
the PRJ needs to be used here, is it correct?

linreg hours
# constant lwage educ age kidslt6 kidsge6 nwifeinc

prj fitted value --> this is for fitting dependent value, right?
print 1 10 fitted value


but I have no idea how to store the fitted value as a series, can I print the first 10 obs of the fitted value.
I tried it but it didn't work.



TomDoan wrote:You use the PRJ instruction. PRJ will always work in sample---in the original question the user was trying to do that out-of-sample where it's necessary to make sure that the "X"'s are defined.
Frank
 
Posts: 15
Joined: Fri Jun 11, 2010 7:18 am

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby TomDoan » Fri Jul 03, 2020 1:35 pm

prj fitted_value
print 1 10 fitted_value

will work. You can't have a space inside a variable name (_ is OK).
TomDoan
 
Posts: 7236
Joined: Wed Nov 01, 2006 5:36 pm

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby Frank » Sat Jul 04, 2020 1:35 pm

wondering how to use %prjfit, is the following code correct? but it didn't work.
set a = %prjfit(xvector)

is there any example about %PRJCDF and %PRJDENSITY?


TomDoan wrote:prj fitted_value
print 1 10 fitted_value

will work. You can't have a space inside a variable name (_ is OK).
Frank
 
Posts: 15
Joined: Fri Jun 11, 2010 7:18 am

Re: How RATS preduce FITTED values when some inputs are miss

Unread postby TomDoan » Sat Jul 04, 2020 9:38 pm

No. %PRJFIT is just a number, defined after a PRJ instruction where you use either the ATMEAN or an XVECTOR option. What are you trying to do? Most uses of PRJ work in sample with the X's in the data set, so don't need those specialized options. And %PRJCDF and %PRJDENSITY are used for probits and truncated variables; it doesn't sound like you're trying to do anything with those.

Use Help-Find in Files to find examples of any of those. However, I think you'll find that they're for completely different things that what you're trying to do.
TomDoan
 
Posts: 7236
Joined: Wed Nov 01, 2006 5:36 pm


Return to Other Time Series Analysis

Who is online

Users browsing this forum: No registered users and 1 guest

cron