[R] generalized linear models

Alain Zuur highstat at highstat.com
Sun Aug 9 10:12:25 CEST 2009



annie Zhang wrote:
> 
> Hi, Milton,
> 
> Thank you for the reply. I tried, but it seems the problem is the column
> name of the test data is not the same as the column name of the training
> data. I didn't give the column name, the system seemed do. How to chang
> here?
> 
> Annie
> 
> On Fri, Aug 7, 2009 at 7:52 PM, milton ruser <milton.ruser at gmail.com>
> wrote:
> 
>> Hi Annie,
>>
>> create a new data.frame with input variables having all predictors
>> variables on it.
>> after give a look at ?predict
>>
>> best wishes
>>
>> milton
>>
>>   On Fri, Aug 7, 2009 at 8:19 PM, annie Zhang
>> <annie.zhang2010 at gmail.com>wrote:
>>
>>>  Hi, R users,
>>>
>>> I am trying to use glm to do logistic regression. I know generally when
>>> I
>>> have two covariates, say x1 and x2, then I do
>>> fit <- glm(y~x1+x2,famliy='binomial')
>>> But now my covariates form a n*p matrix, say x, so actually each column
>>> is
>>> a
>>> covariate. So I think I should do
>>> fit <- glm(y~x,family='binomial')
>>> Then I need to predict new data. How should I write the newdata? I tried
>>> several thing, all failed. The x in the fit is a matrix, but is a vector
>>> for
>>> the new data.
>>>
>>> Thank you,
>>> Annie
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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<http://www.r-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
> 
> 


See:
?colnames

Alain



-----
--------------------------------------------------------------------
Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.

2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.

3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Email: highstat at highstat.com
URL: www.highstat.com



-- 
View this message in context: http://www.nabble.com/generalized-linear-models-tp24873759p24885065.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list