The modeling of nonstationary electroencephalogram (EEG) with time-varying autoregressive (TVAR) models is discussed. The classical least squares TVAR approach is modified so that prior assumptions about the signal can be taken into account in an optimal way. The method is then applied to the estimation of event-related synchronization changes in the EEG. The results show that the new approach enables effective estimation of the parameter evolution of the time-varying EEG with better time resolution compared to previous methods. The new method also allows single-trial analysis of the event-related synchronization.