Hello everybody

I have to run many statistical tests that are identical, with the
exception of the dependent variable. Is there a possibility to store the
dependent variable names e.g. in a vector (in the below mentioned example 
called “variable”) and to use the content of this vector in a simple
statistical test (e.g. a regression). I would like to write the
statistical procedure only once…


For example: I would like to store 100 dependent variable names in a
vector called “variable” and then I would like to do a simple regression
with each of theses variables and the variable “length” using e.g. the
while function. I would then extract e.g. the t-value and add it to a
vector (“result”) that contains all results. Something like that:



“variable” should contain the names of the 100 dependent variables (Var1, 
Var2, … Var100)

while(i<101){
result<-c(result,coef(summary(lm(variable[i] ~ length, data = data2)))[2,4]);
i<-i+1
}

This example does not work since the lm function does not recognize the
dependent variable’s name.

Does somebody know how to store the names of the dependent variables in
e.g. a vector and to make them available for the lm function?

Many thanks

Patrick

