代写_论文代写_ESSAY PhD团队论文、作业代写-不是中介 更加专业

首页 > 成果展示 > 数学统计 >

MIT高难度统计作业代写高分范文

若要问EssayPhD最擅长代写的科目,那非统计论文和assignment莫属。EssayPhD团队聚集了包括UCL、UC Berkeley、滑铁卢等名校统计、金融、数学相关专业的PhD超豪华队伍。有段时间,某个就读于MIT统计专业的同学来求助EssayPhD,希望代写统计assignment。因为难度很高,一开始客户对我们团队还不是很信任,当时我们的roger立马把第一题的解题步骤列出来,顿时征服了客户,后来老师的评分也证明了roger的实力。
EssayPhD保证范文的原创性,请勿使用作其他用途。以下是这篇统计作业代写的范文:
Q1
The estimation result is reported below.
Note that the numerical optimization employed is extremely sensitive to the initial value, the initial vector for the parameters is specified referring to “Björk, T. (2004). Arbitrage theory in continuous time. Oxford university press”.
Both of the call prices calculated for Vasicek model and CIR model are close to zero.
统计作业代写
R code:
rm(list=ls())
data=read.table("http://stanford.edu/~xing/statfinbook/_BookData/Chap10/bonds_yield_dec2006.txt",header=T)
data=as.matrix(data)
Vasicek=function(para){
theta=para[1]
sigma=para[2]
kp=para[3]
rt=para[4]
T=data[,1]
Rt.obs=data[,2]/100
Bt=(1-exp(-kp*T))/kp
logAt=(theta/kp-sigma^2/2/kp^2)*(Bt-T)-sigma^2/4/kp*Bt^2
Rti=(-logAt+rt*Bt)/T
return(sum((Rti-Rt.obs)^2))
}
CIR=function(para){
theta=para[1]
sigma=para[2]
kp=para[3]
rt=para[4]
T=data[,1]
Rt.obs=data[,2]/100
h=sqrt(kp^2+2*sigma^2)
Bt=2*(exp(T*h)-1)/(2*h+(kp+h)*(exp(T*h)-1))
logAt=2*kp*theta/sigma^2*((kp+h)*T/2+log(2*h)-log(2*h+(kp+h)*(exp(T*h)-1)))
Rti=(-logAt+rt*Bt)/T
return(sum((Rti-Rt.obs)^2))
}
##initial values are set meticulous referring to
##Björk, T. (2004). Arbitrage theory in continuous time. Oxford university press.
obs=data[,2]
N=length(obs)-1
dt=mean(diff(data[,1]))
dataobs=obs[2:(N+1)]
lagdata=obs[1:N]
bhat=(sum(dataobs*lagdata) - sum(dataobs)*sum(lagdata)/N)/(sum(lagdata*lagdata) - sum(lagdata)*sum(lagdata)/N)
kappahat=-log(bhat)/dt
ahat=sum(dataobs)/N-bhat*sum(lagdata)/N
thetahat=ahat/(1-bhat)
s2hat=sum((dataobs-lagdata*bhat-ahat)^2)/N
sigmahat=2*kappahat*s2hat/(1-bhat^2)
VAS=optim(par=c(thetahat,sigmahat,kappahat,0.04),fn=Vasicek,method="L-BFGS-B",lower=c(0,0,0,0))
CIRp=optim(par=VAS$par,fn=CIR,method="L-BFGS-B",lower=c(0,0,0,0))
theta_vas=VAS$par[1]
sigma_vas=VAS$par[2]
kp_vas=VAS$par[3]
r_vas=4.75/100
B25_v=(1-exp(-kp_vas*2.5))/kp_vas
logA25_v=(theta_vas/kp_vas-sigma_vas^2/2/kp_vas^2)*(B25_v-2.5)-sigma_vas^2/4/kp_vas*B25_v^2
p25_v=exp(logA25_v)*exp(-B25_v*r_vas)
B30_v=(1-exp(-kp_vas*3))/kp_vas
logA30_v=(theta_vas/kp_vas-sigma_vas^2/2/kp_vas^2)*(B30_v-3)-sigma_vas^2/4/kp_vas*B30_v^2
p30_v=exp(logA30_v)*exp(-B30_v*r_vas)
sigmap=sigma_vas*sqrt((1-exp(-2*kp_vas*2.5))/2/kp_vas)*(1-exp(-kp_vas*(3-2.5)))/kp_vas
h_v=1/sigmap*log(p30_v/p25_v/0.99)+sigmap/2
Z_v=p30_v*pnorm(h_v)-0.99*p25_v*pnorm(h_v-sigmap)
P_v=Z_v*exp(5/100*2.5*2)*100
theta_cir=CIRp$par[1]
sigma_cir=CIRp$par[2]
kp_cir=CIRp$par[3]
r_cir=4.75/100
h_cir=sqrt(kp_cir^2+2*sigma_cir^2)
B25_c=2*(exp(2.5*h_cir)-1)/(2*h_cir+(kp_cir+h_cir)*(exp(2.5*h_cir)-1))
logA25_c=2*kp_cir*theta_cir/sigma_cir^2*((kp_cir+h_cir)*2.5/2+log(2*h_cir)-log(2*h_cir+(kp_cir+h_cir)*(exp(2.5*h_cir)-1)))
p25_c=exp(logA25_c)*exp(-B25_c*r_cir)
B30_c=2*(exp(3*h_cir)-1)/(2*h_cir+(kp_cir+h_cir)*(exp(3*h_cir)-1))
logA30_c=2*kp_cir*theta_cir/sigma_cir^2*((kp_cir+h_cir)*3/2+log(2*h_cir)-log(2*h_cir+(kp_cir+h_cir)*(exp(3*h_cir)-1)))
p30_c=exp(logA30_c)*exp(-B30_c*r_cir)
logA05_c=2*kp_cir*theta_cir/sigma_cir^2*((kp_cir+h_cir)*0.5/2+log(2*h_cir)-log(2*h_cir+(kp_cir+h_cir)*(exp(0.5*h_cir)-1)))
B05_c=2*(exp(0.5*h_cir)-1)/(2*h_cir+(kp_cir+h_cir)*(exp(0.5*h_cir)-1))
psi=(h_cir+kp_cir)/sigma_cir^2
rho=2*h_cir/(sigma_cir^2*exp(h_cir*2.5)-1)
mu=log(exp(logA05_c)/99)/(B05_c)
Z_c=p30_c*pchisq(2*mu*(rho+psi+B05_c),4*kp_cir*theta_cir/sigma_cir^2,2*rho^2*r_cir*exp(h_cir*2.5)/(rho+psi+B05_c))-99*p25_c*pchisq(2*mu*(rho+psi),4*k
p_cir*theta_cir/sigma_cir^2,2*rho^2*r_cir*exp(h_cir*2.5)/(rho+psi))
P_c=Z_c*exp(5/100*2.5*2)*100
###result
if(1>0){
cat("estimation of Vasicek Model","\n")
cat("theta:",VAS$par[1]*VAS$par[3],"\n")
cat("volatility (sigma):",VAS$par[2],"\n")
cat("reversion speed (kappa):",VAS$par[3],"\n")
cat("short term rate:",VAS$par[4],"\n")
cat("call price:",P_v,"\n")
cat("estimation of Cox, Ingersoll & Ross (CIR) Model","\n")
cat("theta:",CIRp$par[1]*CIRp$par[3],"\n")
cat("volatility (sigma):",CIRp$par[2],"\n")
cat("reversion speed (kappa):",CIRp$par[3],"\n")
cat("short term rate:",CIRp$par[4],"\n")
cat("call price:",P_c,"\n")
}