Re: [R] interacting variables in a formulae in R

2009-07-16 Thread Ista Zahn
Hi Peter,

> - Forwarded message --
> From: Peter Schmidtke 
> To: r-help@r-project.org
> Date: Wed, 15 Jul 2009 12:27:17 +0200
> Subject: [R] interacting variables in a formulae in R
> Dear R Mailing Subscribers,
>
> I just have a question of how R handles interacting variables in model
> creation using glm for instance.
>
> if I write :
>
> >>
> model=glm(solution~descriptor1+descriptor2+descriptor3,family=binomial(link="logit"))
>
> I should end up with coefficients for a logistic model that I can introduce
> easily in the mathematical form of such a model (weighted sum of these
> descriptors).
>
> But how do I have to interpret what R does with interacting terms, like
> this? :
>
> >>
> model=glm(solution~descriptor1:descriptor2+descriptor3,family=binomial(link="logit"))
>
> What does R with the numerical values of descriptor1 and 2 in order to fit
> the data? How I can rewrite the model in a mathematical form?
>

Take a look at

?contrasts

and

?model.matrix

At least I think that's what you're after...

-Ista
> Thanks in advance.
>
> Best regards.
> --
>
> Peter Schmidtke
>
> --
> PhD Student at the Molecular Modeling and Bioinformatics Group
> Dep. Physical Chemistry
> Faculty of Pharmacy
> University of Barcelona

__
R-help@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.


[R] interacting variables in a formulae in R

2009-07-15 Thread Peter Schmidtke
Dear R Mailing Subscribers,

I just have a question of how R handles interacting variables in model
creation using glm for instance. 

if I write : 

>>
model=glm(solution~descriptor1+descriptor2+descriptor3,family=binomial(link="logit"))

I should end up with coefficients for a logistic model that I can introduce
easily in the mathematical form of such a model (weighted sum of these
descriptors). 

But how do I have to interpret what R does with interacting terms, like
this? :

>>
model=glm(solution~descriptor1:descriptor2+descriptor3,family=binomial(link="logit"))

What does R with the numerical values of descriptor1 and 2 in order to fit
the data? How I can rewrite the model in a mathematical form?

Thanks in advance.

Best regards.
-- 

Peter Schmidtke

--
PhD Student at the Molecular Modeling and Bioinformatics Group
Dep. Physical Chemistry
Faculty of Pharmacy
University of Barcelona

__
R-help@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.