Simulation of pedestrians in shared spaces poses a significant challenge in autonomous driving virtual testing. The simulation pedestrian model can respond to autonomous vehicle behaviour changes. We present HFPM: a Hierarchical Forecasting Pedestrian Model to imitate pedestrian behaviour. The model has three layers: the dynamics model layer, the path planning layer, and the decision layer. In the dynamics model layer, an improved force model with the heading direction of the pedestrian is developed based on the Social Force Model, which can model pedestrian-pedestrian interaction. In the path planning layer, an Artificial Potential Field model is modified to plan a feasible path to the individual goals. The planning layer has a prediction module to predict the trajectory of vehicles on the road in order to choose the best route with no collision. The decision layer is a finite state machine with five states: the pedestrian can approach, walk, wait, run and reach the goal. The resulting HFPM model can produce more accurate simulation results than previously developed policy-based models, as demonstrated through qualitative and quantitative comparisons with a baseline pedestrian model obtained from the CITR data set.