[R] New variables "remember" how they were created?

Skipper Seabold jsseabold at gmail.com
Wed Oct 28 02:04:18 CET 2009


Hello all,

I hope this question is appropriate for this ML.

Basically, I am wondering if when you create a new variable, if the
variable holds some information about how it was created.

Let me explain, I have the following code to replicate an example in a
textbook (Greene's Econometric Analysis), using the systemfit package.

dta <- read.table('http://pages.stern.nyu.edu/~wgreene/Text/Edition6/TableF5-1.txt',
header = TRUE)
attach(dta)
library(systemfit)
demand <- realcons + realinvs + realgovt
c.1 <- realcons[-204]
y.1 <- demand[-204]
yd <- demand[-1] - y.1
eqConsump <- realcons[-1] ~ demand[-1] + c.1
eqInvest <- realinvs[-1] ~ tbilrate[-1] + yd
system <- list( Consumption = eqConsump, Investment = eqInvest)
instruments <- ~ realgovt[-1] + tbilrate[-1] + c.1 + y.1
# 2SLS
greene2sls <- systemfit( system, "2SLS", inst = instruments,
methodResidCov = "noDfCor" )

When I do the 2SLS fit, it seems that even though I declared y.1 as an
instrument that the estimator "knows" that yd was created using y1, so
it (correctly) transforms yd to use the instrument in the final
estimation.

So I'm wondering if yd somehow carries knowledge of how it was created.

Thanks,

Skipper




More information about the R-help mailing list