Ding's profileEpicMorningBellPhotosBlogListsMore ![]() | Help |
|
6/21/2009 A shrewd insight merely through observation.The fact that the thorny vine finally gave in to the inexorable hunter, as meant to be as it was, still revealed an exciting truth that sometimes the most profund impact could've come from an simple yet benign act, scrubbing away the layer of confusion and contradiction for those who enjoyed the comfort provided so long by various excuses.... 3/19/2009 Distilled truth.The most horrible force in this world is neither the complication of weaponry, nor the great might of deadly army, but the little greed resides in that man's heart. -- He who was not metionable long ago... 2/27/2009 Retirement Planning.To program a simulation in Matlab that is meant to assist in retirement planning. Make the following assumptions: a. You have 30 years until retirement. b. Your income is currently $100,000 per year. c. It will increase at the rate of inflation (r_inf) which is 3% per year (annualized) (so next year, you’ll earn $103,000). d. During each of the next 30 years, you contribute x% of this income to a retirement account. For simplicity, assume that your contribution is made in a lump sum at the beginning of each year. e. You begin with an asset allocation of 60% stocks and 40% (long-term) bonds. During each subsequent year, you reduce the asset allocation to stocks, so that after T years, you have 60-T % in stocks and 40+T % in bonds. (You’ll rebalance your portfolio at the beginning of each year by selling stocks or bonds to ensure that you have the appropriate allocation for that year.) f. During each of the 30 years after retirement (years 31-60), you withdraw 70% of your current income, adjusted for inflation. (For instance, in year 40, you withdraw .7*100,000*(1.03)^40.) g. Assume that on average, stocks return 10% per year, while bonds return 6.5%. Furthermore, the standard deviation of the log-return of stocks over one year is 20%, while the standard deviation of the log-return of bonds is 8%. The correlation between stock and bond log-returns is 0.2. (Through time, this correlation is actually very unstable, but more often than not, it is positive.) The simulation will entail 60 annual timesteps. What percentage of your income (x) must you contribute to your retirement account to ensure that there is less than a 5% chance that you’ll run out of money during your 30 years of retirement? What percentage must you contribute to ensure that the probability of exhausting your savings is less than 1%
ms=.1;
ss=.2;
mb=.065;
sb=.08;
rho=.2;
NumTimeSteps=60;
NumPaths=50000;
Initws=.6;
InitAssetValue=100000;
InflaRate=.03;
TimetoRetirement=30;
x=.5;
function[rs,rb]=AssetReturnsSimulation(ms,ss,mb,sb,rho,NumTimeSteps,NumPaths)
dt=1;
y1=randn(NumTimeSteps,NumPaths);
x2=randn(NumTimeSteps,NumPaths);
y2=rho*y1+sqrt(1-rho^2)*x2;
MuStock=log(1+ms)-ss^2/2;
MuBond=log(1+mb)-sb^2/2;
MS=repmat(MuStock,NumTimeSteps,NumPaths);
MB=repmat(MuBond,NumTimeSteps,NumPaths);
rs=exp(MS+ss*sqrt(dt)*y1);
rb=exp(MB+sb*sqrt(dt)*y2);
end
function [PortfolioReturns]=PortfolioReturnsCalculation(Initws,rs,rb,NumTimeSteps,NumPaths)
ws=zeros(NumTimeSteps,1);
wb=zeros(NumTimeSteps,1);
for t=1:NumTimeSteps
ws(t)=Initws-t/100;
wb(t)=1-ws(t);
end
Ws=repmat(ws,1,NumPaths);
Wb=repmat(wb,1,NumPaths);
PortfolioReturns=Ws.*rs+Wb.*rb;
end
function [RetPlan]=CashInflowPattern(InitAssetValue,InflaRate,x,PortfolioReturns,TimetoRetirement,NumPaths)
income=zeros(TimetoRetirement,1);
for t=1:30
income(t)=InitAssetValue*(1+InflaRate)^t;
end
PR1=PortfolioReturns(1:TimetoRetirement,:);
Income=repmat(income,TimetoRetirement,NumPaths);
CashIn=zeros(TimetoRetirement,NumPaths);
CashIn(1,:)=Income(1,:).*PR1(1,:);
for k=2:30
CashIn(k,:)=(CashIn(k-1,:)+Income(k,:)).*PR1(k,:);
end
X=repmat(x,TimetoRetirement,NumPaths);
RetPlan=X.*CashIn;
end
function [RetAcct]=CashOuflowPattern(NumTimeSteps,NumPaths,InitAssetValue,InflaRate,PortfolioReturns,TimetoRetirement,RetPlan)
NumWithdraw=NumTimeSteps-TimetoRetirement;
PR2=PortfolioReturns(TimetoRetirement+1:NumTimeSteps,:);
withdrawal=zeros(NumTimeSteps,1);
for t=TimetoRetirement+1:NumTimeSteps
withdrawal(t)=0.7*InitAssetValue*(1+InflaRate)^(t);
end
Withdrawal=repmat(withdrawal(TimetoRetirement+1:NumTimeSteps,:),1,NumPaths);
RetAcct(1,:)=(RetPlan(TimetoRetirement,:)-Withdrawal(1,:)).*PR2(1,:);
for t=2:TimetoRetirement;
RetAcct(t,:)=(RetAcct(t-1,:)-Withdrawal(t,:)).*PR2(t,:);
end
function [RunOutofMoneyPercentage]=Evolve(ms,ss,mb,sb,rho,Initws,InitAssetValue,InflaRate,x,TimetoRetirement,NumTimeSteps,NumPaths)
[rs,rb]=AssetReturnsSimulation(ms,ss,mb,sb,rho,NumTimeSteps,NumPaths);
[PortfolioReturns]=PortfolioReturnsCalculation(Initws,rs,rb,NumTimeSteps,NumPaths);
[RetPlan]=CashInflowPattern(InitAssetValue,InflaRate,x,PortfolioReturns,TimetoRetirement,NumPaths);
[RetAcct]=CashOuflowPattern(NumTimeSteps,NumPaths,InitAssetValue,InflaRate,PortfolioReturns,TimetoRetirement,RetPlan);
Count=zeros(30,1);
for T=1:30;
Count(T,1)=length(find(RetAcct(T,:)<0));
end
RunOutofMoneyPercentage=max(Count)/length(RetAcct(T,:));
end
function[x]=BisectionAlgorithm(ms,ss,mb,sb,rho,Initws,InitAssetValue,InflaRate,TimetoRetirement,NumTimeSteps,NumPaths,Percentage,Precision)
high=1;
low=0;
x=(high+low)/2;
RunOutofMoneyPercentage=Evolve(ms,ss,mb,sb,rho,Initws,InitAssetValue,InflaRate,x,TimetoRetirement,NumTimeSteps,NumPaths);
while abs(RunOutofMoneyPercentage-Percentage)>Precision
if RunOutofMoneyPercentage>Percentage
low=x;
else high=x;
end
x=(high+low)/2;
RunOutofMoneyPercentage=Evolve(ms,ss,mb,sb,rho,Initws,InitAssetValue,InflaRate,x,TimetoRetirement,NumTimeSteps,NumPaths);
end
end
Command Window:
Percentage=.05;
Precision=.00002;
[x]=BisectionAlgorithm(ms,ss,mb,sb,rho,Initws,Initwb,InitAssetValue,InflaRate,TimetoRetirement,NumTimeSteps,NumPaths,Percentage,Precision)
x =0.4293
Percentage=.01;
[x]=BisectionAlgorithm(ms,ss,mb,sb,rho,Initws,Initwb,InitAssetValue,InflaRate,TimetoRetirement,NumTimeSteps,NumPaths,Percentage,Precision)
x =0.5677 2/20/2009 One period Jump Diffusion Simulationfunction [S,MeanS]=JumpDiffusionStockEvolution(S0,m,s,lda,pup,pdown,NumPaths) S=zeros(1,NumPaths); x=rand(1,NumPaths); y=randn(1,NumPaths); z=rand(1,NumPaths); for t=1:NumPaths if x(t)<=pup S(t)=S0*exp(m+s*y(t))*exp(-log(z(t))/lda); elseif x(t)>=1-pdown S(t)=S0*exp(m+s*y(t))*exp(log(z(t))/lda); else S(t)=S0*exp(m+s*y(t)); end end MeanS=mean(S); end
2/10/2009 A probability density parameters estimation function.function [m,s]=estimateMultModelParams(stockTimeSeries,indexTimeSeries,LookbackPeriod,indexReturn,riskFreeRate) swr=stockTimeSeries(1:LookbackPeriod)./stockTimeSeries(2:LookbackPeriod+1)-1; iwr=indexTimeSeries(1:LookbackPeriod)./indexTimeSeries(2:LookbackPeriod+1)-1; covmatx=cov(swr,iwr); beta=covmatx(1,2)/covmatx(2,2); fcastR=riskFreeRate/LookbackPeriod+beta*(indexReturn/LookbackPeriod-riskFreeRate/LookbackPeriod); s=std(log(stockTimeSeries(1:LookbackPeriod)./stockTimeSeries(2:LookbackPeriod+1))); m=log(1+fcastR)-s^2/2; end
If you define and input data into those variables, you can use it to estimate the probability density of a function of a variable subjected to normal distribution, with a mean of m, and a standard deviation of s. Here is an example: >>x=-4:.1:4; >>m=.06; >>s=.02; >>T=5; >>By=1./(1+(m+s*x)/2).^(2*T);
>>Plot(By, (1/(s*T))*normpdf(x)./(By.^(1+1/(2*T)))), title(‘bond price distribution with a yield subject to normal distribution.’)
2/8/2009 A bewildered soul.On this blade,on my name,both true and given,an on all the good and evil i have done in life,i commit all the days that remain to me,for better or for worse,to Tyr and to his justice.Let it be so!----Aribeth de Tylmarande. the tale of Neverwinter Night is end. 1/14/2009 重返MSN曾几何时,这个Space见证了我生活中的一点一滴,每一个变化,每一个进步。 但在过去的大半年里,我却一点提不起兴趣在这里留下自己的痕迹,其中固然有学习生活的繁忙,但自己心里知道,惰性和不知从何而起的失落感才是自我封闭的罪魁祸首。
突然想起半年前对自己的一句话,人生的目标没有终点。充实的人生是从克服难关,达成自己一个又一个夙愿的土壤中吸取养分的。
人生总有失落和迷茫,这是必然的。但我希望我总能在片刻的滞留之后找到新的曙光。
有时候,一个新的态度和生活方式能给人带来意想不到的收获。
It's time to scrumb away the layer of confusion and contradiction.
J 11/6/2008 A couple of hundred metres away from the newly elected president.Yesterday is the election day. The finally speech that Obama made happened in Grand park, which is only 10 mins by bus from our business school. I consider myself one of the luckiest to testify this historical moment, being in the heart of the city where Mr. Obama started out from nothing to the president of USA.
I can't make many comments since I'm watching him in a perspective of a foreigner, but as I stand there and listen to his speech, I can feel the heat from the crowd, the atomsphere and those magnificant buildings standing around waving towards me -- he is meant to be a leader.
I really hope some of my dearest friends can be there with me, as the old saying goes, joy is nothing without sharing...
Good luck to you all! 10/30/2008 分享--次贷危机的原理与始末--不懂的看笑话,懂的看内在原理论述.卖猪男与少妇----哈佛MBA经典案例(次贷危机)一男赶集卖猪,天黑遇雨,二十头猪未卖成,到一农家借宿。 少妇说:家里只一人不便。 男:求你了大妹子,给猪一头。 女:好吧,但家只有一床。 男:我也到床上睡,再给猪一头。 女:同意。 半夜男与女商量,我到你上面睡,女不肯。 男:给猪两头。 女允,要求上去不能动。 少顷,男忍不住,央求动一下,女不肯。 男:动一下给猪两头。女同意。 男动了八次停下,女问为何不动? 男说猪没了。 女小声说:要不我给你猪…… 天亮后,男吹着口哨赶30头(含少妇家的10头)猪赶集去了…… 哈佛导师评论:要发现用户潜在需求,前期必须引导,培养用户需求,因此产生的投 入是符合发展规律的。 (加强篇) 另一男得知此事,决意如法炮制,遂赶集卖猪,天黑遇雨,二十头猪未卖成,到一农 家借宿 少妇说:家里只一人不便。 男:求你了大妹子,给猪一头 女:好吧,但家只有一床。 男:我也到床上睡,再给猪一头。 女:同意。 半夜男商女,我到你上面睡,女不肯。 男:给猪两头。 女允,要求上去不能动。 少顷,男忍不住,央求动一下,女不肯。 男:动一下给猪两头。女同意。 男动了七次停下,女问为何不动? 男说:完事了~~~女:...... 天亮后,男低著头赶2头猪赶集去了...... 哈佛导师评论:要结合企业自身规模进行谨慎投资,谨防资金链断裂问题 又一男得知此事,决意如法炮制兼吸取教训,遂先用一头猪去换一粒伟哥,事必,天 亮后,男吹着口哨赶38头(含少妇家的18头)猪赶集去了…… 哈佛导师评论:企业如果获得金融资本的帮助,自身经营能力将得到倍增。 知道此法男多,伟哥供不应求,逐渐要2头,3头猪换一粒伟哥。 哈佛导师评论:这就是通货膨胀。 s当猪价格涨到16粒一棵的时候,哈佛导师评论:该 男已经进入边际成本,除了拥有对自身能力的自信和未来良好愿望以外,实际现猪流已 经为零。 但换猪男越来越多,卖伟哥的决定,扩展生产能力,推出一种次级伟哥,如果你缺一 头猪,只要你承诺可以到该女房中一夜,就可以先借,事成后补交猪款,这个方法大大 促进了伟哥销售。 哈佛导师评论:这就是贷款,让企业可以根据未来的收益选择借支流动资金 伟哥专卖店后来在即使你一头猪都没有,只要你承诺可以到该女房中一夜,就可以先 借,事成后补交猪款。 哈佛导师评论:这就是金融创新,让现在的人花未来的钱,反正等你老了未来的钱你 也花不动。 消息一出,换猪男越来越多,有人找伟哥专卖店,这个项目太好了,我们把它变成优 质基金,对外销售债券,你们也就可以分享我的收益,如何? 结果伟哥专卖店觉得甚好,于是该公司把换猪男分三类,一类是拿现猪换的,一类是 一部分现猪贷的,一类是完全没有现猪借的,发行三种债券。大家踊跃而上。纷纷购买 伟哥专卖店的债券,伟哥专卖店生意太好,就把债券销售外包给另外一家公司运作,该 公司也一并大发其财,公司越做越大,甚至可以脱离实际伟哥销售情况来发行,给自己 和伟哥专卖店带来巨大的现金收益。 哈佛导师评论:这就是专业的人做专业的事,从实体经营到资本运作,经济进入了更 高的层次。 s为了防止自己债券未来有损失,该公司决定给它买上保险,这样债券销售 就更容易, 因为一旦债券出现问题,还可以获得保险公司的赔付,哇,债券公司销售 这下子太好了,保险公司也获得巨大平白无故的保险收入。 哈佛导师评论:这就是风险对冲,策略联盟,提高了企业的抗风险能力,也保护了消 费者利益。 换猪男太多,排长队等待,该女无法承受,说老娘不干了,我搬家,一时间有无数拥 有伟哥的欠猪男。 哈佛导师评论:这是个别现象,属于市场的正常波动,不会影响整个经济。 结果该女迟迟不肯搬回。一部分欠猪男没有收入,只好赖帐,结果大量债券到期无法 换现猪吃,债券公司一看,一粒伟哥16头猪,这哪里还得起,宣布倒闭 哈佛导师评论:这是次贷危机,不会影响整个金融行业。 哪里晓得债券公司还把债券上了保险,保险公司一看,这哪里赔得起,于是也宣布要 倒闭。 哈佛导师评论:这是金融危机,还不会影响整个实体经济。 9/26/2008 One huge break through!Today, during my mid-term exam of Mathematic with finanical application class, I finally figured out which area to specialized in!
--Financial Engineering + Financial Programming, Da~Da!
Care to make some comment?
All the best! 9/21/2008 One the last updates...Hi, guys, what's up? How's everything going? Well, it has been a long time and I hope everybody is getting to miss me (hahaha)...
Anyway, just want to say that you guys are the best! Take care of yourself!
Chau~ 8/18/2008 Things I've never done or seen before last week.First, I found myself was low on socks due to too much walking, fortunely I brought needles. So I sew my broken socks back to new, hahaha...
Second, I attended an Air Show on the Chicago beach yesterday, this is the first time I saw F-22/B-2/F-16 in person. Good show, I must say.
The last be not the least, I found a iraqi coin in my new apartment, wow, the surprises were overwhelming...
I felt close to my friends though the fact is that I'm hundreds of miles away from them, I never felt lonely.
Best regards to Angie, Chai, Showee, and Emmy. 7/4/2008 That nowhere is of safety renders me peace.It has been said...
At the end of all things... We'll find a new beginning...
But this shadow once again crosses our world...
The stench of terror drifts on a bitter wind...
The people pray for strength and guidance;
they should pray for the mercy of a swift death.
For I've seen where the darkness hides! 6/24/2008 An Improvised PhaseThe invisibility of happyness can only be penetrated through the glass of agony.
Hope one day what I say can worth something and bring some good. 6/9/2008 A list of dying wishes.Sometimes we wonder how fragile one's relationship with another person can be even when blood is involved.
But when the moment has come and you chose to seize it, you may find all that is standing in the way is your unwillingness, well, in my case I call it stupidity.
In time, I started to find that people incline to handle their emotional life with ration, which in this case is nothing more than intoxicating yourself with excuses. Maybe sometimes candor, as harmful as it seems to be, can heal things in a mysterious way.
And then, my friend, we might be able to witness something majestic in our "not so plain" life...
P.S. In reality, even a hauntingly beautiful face has something imperfect hiding beneath, but when people care about the fact that you are accepting their shortcomings and have once a while shown gratitude for it, they are no less than perfect to you. 6/7/2008 New hobby? Old habit?Suddenly found that I have a thing for Italian food. No matter it's a sip of wine after a dish of hot, golden spaghetti, or washing a lovely piece of pizza down with beer, I can find myself enjoying Italian food under every circumstances...
Maybe I loved the food all along...but how can this be?
Well, I don't really care, since so far the hobby brought me nothing but joy and peace^_^
Right, it's gonna be the Gragon Boat day soon. So, good appetite, everyone!
Enjoy your favorite food, whatever that is.^_^ 6/1/2008 A hell of night with porker and gossip.Last night is an excellent example of how exciting life can turn out to be. One minute we're saying goodbye to each other and expecting to call it a night, the next minute an inadvertent idea of switching the "battle field" resulted in the making of the night of legend.
Interesting topics poped out, great friends made, never thought having fun is this easy.
Beer, porker and potato chips, cheers and laughing became the theme.
Time always gets slippery when people are having fun.
Ho~ right, the banana milk shake, another bloody brilliant idea...
Special thanks to: The host and lady of the night C, the god-send organizer S whose idea turned a gathering into a party, the condiment and final ingredient of excitement A. May your futures bring all of you the realization of your dreams!
Let's party up! Cheers! 5/21/2008 Citation of US's reponses towards CNN's ReportIt's incredibly unreal to see that these people are not complaining, and are just focusing on the relief effort. With 1.3 billion people like this, able to grind out the toughest and most grim situations, no wonder they will be the next super power. Can you even find 1.3 billion people like this anywhere outside of that country?
No looting. No complaining. Just people helping people in times of devastation. That's unheard of around here.
Imagine how the people of California will be acting after the "BIG" one hits. As in New Orleans, they will all blame the government and expect the rest of us to pay the price. Of course, the people of New Orleans WERE warned, and ignored the warnings.....we will all continue to pay the price for many years to come.
After all the bad attention China has been getting recently, I am so proud to watch as they band together to help others. China should be an example to the Myanmar government. These people are showing that, when it comes down to it, material possessions and money are nothing compared to human life.
That is absolutely amazing that the man who lost his parents, wife, AND two children can function....i can understand how he can.....and he is helping the reporters..telling the story...God Bless that man..this is such a horendous tragedy...and my prayers are with the Chinese pepole through this.
It shows drastic change in the way that Chinese government handles natural disasters. When the quake in Tangshen happened in 1976 which killed approx 250,000 people, the Chinese government blocked the news and refused for any aids from outside world. Today, the government immediately sends in soldiers and paramilitary police to rescue people and asks for international help. The prime minister Wen Jia-Bao and other local officials do not hide their high emotion toward the sufferings of the people. The Chinese government may still not be perfect under different circustances, but it should be given proper credit for trying their best to do the right things. The world should try their part to be more understanding of today's China that has traveled down a long and difficult path.
Thanks for the report. I hope people will eventually understand that reliable earthquake prediction is not technically possible. 5/9/2008 晒伤了,恢复中。一点思考。删了近两年的日志,以前写的东西又重新出现在眼前....
居然有点怀念大学简单而又充实的生活,那时候没有啥忧虑,傻傻地做着自己的英文和数学练习题~
最近听了很多别人对自己的夸奖和批评,渐渐开始担心我可能会对将来的那个我感到失望...
虽然我还是确信我走的路是正确的,但要成为一个优秀的人需要的不仅仅是自己正确的决定,还有将来会遇到的人和事情所能给予我的磨炼。
思考问题逐渐带有依赖性,这可不是好兆头,特别在我马上就要踏上独立生活之旅的时候。
不过还好,已经意识到这个问题。
也又一次明白了,我现在要干什么、要成为什么人。原来就算在正确的道路上,有时也会迷茫,并忘记自己的目的和人生哲学,这就需要时不时的提醒。虽然这样让我吃了不少苦头,但一直觉得是好事,是一次宝贵的经验。就是这一次次的经历让我一直坚持到现在,每当我开始迷茫、犹豫的时候,也是因为这些经历,让我认清了自己要走的路,而且不让我偏入歧途。
就因为这样,我觉得一直没有跌过什么大跟头。当然也有非常沮丧、失望的时候,但每每遇到挫折和危机,我都能很快从无意义的痛苦和失落中解脱出来,学习教训,把精力集中在解决问题和应对将来上。所以,一直觉得很感谢生活带我走过的每一处,无论是痛苦或幸福、悲伤或欢乐,总能因为丰富、精彩了我的人生阅历而化成一次次对生命的感激。
我很感谢那些在我走过来的一路上,给予我帮助、温暖和信任的朋友们,也甚至感激那些对我造成过不便,用痛苦的现实教给我宝贵人生经验的人们。因为他们不但让我意识到自己应该为成为一个更加优秀的人而不懈努力,不应该放弃任何一个锻炼自己的机会,更让我决心要为做一个能给别人带来帮助和温暖的人而努力。因为他们,我意识到虽然生活有时是残酷的,但只要心存希望、坚持不懈,人生的温暖和感动就永远不会消失,世界也会因此变得更加美好。
所以我想在这里衷心地对生活说一声:谢谢!
|
|
|