Did you not read about the "subset" argument of lm() ?
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Wed, Feb 3, 2016 at 10:09 AM, Preetam Pal <lordpreetam at gmail.com>
wrote:> Hi,
>
> I am performing OLS regression on a dataset involving variables Y, X1 and
> X2, each having 500 observations. I want to perform the regression only on
> a subset of the dataset (say, using observations 50 till 350). Is there any
> way in which I can pass the entire dataset, but somewhere select these
> indices 50-350 and pass this as an argument in the regression function?
>
> Regards,
> Preetam
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.