Most would argue that it represents revenge. However, a very good arguement could be made for the ghost being Hamlet's alter ego. We have good evidence to support that in several places Shakespeare makes allusions to the fact that the ghost looks remarkably like Hamlet, and there are several parallels drawn between the ghost and Hamlet.