In this paper, discrete choice methods in the form of multinomial logit and latent class models are proposed to explain ticket purchase timing of passenger railway. The choice model and demand functions are incorporated into a revenue optimization problem which jointly considers pricing and seat allocation. The framework provides insightful policy implications in term of fare and capacity distribution derived from actual passenger behavior. It shows that accepting short-haul demand provides greater revenue than long-haul demand using the same capacity. Revenue improvement ranges from 16.24% to 24.96% in multinomial logit models and from 13.82% to 21.39% in latent class models respectively.