# Poisson processes or regression for lambda

I am asked to solve a problem where I have a machine producing toys in tho slots and want to predict number of faulty toys. The data is like this:

BatchNo Temp1 Temp2 Outside S1H1 S2H1 S1H2 S2H2
1         1.05  0.9   HOT     0    2     0   1
1         0.77  0.76  N/A     1    1     2   1
...
23011     1.23  1.12  COLD    2    1     1   0


where S1H1 is Slot one, Period one and S2H2 is Slot two, period two. I can expect a correlation between the fault ratios in the two different slots and between period 1 (morning run) and period 2 (afternoon). Each batch can be between 5 and 50 runs so I think I should cluster them somehow to see which batchs are similar.

I did a model with four different Poisson processes, one for each slot and period. I just calculated the mean for each slot/time and used that as lambda. It fitted well which was a good start.

The thing I should model is actually, given all data at lunch ([BatchNo, Temp1, Temp2, Humidity, S1H1, S2H1]) what is my expectation or distribution for S1H2+S2H2, i.e number of faults in the afternoon run.

Looking at Po(S1H1 + S2H1 + S1H2 + S2H2) I saw that it differed quite a bit from a Poisson distribution, probably because of correlation between the processes. I did a Copula approach which worked well - the sums of the processes was also OK.

Now I am a bit lost and think that my approach so far is wrong: I have made a general model of fault rates, but I have not used the information I have (temperatures, humidity, batch number) to predict expected fault rate (or distribution) for each row I have in my data. I want to know P(S1H2 + S2H2 | S1H1, S2H1, Batch, Temps, Humidity) for each row and calculate some metric for how good fit that distribution is.

Should I do a Poisson regression instead, and how does that relate to my correlated Poisson processes? I have S1H1 = Po(lambda) and think that I would like to express lambda as a function of input variables, given that sum of lambdas is equal to the lambda I found out when constructing the processes.

All enlightenment to how a Poisson (or GLM) regression helps me finding out a model for individual processes are welcome.