Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I have a series of non-negative integers $y=(y_1,y_2,..., y_n)$ and a design matrix $y = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \beta_3 x_1 x_2$, where $x_0$ and $x_1$ are $0$ or $1$, $x_1x_2$ is the interaction, and $\beta_0 \ldots \beta_3$ are parameters we want to estimate. For example, the data look like

y    x1    x2    x1*x2
10   0     0     0
23   0     1     0
18   1     1     1
19   1     0     0
25   0     1     0

I want to estimate the $\beta_0$, $\beta_1$, $\beta_2$ and $\beta_3$ coefficients and perform a test to see if any coefficient is nonzero.

There are several different regression models that might be applied to this case:

  1. Simple linear regression: lm
  2. Poisson regression (when $y$ follows a Poisson distribution): glm with family = poisson
  3. Quasi-poisson regression (when $y$ is over-dispersed; that means $\text{sd}(y) \gt \text{mean}(y)$): glm with family = quasi-poisson
  4. Negative binomial regression (when $y$ is over-dispersed, $\text{sd}(y) \gt \text{mean}(y)$): glm.nb, in MASS package.

The questions I want to ask are:

  1. How should I select the model for this dataset? Is there any way to choose the right model based on some descriptive statistics of my dataset?
  2. How should I check and validate if the fitted selected model is right for my data?

Thanks everyone.

share|improve this question
This is off topic on a programming Q&A site. You should ask at a stats site. –  David Heffernan Oct 2 '11 at 15:47
Could you specify what kind of outcome ($y$) you are studying? It might further help to decide among the various modeling strategies you proposed, or suggest other ones. –  chl Oct 3 '11 at 11:57
It looks like you're overthinking this one. You have only four distinct categories, corresponding to $(x_1,x_2) \in \{(0,0),(0,1),(1,0),(1,1)\}$. Allowing four parameters is tantamount to fitting the $y$'s separately in each category. Therefore you really have four independent problems and each of them reduces to summarizing a univariate dataset. Where to go from here depends on the nature of the $y$'s and the purpose of the model, neither of which is apparent in the question. –  whuber Oct 21 '11 at 20:24
Use a random forest? –  Jase Feb 8 '14 at 7:32

1 Answer 1

My advice? Try them all and compare.

Your last two questions are the million dollar questions. I think you should be able to evaluate the significance of each of the coefficients and retain only those that contribute to the efficacy of your model.

But the real question is: Why a polynomial at all? Would another form do better?

You can certainly inspect your data, overlay the model, and judge for yourself whether it looks like it's doing a good job. You can calculate mean square errors, absolute errors, relative errors and assess each one.

But, like any model, you'll always be left to wonder whether you've left out something important, assumed too much, or if a "black swan" data point will come along and smash your lovely edifice to bits. It's the curse that all modelers must live with.

share|improve this answer
Without knowing precisely what the response variable is, it is actually difficult to imagine trying all possible models! The use of a term like "efficacy" in your 2nd paragraph should be justified, in the context of the question. –  chl Oct 3 '11 at 11:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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