Folks,
I have an elementary question about the lm() function, where I'm
trying to exploit the "subset" feature, to make it use only a subset
of the observations. My code is:
----------------------------------------------------------------------
A <- read.table(file="datafile.2",
col.names=c("date","dlinrchf","dlusdchf","dljpychf","dldemchf"))
# The file datafile.2 has 100 observations.
# I want to do a regression using the first 25 only
# Subset vector : the 1st 25 are on, the remaining 75 are off.
window = c(rep(1,25), rep(0,75))
model <- lm(dlinrchf ~ dlusdchf + dljpychf + dldemchf, A, window)
summary(model)
----------------------------------------------------------------------
This doesn't work: I get --
Coefficients: (3 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.088e-03 1.384e-19 -2.232e+16 <2e-16 ***
dlusdchf NA NA NA NA
dljpychf NA NA NA NA
dldemchf NA NA NA NA
I have tested using alternative software (stata) and the 1st 25
observations are quite fine for doing a regression. I find that even
if I set window to rep(1,100) (i.e. a vector of 100 ones) the lm()
does not work.
I guess I'm making some mistake in using the "subset" capability of
lm(). Any help will be most appreciated...
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html