Postgresql 9.4 incrementing value issue
Use the window function lag() in a subquery:

UPDATE eventtransitions e
SET    count = COALESCE(count, 0) + t.count
FROM (
   SELECT prev, event, count(*) AS count
   FROM  (
      SELECT lag(pid)   OVER w AS prev_pid, pid
           , lag(event) OVER w AS prev    , event
      FROM   test4
      WINDOW w AS (ORDER BY time)
      ) t
   WHERE   prev_pid = pid  -- only where pid matches
   GROUP   BY prev, event
   ) t
WHERE  e.prev = t.prev
AND    e.event = t.event;


Seems like you only want to count rows cases where the previous row has the same pid. I eliminated all other.

Aggregate in the next step to get counts.  (That's what you were missing!) Then add the result to the existing count in eventtransitions.

COALESCE to catch possibly existing NULL values in eventtransitions.