On Fri, 2009-06-19 at 06:00 -0700, onyourmark wrote:
> I am trying to build a glm model with many inputs.
> I saw the following code in Rattle
> crs$glm <- glm(value ~ ., data=crs$dataset[,c(1:59,922)],
> family=binomial(link="logit"))
> 
> I am not clear about what 
> 
> value ~ .

From ?formula

     There are two special interpretations of '.' in a formula.  The
     usual one is in the context of a 'data' argument of model fitting
     functions and means 'all columns not otherwise in the formula':
     see 'terms.formula'.  In the context of 'update.formula', *only*,
     it means 'what was previously in this part of the formula'.


> 
> means and also, I see 
> 
> data=crs$dataset[,c(1:59,922)] 
> 
> I have read that the data argument is optional here
> "an optional data frame, list or environment (or object coercible by
> as.data.frame to a data frame) containing the variables in the model. If not
> found in data, the variables are taken from environment(formula), typically
> the environment from which glm is called"
> 
> when they say "data", is that meant to include the dependent variable as
> well. In other words,
> in the above statement 'value' is the dependent variable and it is also
> column 922 in the data set.

The variables in the formula will be looked up within 'data' and then on
from there (that is, the environment o the formula), but you can't
assume from that code alone that column 922 is the response variable
'value' or indeed that it is any of the variables in 'data' as 'value'
could occur in the environment of the formula, which is often, but not
always, the global workspace.

HTH

G

> Is this correct?
> correct
> Thank you.
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

Attachment: signature.asc
Description: This is a digitally signed message part

______________________________________________
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.

Reply via email to