[R] Stepwise analysis with fixed variables

2012-12-02 Thread rahul143
Hello,
How can I run a backward stepwise regression with part of the variables
fixed, while the others participate in the backward stepwise analysis?
Thank you



-
TO GET MORE DETAILS CLICK HERE  
--
View this message in context: 
http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4651636.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-22 Thread Einat
Thanks. 



--
View this message in context: 
http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015p4650419.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-21 Thread Einat
I am sorry, but I think my questions were forgotten. Can someone please
answer them?
Thank you :)



--
View this message in context: 
http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015p4650264.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-21 Thread PIKAL Petr
Hi.

What questions? I do not see any. 

Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Einat
 Sent: Wednesday, November 21, 2012 9:32 AM
 To: r-help@r-project.org
 Subject: Re: [R] Stepwise analysis with fixed variables
 
 I am sorry, but I think my questions were forgotten. Can someone please
 answer them?
 Thank you :)
 
 
 
 --
 View this message in context: http://r.789695.n4.nabble.com/Stepwise-
 analysis-with-fixed-variables-tp4650015p4650264.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 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.

__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-21 Thread Einat
These are my questions: 

1. For example, if this is my code: 

RegModel =
lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_response)
  summary(RegModel) 
step(RegModel, direction =backward,scope=list(lower=?,upper=?)) 

and I want the sex and height variables to be fixed, but the rest of the
variables to go into the backward analysis, how should I write the scope
function?
   
2.How can I add an alpha level to the step function as a criterion for the
backward regression analysis?
   
Thank you :) 



--
View this message in context: 
http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015p4650283.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-21 Thread Einat
These are my questions:

1. For example, if this is my code: 

RegModel =
lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_response)
 summary(RegModel) 
step(RegModel, direction =backward,scope=list(lower=?,upper=?)) 

and I want the sex and height variables to be fixed, but the rest of the
variables to go into the backward analysis, how should I write the scope
function?
 
2.How can I add an alpha level to the step function as a criterion for the
backward regression analysis?
 
Thank you :)



--
View this message in context: 
http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015p4650280.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-21 Thread Marc Schwartz
On Nov 21, 2012, at 6:41 AM, Einat einatgra...@gmail.com wrote:

 These are my questions: 
 
 1. For example, if this is my code: 
 
 RegModel =
 lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_response)
 summary(RegModel) 
 step(RegModel, direction =backward,scope=list(lower=?,upper=?)) 
 
 and I want the sex and height variables to be fixed, but the rest of the
 variables to go into the backward analysis, how should I write the scope
 function?
 
 2.How can I add an alpha level to the step function as a criterion for the
 backward regression analysis?
 
 Thank you :) 



First, I strongly suggest that you search on the problems associated with using 
stepwise regression and alternative approaches. This subject has been discussed 
ad infinitum on this list and is not a reasonable approach to covariate 
selection.

To your first question, which Uwe replied to and which I thought was pretty 
clear:

  scope = list(upper = ~ sex + BMI + height + weight + education + ses, 
   lower = ~ sex + height)

It is described in the Details section of ?step and there is an example of this 
in ?stepAIC in VR's MASS package, which is a default part of R and is linked 
in the See Also section of ?step.

To your second question, you can't. It uses AIC and this has also been 
discussed frequently on this list. You might look at Frank's fastbw() function 
in his 'rms' package on CRAN.

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-21 Thread PIKAL Petr
Hi

I am not at all an expert in step. From the help page I inferred that

step(lm1, scope=list(lower=~Catholic))

keeps Catholic in model.

So something like

step(RegModel, direction =backward,scope=list(lower=~sex+height))

shall leave those two in a model.

AFAIK there is no parameter alpha in a step function.

Regards
Petr

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Einat
 Sent: Wednesday, November 21, 2012 1:41 PM
 To: r-help@r-project.org
 Subject: Re: [R] Stepwise analysis with fixed variables
 
 These are my questions:
 
 1. For example, if this is my code:
 
 RegModel =
 lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_res
 ponse)
   summary(RegModel)
 step(RegModel, direction =backward,scope=list(lower=?,upper=?))
 
 and I want the sex and height variables to be fixed, but the rest of
 the variables to go into the backward analysis, how should I write the
 scope function?
 
 2.How can I add an alpha level to the step function as a criterion for
 the backward regression analysis?
 
 Thank you :)
 
 
 
 --
 View this message in context: http://r.789695.n4.nabble.com/Stepwise-
 analysis-with-fixed-variables-tp4650015p4650283.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 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.

__
R-help@r-project.org mailing list
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.


[R] Stepwise analysis with fixed variables

2012-11-19 Thread Einat
Hello, 
How can I run a backward stepwise regression with part of the variables
fixed, while the others participate in the backward stepwise analysis? 
Thank you, Einat 



--
View this message in context: 
http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-19 Thread Uwe Ligges



On 19.11.2012 08:49, Einat wrote:

Hello,
How can I run a backward stepwise regression with part of the variables
fixed, while the others participate in the backward stepwise analysis?
Thank you, Einat


Read ?step and about its argument scope that can be a list with a 
lower component where you specify the minimal model.


Uwe Ligges





--
View this message in context: 
http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.



__
R-help@r-project.org mailing list
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.


Re: [R] Stepwise analysis with fixed variables

2012-11-19 Thread Einat
Thank you for the quick reply.

Two more questions:
1. For example, if this is my code:

RegModel =
lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_response)
summary(RegModel)
step(RegModel, direction =backward,scope=list(lower=?,upper=?))

and I want the sex and height variables to be fixed, but the rest of the
variables to go into the backward analysis, how should I write the scope
function?

2.How can I add an alpha level to the step function as a criterion for the
backward regression analysis?

Thank you very much,

Einat



--
View this message in context: 
http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015p4650030.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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.