[R] matrix (column-wise) multiple regression
Morgan Hough
mhough at fmrib.ox.ac.uk
Fri Nov 23 19:10:40 CET 2007
Hi Gabor,
Thanks for your reply. I have it working now. A couple of follow-ups if
I may.
I have a shell script parsing the output to find the brain areas where
there is a significant effect of diagnosis but its a bit of a hack. I
was wondering whether there are R specific tools for parsing/summarizing
this kind of output.
Can I apply multiple comparison corrections via lm() or do I need to
apply something on the model output from lm() after?
Thanks again for your time.
Cheers,
-Morgan
Gabor Grothendieck wrote:
> Perhaps something like this:
>
>
>> idx <- 1:2
>> lm(as.matrix(iris[idx]) ~., iris[-idx])
>>
>
> Call:
> lm(formula = as.matrix(iris[idx]) ~ ., data = iris[-idx])
>
> Coefficients:
> Sepal.Length Sepal.Width
> (Intercept) 3.682982 3.048497
> Petal.Length 0.905946 0.154676
> Petal.Width -0.005995 0.623446
> Speciesversicolor -1.598362 -1.764104
> Speciesvirginica -2.112647 -2.196357
>
>
>
> On Nov 23, 2007 10:09 AM, Morgan Hough <mhough at fmrib.ox.ac.uk> wrote:
>
>> Hi there,
>>
>> I am analyzing a table of brain volume measures where each brain area
>> (183 of them) is a column with a label and volume values. I have another
>> table of explanatory variables (age, gender, diagnosis and
>> IntraCranialVol) that I have been using to model the brain volume
>> differences. I have been doing this for single volume measures with no
>> difficulties but I have been unable to apply this across the whole set
>> of brain areas. If I try:
>>
>> lm(y.df, x.df)
>> Error in eval(expr, envir, enclos) : object "Left_Lateral_Ventricle" not
>> found
>>
>> Left_Lateral_Ventricle happens to be the first column label. Does this
>> not work with tables? I have been unable to find any examples.
>>
>> Would you recommend another approach if I was doing this again. The
>> number of columns (brain areas) depends on the parcellation strategy we
>> use so I will probably be reforming these tables again and again. I
>> would like the simplest way to analyze all the brain areas and find
>> where there are significant differences driven mainly by the diagnosis
>> factor.
>>
>> Thanks in advance for your time.
>>
>> Cheers,
>>
>> -Morgan
>>
>> ---------------------------------------------------------------------------
>> Morgan Hough,
>> D.Phil. Student,
>> Oxford University FMRIB Centre
>>
>> FMRIB, JR Hospital, Headington, Oxford OX3 9DU, UK
>> +44 (0) 1865 222466 (fax 222717)
>> mhough at fmrib.ox.ac.uk http://www.fmrib.ox.ac.uk/~mhough
>>
>> ______________________________________________
>> 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.
>>
>>
More information about the R-help
mailing list