[R] Selecting variables in a multivariate regression
Edson Tirelli
ed.tirelli at gmail.com
Mon Apr 14 17:43:55 CEST 2014
Bert,
I am sorry for having troubled you. The double post was a mistake
because gmail sent the first e-mail in html and it went into
moderation queue. The second one was sent in plain text. I did not
know the moderator approved my first post.
1. As I said, I am a beginner in statistics and in R. I did spent ~8
hours yesterday googling around, reading tutorials and testing out
solutions. I also completed a couple coursera courses on data analysis
and R programming over the last few months, but since I was not able
to solve the problem by myself, I was hoping the friendly R community
would help me.
2. Please see my comments to (1).
Having said that, as a beginner of R, I had no idea there was a
package called "lavaan" that easily solves my problem. Someone else
pointed that to me over stackoverflow, and with his help I was able to
solve my problem:
http://stackoverflow.com/questions/23048501/selecting-variables-in-a-multivariate-regression-in-r
Please note that my actual problem is quite more complex than that,
with 15 independent variables and 11 dependent ones. My toy example in
this question was my attempt to simplify the question so that people
with experience could point me in the right direction.
Thank you anyway, I won't bother you again.
Edson
On Mon, Apr 14, 2014 at 9:33 AM, Bert Gunter <gunter.berton at gene.com> wrote:
> Well, this is your second post on the same topic, your first having
> received no response. So you should suspect something is amiss and
> reconsider before continuing, don't you think?
>
> 1. I, for one, was not able to make any sense of your query. You do
> not appear to understand regression, so I would suggest you spend time
> with a local statistical resource before continuing with online
> posts.If my understanding of your misunderstanding is correct, you
> need to comprehend basics. If not,apologies.
>
> 2. Have you read An Introduction to R (ships with R) or an online R
> tutorial of your choice? If not, do so before posting here further. We
> expect minimal efforts of posters to solve their own problems before
> posting. Again, apologies if I err.
>
> Cheers,
> Bert
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
> (650) 467-7374
>
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> H. Gilbert Welch
>
>
>
>
> On Sun, Apr 13, 2014 at 8:08 PM, Edson Tirelli <ed.tirelli at gmail.com> wrote:
>> I am quite new to R and I am having trouble figuring out how to select
>> variables in a multivariate linear regression in R. My google-fu also
>> did not find anything.
>>
>> Pretend I have the following formulas:
>>
>> P = aX + bY
>> Q = cZ + bY
>>
>> I have a data frame with column P, Q, X, Y, Z and I need to find a, b and c.
>>
>> If I do a simple multivariate regression:
>>
>> result <- lm( cbind( P, Q ) ~ X + Y + Z - 1 )
>>
>> It calculates a coefficient for "c" on P's regression and for "a" on
>> Q's regression.
>>
>> If I calculate the regressions individually then "b" will be different
>> in each regression.
>>
>> How can I select the variables to consider in a multivariate
>> regression? I.e., how do I tell R to ignore cZ when calculating P, and
>> ignore aX when calculating Q?
>>
>> Thank you,
>> Edson
>>
>> ______________________________________________
>> 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.
--
Edson Tirelli
Principal Software Engineer
Red Hat Business Systems and Intelligence Group
More information about the R-help
mailing list