Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: mvrs: out-of-sample prediction/definition of the splines

From   "Patrick Miller" <>
Subject   st: mvrs: out-of-sample prediction/definition of the splines
Date   Wed, 05 Dec 2012 11:57:48 +0100


I want to use a mvrs model for out-of-sample prediction but unfortunately I have some trouble with the option "all".

I have devided my data in training- and test-sample by using a binary variable train. To build a model (without option "all") I use:

(1) mvrs regress y x1 x2 x3 if train==1, degree(3)

Let x1 be continuous and a spline transformation with two knots is done. Hence new variables x1_0, x1_1 and x1_2 are generated.

If I use the samle model but with option "all":

(2) mvrs regress y x1 x2 x2 if train==1, all degree(3)

x1_0, x1_1 and x1_2 are generate as well, but the stored values for the training-sample differ from the ones generated by model (1).

My interpretation is that the transformation for the test-sample is not only done by the information provided by the training-sample. In fact for the transformation training- and test-data are used. In my opinion this is not a correct way of out-of-sample testing.

Is there any way to generate x1_0, x1_1 and x1_2 for the test-sample only based on the information of the training-sample?

Thanks a lot!
Patrick Miller
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index