Re: [R] glm - change offset to avoid NA?

2013-07-16 Thread David Winsemius

On Jul 16, 2013, at 8:52 AM, Hermann Norpois wrote:

> I did not think of something like "try". I thouht that there should always
> be a value if I do a logistic regression but sometimes the values are far
> from being meaningful. So there is a cut-off.

That seems implausilbe. I think you are just seeing the effect of a random 
selection creating a data situation where the interaction term is aliased with 
the others, in which case `glm` will set the coefficient to NA.

> My plan was to change the
> cut-off.

You said there was an "error", but you should have said that the results were 
unexpected. You can create an "error-condition" when this occurs with the 
`stop` function. And then do whatever remedial work is needed.

-- 
David.

> Thanks
> Johannes
> 
> 
> 2013/7/15 Bert Gunter 
> 
>> I think what you want is
>> 
>> ?try  ##or
>> ?tryCatch
>> 
>> ## The second is more flexible but slightly more complicated.
>> 
>> to trap the error and perhaps refit the model without interaction?
>> 
>> Cheers,
>> Bert
>> 
>> On Mon, Jul 15, 2013 at 10:45 AM, Hermann Norpois 
>> wrote:
>>> Hello,
>>> 
>>> I use glm within a function testing for the appearence of the coexistence
>>> of (minor allels in a subset of)  snps. And then I extract the
>>> Pr(>|z|)-value for the interaction. Principally it works but sometimes
>> the
>>> function stops because this "value for the interaction"  is NA. For
>>> instance, this is the case in the following example:
>>> 
>>> lz <- glm(trait~rs7572685*rs10520302, data=mus, family=binomial)
 summary (lz)
>>> ...
>>> Coefficients: (1 not defined because of singularities)
>>> Estimate Std. Error z value Pr(>|z|)
>>> (Intercept)   0.056140.16782   0.3350.738
>>> rs7572685 0.490410.41437   1.1830.237
>>> rs105203020.492690.43514   1.1320.258
>>> rs7572685:rs10520302   NA NA  NA   NA
>>> ...
>>> 
>>> I would prefer some values instead of NA (though it does not make any
>> sense
>>> in terms of interpretation) for the sake of the smooth running of my
>>> function. How is this done? I guess I have to change the offset but I
>> dont
>>> understand how.
>>> Thanks
>>> 
>>>[[alternative HTML version deleted]]
>>> 
>>> __
>>> 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.
>> 
>> 
>> 
>> --
>> 
>> Bert Gunter
>> Genentech Nonclinical Biostatistics
>> 
>> Internal Contact Info:
>> Phone: 467-7374
>> Website:
>> 
>> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> 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.

David Winsemius
Alameda, CA, USA

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


Re: [R] glm - change offset to avoid NA?

2013-07-16 Thread Hermann Norpois
I did not think of something like "try". I thouht that there should always
be a value if I do a logistic regression but sometimes the values are far
from being meaningful. So there is a cut-off. My plan was to change the
cut-off.
Thanks
Johannes


2013/7/15 Bert Gunter 

> I think what you want is
>
> ?try  ##or
> ?tryCatch
>
> ## The second is more flexible but slightly more complicated.
>
> to trap the error and perhaps refit the model without interaction?
>
> Cheers,
> Bert
>
> On Mon, Jul 15, 2013 at 10:45 AM, Hermann Norpois 
> wrote:
> > Hello,
> >
> > I use glm within a function testing for the appearence of the coexistence
> > of (minor allels in a subset of)  snps. And then I extract the
> > Pr(>|z|)-value for the interaction. Principally it works but sometimes
> the
> > function stops because this "value for the interaction"  is NA. For
> > instance, this is the case in the following example:
> >
> > lz <- glm(trait~rs7572685*rs10520302, data=mus, family=binomial)
> >> summary (lz)
> > ...
> > Coefficients: (1 not defined because of singularities)
> >  Estimate Std. Error z value Pr(>|z|)
> > (Intercept)   0.056140.16782   0.3350.738
> > rs7572685 0.490410.41437   1.1830.237
> > rs105203020.492690.43514   1.1320.258
> > rs7572685:rs10520302   NA NA  NA   NA
> > ...
> >
> > I would prefer some values instead of NA (though it does not make any
> sense
> > in terms of interpretation) for the sake of the smooth running of my
> > function. How is this done? I guess I have to change the offset but I
> dont
> > understand how.
> > Thanks
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > 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.
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
>
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>

[[alternative HTML version deleted]]

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


Re: [R] glm - change offset to avoid NA?

2013-07-15 Thread Bert Gunter
I think what you want is

?try  ##or
?tryCatch

## The second is more flexible but slightly more complicated.

to trap the error and perhaps refit the model without interaction?

Cheers,
Bert

On Mon, Jul 15, 2013 at 10:45 AM, Hermann Norpois  wrote:
> Hello,
>
> I use glm within a function testing for the appearence of the coexistence
> of (minor allels in a subset of)  snps. And then I extract the
> Pr(>|z|)-value for the interaction. Principally it works but sometimes the
> function stops because this "value for the interaction"  is NA. For
> instance, this is the case in the following example:
>
> lz <- glm(trait~rs7572685*rs10520302, data=mus, family=binomial)
>> summary (lz)
> ...
> Coefficients: (1 not defined because of singularities)
>  Estimate Std. Error z value Pr(>|z|)
> (Intercept)   0.056140.16782   0.3350.738
> rs7572685 0.490410.41437   1.1830.237
> rs105203020.492690.43514   1.1320.258
> rs7572685:rs10520302   NA NA  NA   NA
> ...
>
> I would prefer some values instead of NA (though it does not make any sense
> in terms of interpretation) for the sake of the smooth running of my
> function. How is this done? I guess I have to change the offset but I dont
> understand how.
> Thanks
>
> [[alternative HTML version deleted]]
>
> __
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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