On Wed, Jul 28, 2010 at 8:59 AM, Joshua Wiley wrote:
> Hi Tony,
>
> I am sure there are other ways, but I would create formula objects and
> then pass them to lm(). Here's an example:
>
> mydata <- data.frame(Y = 1:10, X1 = 11:20, X2 = 21:30)
>
> my.names <- names(mydata)[-1]
>
> for(i in my.name
Hi Tony,
I am sure there are other ways, but I would create formula objects and
then pass them to lm(). Here's an example:
mydata <- data.frame(Y = 1:10, X1 = 11:20, X2 = 21:30)
my.names <- names(mydata)[-1]
for(i in my.names) {
my.formula <- formula(paste("Y ~ ", i, sep = ""))
my.lm <- lm
Hello,
Here is a dilemma I am having for a long time. But, I couldn't figure it
out.
I have an vector of Y and a data frame named "data",which contains all Xs. I
tried to be more efficient in fitting a simple linear regression with each
X.
Firstly,
for (i in 1:(dim(data)[2])){
model<-lm(Y~data[,
3 matches
Mail list logo