[R] Function for MFE and MSFE

2009-12-06 Thread tobiasfa

Hello,

Is there a function that calculates MFE(Mean Forecast Error) and MSFE(Mean
Square Forecast Error) in R?
Cant find anything!

Thanks Tobias
-- 
View this message in context: 
http://n4.nabble.com/Function-for-MFE-and-MSFE-tp950368p950368.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Need help with for loop in forecast

2009-11-30 Thread tobiasfa

Hi

I have a ts from 1980:1 trough 2009:9 with a frequency of 12. I want to make
25 6 month forecast where the first 6 month forecast is between 2007:4 -
2007:9 and the last 2009:4 - 2009:9.

My script:

Forecast - list()
for (i in 1:25){
j - i + 326
Data - window(omxr, end = time(omxr)[j])
Result - ets(Data, model = MAM)
Forecast[[i]] - forecast(Result, 6)
}

#1. How can I be sure that i=1 - all data prior to 2007:4, i=2 - all data
prior to 2007:5, i=3 - all data prior to 2007:6, ... 

#2. How do I only get the mean(point forecast) of every forecast? Now I get
Point ForecastLo 80Hi 80 Lo 95Hi 95

#3. How can I put all 25 forecasts in a ts or matrix? I´ve tried the
following:
Forecast - ts(matrix(NA, nrow = 6, ncol = 25))
Forecast - ts(matrix(NA, nrow = 25, ncol = 6)) 
Forecast - ts(matrix())
Forecast - ts()
Forecast - just about everything


Any help will be very appreciated!

Regards Tobias
-- 
View this message in context: 
http://n4.nabble.com/Need-help-with-for-loop-in-forecast-tp931580p931580.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Subscript out of bounds

2009-11-24 Thread tobiasfa

Hi!

Trying to make a forecast, and get the following error message:

Error in NextMethod([-) : subscript out of bounds

The script is as follows:

 Forecast.A - ts(matrix(NA, nrow=25, ncol = 1,
+ dimnames = list(c(), c(Outcome))),
+ start = c(2006, 10), frequency = 12)
 for (i in 1:25) {
+ j - i + 321
+ Data - window(omxr, end = time(omxr)[j])
+ Result - ets(Data, model = MAM)
+ Forecast1 - forecast(Result, 1)
+ Forecast.A[i, 2] - window(omxr, start = time(omxr)[j +
+ 1], end = time(omxr)[j + 1])[[1]]
+ }

What am I doing wrong?

//Tobias
-- 
View this message in context: 
http://old.nabble.com/Subscript-out-of-bounds-tp26499901p26499901.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] test for causality

2009-11-16 Thread tobiasfa

Hi useRs..

I cant figure out how to test for causality using causality() in vars
package

I have two datasets (A, B) and i want to test if A (Granger)cause B.
How do I write the script? I dont understand ?causality. How do I get x to
contain A and B. Further using the command VAR() to specify x, I dont
either understand.

Kind regards Tobias

-- 
View this message in context: 
http://old.nabble.com/test-for-causality-tp26373931p26373931.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Trouble retrieving data (.xls) from folder on my computer.

2009-10-29 Thread tobiasfa

Using gdata on windows and im having trouble to retrieve an excel file from a
folder on my computer.

This is my dummy:
R  download.file(http://people.su.se/~lundh/data/cpi_kpix.rda;,
+ cpi_kpix.rda)

R  URL - http://people.su.se/;
R  PATH - ~lundh/data/
R  FILE - cpi_kpix.rda
R  download.file(paste(URL,PATH,FILE,sep=),
+ cpi_kpix.rda)

R  library(gdata)
R  FILE - Stock_Returns_1931_2002.xls
R  stock.xls - read.xls(paste(URL, PATH, FILE, sep = ),
+ header = TRUE)[, 3:4]
Downloading...
Done.
Converting xls file to csv file... Done.
Reading csv file... Done.  

Im not suppose to download the file though its already on my computer. How
do i type in the path så R finds my .xls??

kind regards Tobias

-- 
View this message in context: 
http://www.nabble.com/Trouble-retrieving-data-%28.xls%29-from-folder-on-my-computer.-tp26113172p26113172.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


Re: [R] Trouble retrieving data (.xls) from folder on my computer.

2009-10-29 Thread tobiasfa

This is what R says:

 xls - read.xls(file.choose())
Converting xls file to csv file... Error in system(cmd, intern = !verbose) :
perl not found
Error in file.exists(tfn) : invalid 'file' argument
 xls - read.xls(file.choose(), perl=C:/perl/bin/perl.exe)
Converting xls file to csv file... Error in system(cmd, intern = !verbose) :
perl not found
Error in file.exists(tfn) : invalid 'file' argument

(I have installed Perl!) 


Gabor Grothendieck wrote:
 
 If its already on your computer try one of these:
 
 xls - read.xls(myfile.xls)   # if its in current directory
 
 xls - read.xls(/path/to/myfile.xls)   # to specify path
 
 xls - read.xls(file.choose())   # use explorer style interface to choose
 
 
 
 
 On Thu, Oct 29, 2009 at 9:36 AM, tobiasfa tobias.farnly...@gmail.com
 wrote:

 Using gdata on windows and im having trouble to retrieve an excel file
 from a
 folder on my computer.

 This is my dummy:
 R  download.file(http://people.su.se/~lundh/data/cpi_kpix.rda;,
 + cpi_kpix.rda)

 R  URL - http://people.su.se/;
 R  PATH - ~lundh/data/
 R  FILE - cpi_kpix.rda
 R  download.file(paste(URL,PATH,FILE,sep=),
 + cpi_kpix.rda)

 R  library(gdata)
 R  FILE - Stock_Returns_1931_2002.xls
 R  stock.xls - read.xls(paste(URL, PATH, FILE, sep = ),
 + header = TRUE)[, 3:4]
 Downloading...
 Done.
 Converting xls file to csv file... Done.
 Reading csv file... Done.

 Im not suppose to download the file though its already on my computer.
 How
 do i type in the path så R finds my .xls??

 kind regards Tobias

 --
 View this message in context:
 http://www.nabble.com/Trouble-retrieving-data-%28.xls%29-from-folder-on-my-computer.-tp26113172p26113172.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org 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@r-project.org 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Trouble-retrieving-data-%28.xls%29-from-folder-on-my-computer.-tp26113172p26115725.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


Re: [R] Trouble retrieving data (.xls) from folder on my computer.

2009-10-29 Thread tobiasfa

How do i make sure perl is in my PATH, and if its not how do i put it there?



Either make sure that perl is on your PATH or if the path/filename you
specified is correct then try with backslashes just in case:

C:\\perl\\bin\\perl.exe

Also check the upper/lower case of each component of your path just in case.
-- 
View this message in context: 
http://www.nabble.com/Trouble-retrieving-data-%28.xls%29-from-folder-on-my-computer.-tp26113172p26120777.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.