[R] User defined GLM?

David Winsemius dwinsemius at comcast.net
Mon Jun 22 19:55:53 CEST 2009


On Jun 22, 2009, at 12:35 PM, francogrex wrote:

>
> Hello, I have this generalized linear formula:
> log(x[i]/n[i])=log(sum(x)/sum(n)) + beta[i]
> where the the x[i] and the n[i] are known.
> Is there a way to program the GLM procedure to input the formula  
> above and
> get the beta[i] estimates? If not the GLM is there another procedure  
> to do
> that? The aim also afterwards is to estimate the profile-likelihood  
> CIs for
> the beta parameters.

Not as stated. That would be expecting R to have symbolic algebraic  
capabilities. Maybe next year^Wdecade?

That model is equivalent to:

> log(x[i]/n[i])=log(sum(x)) - log(sum(n)) + beta[i]

So you could use a no-intercept model with log link in glm() and an  
offset term for the first two terms of the r.h.s.

probi <- (x[i]/n[i])
glm(probi ~ 0 + offset(log(sum(x)) - log(sum(n) ), family=poisson)
-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list