[R] Generalized linear model

Spencer Graves spencer.graves at pdf.com
Mon Nov 17 16:52:08 CET 2003


      From "?glm", I find the following: 

     subset: an optional vector specifying a subset of observations to be
              used in the fitting process.

      Thus, to delete observations 16 and 18, I can use the following: 

fit2<-glm(canc~id1+year1+time+lnpa,family=poisson, subset=-c(16,18))

hope this helps.  spencer graves

Marcos Sanches wrote:

>	Ok, it worked!!!
>
>  But what would be the command if I want to eliminate another point? I
>mean, two points at the same time.
>
>	Thanks,
>
>Marcos
>
>-----Original Message-----
>From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
>Sent: Monday, November 17, 2003 1:02 PM
>To: Marcos Sanches
>Cc: R-Help
>Subject: Re: [R] Generalized linear model
>
>
>The second fit appeared to use a dataframe and the first did not.  Try
>
>fit2<-glm(canc~id1+year1+time+lnpa,family=poisson, subset=-18)
>
>On Mon, 17 Nov 2003, Marcos Sanches wrote:
>
>  
>
>>	Hi all!
>>
>> I am fitting a Poisson model, using the following command:
>>
>>    
>>
>>>fit2<-glm(canc~id1+year1+time+lnpa,family=poisson)
>>>      
>>>
>>
>> where 'id1', 'year1' and 'time' are factors. I defined them with:
>>
>>    
>>
>>>id1<-C(factor(id1), treatment)
>>>      
>>>
>> and 'lnpa' is a continuous variable.
>>
>>The 'summary' function gives me all the effects estimates, that is, for
>>    
>>
>id1,
>  
>
>>I end up with estimates for id12, id13 and id14, the id11 is the reference
>>level. That is fine, but when I try to fit the model without the point 18,
>>using the command line:
>>
>>    
>>
>>>fit2<-glm(canc~id1+year1+time+lnpa,family=poisson, subset(dat,
>>>      
>>>
>order!=18))
>  
>
>>The 'summary' function stop to giving me the levels effect, and gives only
>>one effect for id1, one for year1, one for time and one for lnpa. I want
>>    
>>
>to
>  
>
>>have the parameters estimates for each level of each factor, as it was in
>>the first fit. Also, I noticed the degree of freedom of deviance and the
>>deviance itself has increased, so I cont't compare both models in terms of
>>their deviance.
>>
>> What should I do to have each factor level effect as I had in the first
>>case?
>>
>> Thanks
>>
>>Marcos
>>
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list
>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>
>>
>>    
>>
>
>--
>Brian D. Ripley,                  ripley at stats.ox.ac.uk
>Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>University of Oxford,             Tel:  +44 1865 272861 (self)
>1 South Parks Road,                     +44 1865 272866 (PA)
>Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>  
>




More information about the R-help mailing list