1
$\begingroup$

I'm working on disease prevalence, something I've never done before, and I'm trying to weight a gam with population. It seems to me that the prevalence rate for China ought to count a bit more than Niue. I am fitting GAM models using the R packages mgcv. BTW, for this disease, as far as we know now, everyone is at risk so it's not a prevalance ratio problem like with communicable diseases.

My problem is that logistic gam weights are counted as the $N$ while the response variable is then supposed to be counts. I really only have counts /million (which I can easily make proportions of course) derived from long term data collection and the data for some countries yield counts of only a couple / million when their populations are in thousands. Therefore, I can't turn it into the actual count and gam can't work out the model. The real $N$ that went into determining the numbers is not the population, since the data is collected and averaged over time, but they are highly correlated. So I still want to use it as a weight.

There's that problem and additionally that when I'm working out a model across 100 countries accounting for the bulk of the human population it seems that my CI's for the GAM should be rather small (nonexistent?). Therefore, I do need a way to get the population in there. Perhaps someone knows of a GAM package that can work with proportions rather than counts? I know there are some for generalized linear modelling but I need nonlinear.

$\endgroup$

2 Answers 2

1
$\begingroup$

The package you are using, mgcv, can fit an additive beta regression model, from version 1.8-0 onwards. Quoting from the ChangeLog

*** 'ocat', 'tw', 'nb', 'betar', 'ziP' and 'scat' families added for 
  ordered categorical data, Tweedie with estimation of 'p', negative binomial 
  with (fast) estimation of 'theta', beta regression for proportions, simple
  zero inflated Poisson regression and heavy tailed regression with scaled t 
  distribution. These are all examples of 'extended families' now useable 
  with 'gam'.

The package is now on 1.8-3, later versions having fixed a few bugs that were in the 1.8-0 release so make sure you get the latest version.

$\endgroup$
2
  • $\begingroup$ OK, weights seem to work like binomial and poisson, as counts, and residuals are always 0... it seems this isn't well implemented yet. The model itself doesn't seem too bad. $\endgroup$
    – John
    Commented Nov 10, 2014 at 21:56
  • $\begingroup$ @John could you use an offset() term to include the population? That's what I might do with a Poisson model for example if I wanted to standardise for effort or sample area etc. $\endgroup$ Commented Nov 10, 2014 at 22:28
0
$\begingroup$

It is not clear what exactly your question is. You should endeavor to better clarify your question. As an example of calculating prevalence intervals given an estimate of the prevalence (cases divided by number at risk) and total denominator (number at risk) can be done in the following way:

## example data:
state <- as.data.frame(cbind(state.x77, state.abb))
state$Population <- as.numeric(state$Population)
fit <- glm(Illiteracy ~ state.abb, family=binomial, data=state, weights=Population)
confint.default(fit) ## log odds of illiteracy by US state relative to Alabama in 1975
$\endgroup$
3
  • $\begingroup$ That's the current prevalence of something for which the population really is the denominator. In my case the population is not the denominator because the prevalence of the disease is so low that for many countries, at a given time, no one has it. However, there's still a probability they will have it dervived from longtitudinal data that, while not the population, is highly correlated. $\endgroup$
    – John
    Commented Nov 10, 2014 at 21:58
  • $\begingroup$ Even when the prevalence is 0, the population is indeed your denominator... unless of course you have strong evidence that not everyone is screened (in which case you need to account for survey weights, not frequency weights). Nonetheless, even when an estimated prevalence is zero you may invert the Score test to obtain a non-trivial confidence interval for that prevalence. There are some assumptions behind that. Best to just report it as 0 and leave it be. $\endgroup$
    – AdamO
    Commented Nov 10, 2014 at 23:38
  • $\begingroup$ Population may well be the denominator when the proportion is 0 but's it's most definitely not when the prevalence is 0.00002 and the population is 2400. That number was derived over time, not from the current, or even recent, population. I can't derive a count from that number that's appropriate for the population weighting. $\endgroup$
    – John
    Commented Nov 11, 2014 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.