by Jorden
Last Updated November 08, 2018 23:19 PM

I have the following dataset:

```
> df1
Location SalesQty product
1 location 3 1 prod1
2 location 3 0 prod1
3 location 3 3 prod1
4 location 5 3 prod1
5 location 5 0 prod1
6 location 5 4 prod1
7 location 3 2 prod2
8 location 3 5 prod2
9 location 5 2 prod2
10 location 5 1 prod2
```

I want to perform a poisson regression to predict/estimate the SalesQty of prod1 on location 3 and 5 and prod 2 on location 3 and 5 (I know there are not enough datapoints such that a predictor will be significant). The SalesQties can be visualised as:

If you run:

```
Reg <- glm(SalesQty ~ Location, family = "poisson", data = df1)
```

The predictions on each location is just the average per location. This is due to the least squares error per location.

If you run:

```
Reg <- glm(SalesQty ~ product + Location, family = "poisson", data = df1)
```

I am figuring out how the coefficients of each categorized predictor play a role in the formula for predicting the SalesQty of a product on a location.

Only considering the location, the formula will be: ln(SalesQty) = $\beta_0$ + $\beta_5 I_5$ with $\beta_0$ beiing the intercept corresponding to location 3. Now $exp(\beta_0)$ is the average of the SalesQties of location 3 and $exp(\beta_0$ + $\beta_5)$ is the average of the SalesQties of location 5. But when considering 2 categorical predictors, the location ánd the product, I don't see how to interpret the coeficients and the modelling formula.

I hope someone can send me in the right direction

- ServerfaultXchanger
- SuperuserXchanger
- UbuntuXchanger
- WebappsXchanger
- WebmastersXchanger
- ProgrammersXchanger
- DbaXchanger
- DrupalXchanger
- WordpressXchanger
- MagentoXchanger
- JoomlaXchanger
- AndroidXchanger
- AppleXchanger
- GameXchanger
- GamingXchanger
- BlenderXchanger
- UxXchanger
- CookingXchanger
- PhotoXchanger
- StatsXchanger
- MathXchanger
- DiyXchanger
- GisXchanger
- TexXchanger
- MetaXchanger
- ElectronicsXchanger
- StackoverflowXchanger
- BitcoinXchanger
- EthereumXcanger