# Predictive Maintenance methods

I have a dataset which looks like this:

Timestamp           Event       Actions_since_last_maintenance
2016-01-01 12:00    Action      10
2016-01-01 12:01    Action      11
2016-01-01 12:01    ERROR       11
2016-01-01 12:02    Action      12
2016-01-01 12:03    Action      13
2016-01-01 12:04    Maintenance 0
2016-01-01 12:05    Action      1
2016-01-01 12:06    Action      2
2016-01-01 12:07    Action      3
2016-01-01 12:07    ERROR       3
2016-01-01 12:08    Maintenance 0
2016-01-01 12:09    Action      1
2016-01-01 12:10    Action      1
2016-01-01 12:11    Action      3
2016-01-01 12:12    ERROR       3


A machine is performing an action and I count the number of actions since the last maintenance. From time to time an error occurs at the machine. As a first step I want to calculate if there is a relationship between "Actions_since_last_maintenance" and the error. The final goal is to find an optimal maintenance interval for the machine.

It seems simple but I am not sure what is the best way to analyze that relationship statistically.

One thing I am not sure about is the fact that the maintenance intervals are not always the same.

So when I assume that the error is completely unrelated from "Actions_since_last_maintenance" and most of the time the maintenance is done after 3 actions I will find most errors between "actions_since_last_maintenance" 0 and 3 of course and not at values at 10 for example.

I hope the question is clear and someone could give me a hint. Thanks!