[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-finance
Subject:    [R-SIG-Finance] =?euc-kr?q?Example_code_for_nonparametric_estimat?=
From:       =?EUC-KR?B?sei788iv?=<skim3 () naver ! com>
Date:       2010-08-20 17:43:13
Message-ID: 3e35c62a93e79796acb00748bc2cbfab () tweb12-2 ! nm
[Download RAW message or body]

OK! Here are some codes to help you understand my previous questions:
 
library(mgcv)
library(tseries)
 
# download some test data from YAHOO
spc &lt;- get.hist.quote(instrument = "^gspc", start = "2000-01-01", quote = "Close")
ibm &lt;- get.hist.quote(instrument = "ibm", start = "2000-01-01", quote = "AdjClose")
t30 &lt;- get.hist.quote(instrument = "^TYX", start = "2000-01-01", quote = "Close") 
 
RM &lt;- (diff(log(spc)) - t30 / 365)*100.0 # let's say this is excess market return
R_IBM &lt;- (diff(log(ibm)) - t30 / 365)*100.0 # individual stock's excess return
t &lt;- 1:length(RM) # time trend
 
output &lt;- gam(R_IBM ~ RM + s(t, by=RM)) # the code in the paper
plot(output, rug=F, ylab="Time-Varying Beta") # beta looks two low 
 
output &lt;- gam(R_IBM ~ s(t, by=RM))
plot(output, rug=F, ylab="Time-Varying Beta") 
# now reasonable but I want time-axis like 2000 2001 ... 2010
 
Any help would be appreciated!

	[[alternative HTML version deleted]]

_______________________________________________
R-SIG-Finance@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic