[R] Help for i-else iwth more than one alternative

moeby fabian_schlegel at hotmail.com
Thu Oct 16 17:51:47 CEST 2014


I try to run an if-else command line where the else argument should be the
corresponding value of the pmax command.

#####################
#opt.fc is the optimal forecast
#rmax is the vector of the maximized r squared from pmax-command of 2 data
sets containing r squares 
#fc1 are the estimates of a specific forecast model (e.g. AR1)
#fc are the estimates of a specific forecast model, namely the Benchmark
(e.g. mean)

opt.fc <- as.numeric(373) #data length is 373
for (x in 1:373)
{
if (rmax[x] < 0.1)
opt.fc[x] <- fc[x] #if rmax smaller than the value 0.1 the forecast of the
benchmark should be used.
else
opt.fc[x] <- fc1[x] #else the forecast of fc model should be used.
}
So far, so easy.

How can I compute the opt.fc when I have more than one alternative forecast
model, let's say fc2 and fc3. 
In Addition, I want to use the values from the forecast model where the
values of the corresponding r squared are maxed (pmax(fcr1,fcr2,fcr3...)
..... :(

any ideas?
 
Thank you very much in advance.
 
 		 	   		  



--
View this message in context: http://r.789695.n4.nabble.com/Help-for-i-else-iwth-more-than-one-alternative-tp4698410.html
Sent from the R help mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]



More information about the R-help mailing list