Hi,
I want to optimize the root mean square error objective function using the
optim function. Thus the function will look like sqrt(sum((yi - f(xi))^2)/n).
Now the f(xi) is the Arima function. I am not clear how do I get the f(xi)
because the call to arima function in C gives the value of th
Thanks Charles. I will have to extract the min value from the list A by
selecting the proper index.
From: Charles Determan Jr [deter...@umn.edu]
Sent: Wednesday, November 19, 2014 11:48 PM
To: Amit Thombre
Cc: r-help@r-project.org
Subject: Re: [R] Using sapply
_
From: Charles Determan Jr [deter...@umn.edu]
Sent: Wednesday, November 19, 2014 10:04 PM
To: Amit Thombre
Cc: r-help@r-project.org
Subject: Re: [R] Using sapply instead of for loop
The following provides array A with 3.212016 as the last value. The error
values are indeed in the array here.
on the max value set the , stores the error value.array size
for (i in 1:pmax)
{
for (j in 1:dmax)
{
for (k in 1:qmax)
{
for (l in 1:Pmax)
{
for (m in 1:Dmax)
{
for (n in 1:Qmax)
{
A<-sapply((1:Permax),function(p) far(p),simplify=FALSE)
}
}
}
}
} #for looping through period value
}
=function(e)
{
return(NA)
}
)
cat("Value of error", er[i,j,k,l,m,n,p])
cat("Value of i,j,k,l,m,n,p", i, j, k, l, m, n,p)
}
From: Charles Determan Jr [deter...@umn.edu]
Sent: Wednesday, November 19, 2014 7:05 PM
To: Amit Thombr
)
{
for (k in 1:qmax)
{
for (l in 1:Pmax)
{
for (m in 1:Dmax)
{
for (n in 1:Qmax)
{
A<-sapply((1:Permax),function(p) far(p),simplify=FALSE)
}
}
}
}
} #for looping through period value
}
From: Charles Determan Jr [deter...@umn.edu]
Sent: Wednesday, November 19,
I am trying to replace a for loop by using sapply, The code is for forecasting
using arima. The code is as follows:-
---
far<-function(p)
{
cat("does it come here value of p", p)
tryCatch({
air.model <-Arima(tsa,order=c(i-1,j-1,k-1),
seasonal=l
7 matches
Mail list logo