A more elegant way to do this is
standard - sapply(calm, function(calmi){calmi / sqrt(emaTA(calmi ^ 2,
0.03))})
Cheers,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
[EMAIL PROTECTED]
www.inbo.be
Do not put your faith in what statistics say until you have carefully
considered what they do not say. ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney
-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens john seers (IFR)
Verzonden: woensdag 4 juli 2007 15:19
Aan: livia; r-help@stat.math.ethz.ch
Onderwerp: Re: [R] Loop and cbind
Hi
In what way does it not work?
My guess is that you have not declared your values outside
the for loop.
As they are local they will be lost on exit.
You need to declare them before:
ewma-vector(length=12)
standard-vector(length=12)
for ... {
}
John Seers
---
Hi, I would like to apply the following function for i
between 1 and 12, and then construct a list of the return series.
for (i in 1:12){
ewma[i] - emaTA(calm[[i]]^2,0.03)
standard[i]- calm[[i]]/sqrt(ewma[i])
standard - cbind(standard[i])
}
But it does not work. Could anyone give me some advice how
can I achieve this? Many thanks
--
View this message in context:
http://www.nabble.com/Loop-and-cbind-tf4024291.html#a11430500
Sent from the R help mailing list archive at Nabble.com.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.