defcreate_MAdata(thetas=[0.1],mu=1,N=400,init=1,c=1,sigma=0.3):"""GGenerate MA Process data"""epsilon=np.random.normal(loc=0,scale=sigma,size=N)data=np.zeros(N)data[0]=initfortinrange(2,N):res=mu+epsilon[t]forj,theta_jinenumerate(thetas):res+=theta_j*epsilon[t-j-1]data[t]=resreturndata