[R] Linear Regression ?

From: kayj <kjaja27_at_yahoo.com>
Date: Mon, 16 Jun 2008 07:27:40 -0700 (PDT)

Hi All,

I have a data with 15 columns. the first 10 column are dependent(y’s) variables and the following 5 an columns are the independent variables(x’s) ( MY DATA HAS A HEADER WITH THE NAME OF THE VAIABLES). I need to apply linear regression y=a+bx where I need x to be one of the independent variable and y to be one of the dependent variable, but for each x I have to repeat the model for all 5 independent variable one at a time .

Also each x is a categorical variable with 4 categories so I have to introduce three variables for each x

	New Variable 1	New Variable 2	New Variable 3
Category 1	0	0	0
Category 2	1	0	0
Category 3	0	1	0
Category 4	0	0	1


I want R to print out the summary and the analysis of variance for each model.

How can this done in R? I want to use some loop that loops over the independent variables for each x ?Also , I am not sure how to deal with the problem of each x being a categorical variable and I have to create these new variables for each x?

I hope that someone can help. I really Appreciate it.

-- 
View this message in context: http://www.nabble.com/Linear-Regression---tp17865662p17865662.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Mon 16 Jun 2008 - 15:11:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 16 Jun 2008 - 18:30:41 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive