0

I have random sample containing 1 response variable and 10 explanatory variables (X) and I'm trying to find the best subset applying linear regression

No problems with fitting the model, but I need y^s for each subset, so I'm open to any suggestions how to discard the least significant variable and re-fit the model repeatedly until there's only constant and yet save y^ for each subset.

Don't need the whole script, that would be silly of me, i'm just looking for any useful functions.

Thank you all in advance.

Ondrej

merv
  • 67,214
  • 13
  • 180
  • 245
  • 1
    This question is bout statistics not about programming. You should ask it in [cross validated](http://stats.stackexchange.com/). Thats 's said there are many R method for variable selection (take a look at `leaps` algorithm for example). – agstudy Sep 13 '14 at 12:42
  • Its **not** about stats. The Q is about how to compute `y^s` (whatever that is. y-hats? Fitted y values?) for a model and also how to drop terms from a formula. Whether this is a good method for variable selection would be a stats Q, but this isn't what was asked... – Spacedman Sep 13 '14 at 13:51
  • Try `step` function. It's not exactly what you need, but close ;) – bartektartanus Sep 13 '14 at 18:35

0 Answers0