Clinical prediction models predict the probability of an individual currently suffering from a disease or a future outcome event by constructing a regression equation containing multiple predictors. Most of the training set data needed to build prediction models come from cross-sectional studies, cohort studies, electronic case system, etc. In order to ensure the prediction accuracy of the prediction model and avoid overfitting, the sample size of the training set must be large enough. This paper introduces a sample size estimation method for establishing a predictive model when the predictive outcome is binary or survival outcome.