RE: [R] blockwise sums

2004-08-31 Thread Pfaff, Bernhard
> 
> Liaw, Andy wrote:
> > If you insist, here's one way:
> > 
> > my.blockwisesum <- function(x, n, ...) {
> > tapply(x, seq(1, length(x), by=n), sum, ...)
> > }
> > 
> 
>   Did you test that? I get:
> 
>  > my.blockwisesum(1:10, 3)
> Error in tapply(x, seq(1, length(x), by = n), sum, ...) :
>  arguments must have same length
> 
> 
>   Here's my solution with tapply and rep() to generate a vector like 
> c(1,1,1,2,2,2,3,3,3,4):
> 
> baz.blockwisesum=
>   
> function(v,n){tapply(v,rep(1:(1+length(v)/n),each=n)[1:length(
> v)],sum)}
> 
>  > baz.blockwisesum(1:10,3)
>   1  2  3  4
>   6 15 24 10
> 
>   - just ignore the 1 to 4 names, they cant hurt you.
> 
> Baz

To complete the picture: here is another one:

my.blockwisesum <- function(vec, n){
  vec <- as.vector(vec)
  n <- as.integer(n)
  total <- length(vec)
  if(total <= n){
stop("\nn should be smaller than length of vector.\n")
  }
  start <- seq(1, total, n)
  end <- start + n - 1
  end[end > total] <- max(start)
  index <- 1 : length(start)
  return(sapply(index, function(x)sum(test[start[x]:end[x]])))
}

> test <- 1:150
> ptn <- proc.time()
> baz.blockwisesum(test,3)
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19
20 
  6  15  24  33  42  51  60  69  78  87  96 105 114 123 132 141 150 159 168
177 
 21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39
40 
186 195 204 213 222 231 240 249 258 267 276 285 294 303 312 321 330 339 348
357 
 41  42  43  44  45  46  47  48  49  50 
366 375 384 393 402 411 420 429 438 447 
> proc.time()-ptn
[1] 0.00 0.00 0.22   NA   NA
> 
> ptn <- proc.time()
> my.blockwisesum(test,3)
 [1]   6  15  24  33  42  51  60  69  78  87  96 105 114 123 132 141 150 159
168
[20] 177 186 195 204 213 222 231 240 249 258 267 276 285 294 303 312 321 330
339
[39] 348 357 366 375 384 393 402 411 420 429 438 447
> proc.time()-ptn
[1] 0.00 0.00 0.19   NA   NA
> 

HTH,
Bernhard



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] pdf device --- axes labels text disappeared?

2004-10-15 Thread Pfaff, Bernhard
> Dear R Wizards:  Running R 1.9.1. on amd64.
> 
> 
> Promise<- c(0,20,40); Expect<- c(0, 20, 0.2*20+.8*40 );
> 
> # this omits printing numbers on the axes labels.
> pdf(file = "bug.pdf" );
> plot(Promise, Expect, type="b", ylim=c(0,60));
> dev.off();
> 
> # this works
> postscript(file = "bug.eps" );
> plot(Promise, Expect, type="b", ylim=c(0,60));
> dev.off();
> 

Dear Ivo,

although I do not want to consider myself as an R wizard, but rather a
helpful soul and because you have provided R-code suited for direct
execution as it should be :-), here is my answer:

in both devices the numbers are printed below the axes. This is on:

platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor0.0
year 2004   
month10 
day  04 
language R  


HTH,
Bernhard

ps: Could the problem be related to your pdf encodings?
> 
> apologies if this has already been noted elsewhere---I looked but did 
> not find it.  (probably googled for the wrong terms, if so.)  is this 
> my bug, or R's bug or my R installation bug?  help appreciated.
> 
> /iaw
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Plotting large texts into pdf file

2004-09-28 Thread Pfaff, Bernhard
> 
> Is there an easy way to include larger amounts of text in a plot?
> I need to include a text report in a pdf file that is automtically
> created by a R script.
> 
> I open a pdf device, then create several plots which are nicely output
> each on a page in
> the resulting pdf file, then I want to append page(s) that 
> contain only
> text.
> 
> The best I came up with is the following:
> 
> # create a new page
> frame()
> # setup some dummy coordinate system
> plot.window(c(0,10),c(0,10))
> # read the report as whole file (vector of lines)
> f <- readLines(filename)
> # concatenate the first 50 lines into on string with lines 
> separated by
> \n newline
> t <- paste(f[1:50], collapse="\n")
> # output text
> text(0, 5, t, pos=4, cex=0.8, xpd=NA)
> 
> The problem is that the text is always centered in some way 
> (with pos =
> 4 vertically,
> and I cant easily put it into several pages.
> 
> Is there an easier way to do this that I overlooked?
> 
> For automation reasons I would like to have R output the text directly
> into the pdf.


Have you considered Sweave()? There is also a nice and well written tutorial
by Friedrich Leisch in R News:
 
Friedrich Leisch. Sweave, part I: Mixing R and LATEX. R News, 2(3):28-31,
December 2002
Friedrich Leisch. Sweave, part II: Package vignettes. R News, 3(2):21-24,
October 2003

as well as the referenced URLs within this tutorial.

HTH,
Bernhard

> 
> Thanks in advance
> 
> Michael
> 
> 
> **
> Der Inhalt dieser E-Mail ist vertraulich und ausschliesslich 
> fuer den bezeichneten Adressaten bestimmt. Wenn Sie nicht der 
> vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein 
> sollten, so beachten Sie bitte, dass jede Form der 
> Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder 
> Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir 
> bitten Sie, sich in diesem Fall mit dem Absender der E-Mail 
> in Verbindung zu setzen.
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: libraries and references (was `[R] Vector and String')

2004-10-22 Thread Pfaff, Bernhard
> > I'm looking for a procedure to detect trend changes or 
> significant signals 
> > in time series as in the attached example.

Dear Marc,

it seems that your example have been removed, as stated in the posting
guide. Hence, I can only guess what your problem is and offer:

help.search("Goldfeld")
help.search("Chow")
help.search("structural change")

May be you can provide your example directly in a mail?

HTH,
Bernhard

> > 
> > Could you point me to a library or reference I can start with?
> 
> Two good references are the R posting guide at
> http://www.r-project.org/posting-guide.html and the R FAQ at
> http://cran.r-project.org/doc/FAQ/R-FAQ.html which lists some very
> relevant R >packages< (and which the posting guide asks you 
> to consult).
> Please do start with those.
> 
> There are lots of good libraries in the world, but you need 
> to visit one 
> which will admit you.  They will probably insist that you 
> read their usage 
> conditions first.  So does this list.
> 
> -- 
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] lag variable addition to data frame question

2004-10-29 Thread Pfaff, Bernhard
Hello Sri,

how about embed() in stats?
Citing from the doc's detail section:

"Each row of the resulting matrix consists of sequences 'x[t]',
 'x[t-1]', ..., 'x[t-dimension+1]', where 't' is the original index
 of 'x'. If 'x' is a matrix, i.e., 'x' contains more than one
 variable, then 'x[t]' consists of the 't'th observation on each
 variable.", 

and have a look at the example's output:

embed> x <- 1:10
embed> embed(x, 3)
 [,1] [,2] [,3]
[1,]321
[2,]432
[3,]543
[4,]654
[5,]765
[6,]876
[7,]987
[8,]   1098

does this fit your definition of 'lag'? Please note, that the 'starting
values' are skipped, i.e. no NAs are inserted. 

HTH,
Bernhard

ps: Have a look at the function body, too.
> 
> ?diff
> 
> --Matt
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of s viswanath
> Sent: Friday, October 29, 2004 7:22 AM
> To: [EMAIL PROTECTED]
> Subject: [R] lag variable addition to data frame question
> 
> 
> Hi,
> 
> I was wondering if there is a more efficient way of handling 
> the following
> method of creating a lagged value in a data frame without using the
> recursive 
> 'for(i in 1:n)' loop and without using as.ts
> 
> #Steps to creating a lag variable in a data frame 'my.dat.fr'
> # with 275 columns, 2400 rows of numbers and factors . The 
> #variable x is a
> factor of #with five different levels
> the way i am creating the variable now is:
> 
> attach(my.dat.fr)
> #my.dat.fr contains a variable 'x', i want to create #lagged 
> variables #of
> this without using as.ts(). Is #there a more effient way of doing this
> than#below and #without using a recursive loop  such as 
> #for( i in 1:obs)x.lag[i]= x[(i-1)]
> 
> 1.here is the way i am doing the lag now
> x=c(3,2,3,2,1,1,1,2,1,2,1,3...1)
> 
> obs=length(x)
> 
> x.nolag=x[2:obs]
> x.lag1=x[1:(obs-1)]
> 
> my.new=cbind(x.nolag,x.lag1)
> 
> #since my data frame must line up my orginal x values to 
> other columns I
> also # add the following
> 
> 
> x.fill= cbind(0,0)
> # as named the above cell lines up my factor to other factors 
> in my data
> frame, #since I had chopped off the first x observation to 
> create x above
> (ie x[2:obs]) #then finally
> 
> my.dat.fr=rbind(x.fill, my.new)
> my.dat.fr
> 
> #Is there a easier way to create a lag variable and install in my data
> frame?
> #thankyou in advance, Sri
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] R "sumo" package suggestion

2004-11-12 Thread Pfaff, Bernhard
Dear list member,

sorry, for jumping in this thread and/or the gun. 
What springs immediately to my mind is: if such a functionality should be
realised, it might be beneficial too to have something similar to Thomas
Ruedas `texdocTK' at hand; i.e. the retrieval of the pdf-package
documentations sorted by category and of course the manuals that are shipped
with a base installation. Well, but one after the other...

Best Regards,
Bernhard

> Hello,
> >
> > I think Achim suggestion is more realistic: it does not 
> imply automatic
> > installation of all packages, but just a restricted list of packages
> > available on CRAN about a specific topic.
> >
> > An easy way to get this result is to propose separate lists of  
> > packages. It
> > means separate lists than
> > http://cran.r-project.org/src/contrib/PACKAGES.html (and 
> 'PACKAGES' in  
> > the
> > Windows packages binaries). I don't see the problem to 
> propose other  
> > lists
> > that could be called 'SpatialStats.html' (in packages
> > sources)/'SpatialStats' (in Windows binaries)... and the same for
> > 'MachineLearning', 'Biostats', etc...
> >
> > Then, of course the various functions that install packages 
> should be
> > adapted to use these lists. It does not look like an unsurmontable  
> > task.
> >
> > Of course, if this is not done yet by the R Core Team, I 
> presume that  
> > there
> > must be difficulties that I don't see. It is obvious that, 
> either we  
> > need a
> > list maintainer for each topic, or we have to propose keywords for  
> > packages
> > (similar to the keywords for functions) that will be used to  
> > automatically
> > generate those separate lists.
> >
> > An alternative that can currently be used for groups of users in an
> > institution is to maintain a local copy of R packages 
> repository, which
> > contains only the packages of interest for this group. I do 
> so for my
> > students. Under Windows, in the new R 2.0.1 beta, there is 
> a new menu  
> > entry
> > in packages -> Set CRAN mirror... (in my version it does 
> not work yet,
> > looking for a missing .\doc\CRAN_mirrors.csv file), but I 
> can easily  
> > figure
> > out how it works and how I could append my own repository 
> to the list  
> > to
> > ease installation of a restricted list of R packages by my 
> students.  
> > This is
> > only for Windows, but a similar approach can also be used on other  
> > platforms
> > with a little bit of coding.
> >
> > Best,
> >
> > Philippe
> >
> > ..<°}))><
> >  ) ) ) ) )
> > ( ( ( ( (Prof. Philippe Grosjean
> >  ) ) ) ) )
> > ( ( ( ( (Numerical Ecology of Aquatic Systems
> >  ) ) ) ) )   Mons-Hainaut University, Pentagone
> > ( ( ( ( (Academie Universitaire Wallonie-Bruxelles
> >  ) ) ) ) )   6, av du Champ de Mars, 7000 Mons, Belgium
> > ( ( ( ( (
> >  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.33.12
> > ( ( ( ( (email: [EMAIL PROTECTED]
> >  ) ) ) ) )
> > ( ( ( ( (web:   http://www.umh.ac.be/~econum
> >  ) ) ) ) )
> > ..
> >
> >
> >> -Original Message-
> >> From: [EMAIL PROTECTED]
> >> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Achim Zeileis
> >> Sent: Thursday, November 11, 2004 10:21 PM
> >> To: Liaw, Andy
> >> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> >> Subject: Re: [R] R "sumo" package suggestion
> >>
> >> On Thu, 11 Nov 2004 15:59:09 -0500 Liaw, Andy wrote:
> >>
> >>> Good idea, IMHO, but there are some practical difficulties:
> >>>
> >>> I guess the XEmacs packages are (most, if not all) pure 
> elisp code,
> >>> and do not need other stuff to work.  However, quite a few CRAN
> >>> packages depend on external libraries or programs, and do not
> >>> necessarily work on all platforms that R runs on.  How would such
> >>> dependencies be resolved in such a kitchen sink bundle?
> >>>
> >>> I have a somewhat related idea:  Start labelling packages
> >> with a set
> >>> of pre-defined categories, and a package can be labelled with more
> >>> than one categories (especially those *misc type packages).  It is
> >>> then possible to have facility to let people install all
> >> packages that
> >>> fall in a particular category (e.g., `spatial statistics').
> >>  I believe
> >>> several systems have such facilities, Debian being one of them,
> >>> TeXLive being another.
> >>
> >> This is similar to idea that has been discussed from time to
> >> time for several years now: it would be nice to have
> >> maintained "CRAN task views"
> >> (or something like that), i.e., we could have a maintainer
> >> for, say "spatial stats", another one for "machine learning",
> >> "biostats" which can of course be overlapping. Then the
> >> maintainers would have to produce some sort of list of
> >> packages (in a standardized format) with a little bit of
> >> markup such that a web page can be generated from it and that
> >> the information could be used by install.packages

RE: [R] The hidden costs of GPL software?

2004-11-19 Thread Pfaff, Bernhard
Dear list member,

this thread as well as the first one started by Philippe about the
usefulness of a GUI is interesting and overwhelming alike. IMHO, it
wittnesses the greatness and superiority of R compared to other statistical
programming environments and programs: the core team and all people involved
with it. Everyday I am flabbergasted and amazed anew; learning new concepts,
programming tricks, statistical methods I was unfamiliar with and much much
more: kudos to all of you. Let me now toss in my two cents:

First cent: Comments about a GUI
Although I use Emacs/ESS and R batch mode mostly, a GUI is beneficial in
terms of teaching statistics and/or econometrics with R. This conclusion
draws upon experience nine years back, while I was giving, beside
econometric classes, computer labs at university. At that time we had only
commercial products at hand: RATS, GAUSS and EViews. From a students
perspective EViews (menu-driven) was the most convenient one. The
econometric method comprehension and the interpretation of its application
is of utmost importance. Hence, novices should concentrate on this to
familiarise themselves with the subject. Most of the students got scared and
distracted by learning a command driven programming language too, i.e. this
was too much to swallow at one time. With other words: do not challenge
novices to statistics/econometrics programmatically. A point mentioned by
Phillipe in an earlier email too. 
Now given Rcmdr: I like its flexibility and that everybody can tailormade
his own `version' by adding new menus and functionalities. So to speak, a
very decent ground work has been provided by John Fox and I appreciate it
alot. I can only speak for myself: I am currently writing an `urca' add-in
to Rcmdr, such that the package is more amenable to novice users in a
computer lab for example; that is: they do not have to worry about the
correct syntax or what can be achieved with which function. In order to do
so, two files are needed: one is an addendum to the menu's file and the
other one contains the R functions to be executed within Rcmdr. It is at the
leisure of the instructure to include these into Rcmdr. They can be shipped
in the package's /inst directory, for example. This seems to be a feasible
approach for other package maintainers working in different fields too. Or
would such an approach be to simple?

Second cent: help system
As voiced in earlier emails in this thread the R documentation, contributed
tutorials and the likes as well as the help facilities are indeed great. The
only snag, is a lack of an `easy to find' approach to be taken. Surely there
is help.search(), apropos, help.start() etc. etc. But what would be nice,
would be something similar to `texdoctk' for LaTeX document retrieval. That
is: categorise the manuals, package manuals, vignettes and other contributed
docs with respect to the catergory they belong to. Well, the snag is: who
does this labour intensive work? Hm, I am sceptic, but it might turn out
that this is not a feasible approach to be taken, but maybe my second
suggestion is: making greater use of \concepts and/or \keyword by providing
a file for download on CRAN that contains the \concepts entries & the
function & the package in which it is contained. One could then download
this file and execute a `zgrep' on it, as could be done likewise with a
contents file from an apt repository to find out which file is contained in
which rpm. The advantage would be the decentralisation of the work. It does
not take that long when each package maintainer utilises \concepts in his
.Rd files. Once, a package is contributed to CRAN, one could scan the
tarballs and extract the relevant information into the above mentioned file.
Another advantage would be, that users would find functions of packages that
are currently not in their search path, because the packages have not been
installed. And not a few questions on this list are answered by: `This
functionality is contained in package xyz'. Anyway, I will introduce
\concepts within the next release of `urca'.

Best Regards,
Bernhard   

> 
> "Philippe Grosjean" <[EMAIL PROTECTED]> writes:
> 
> > Peter,
> > 
> > You don't need the ActiveState Tcl distribution to add 
> extensions. If you
> > compile extensions yourself (and these extensions have a compatible
> > license), then you have no problems... (well, almost! You 
> must make sure
> > those extensions compile correctly on all supproted 
> platforms). This is
> > exactly what I do in the tcltk2 package.
> > Best,
> > 
> > Philippe Grosjean 
> 
> I know, it's just that it feels silly that we cannot build on the fine
> work of ActiveState.
> 
> -- 
>O__   Peter Dalgaard Blegdamsvej 3  
>   c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
>  (*) \(*) -- University of Copenhagen   Denmark  Ph: 
> (+45) 35327918
> ~~ - ([EMAIL PROTECTED]) FAX: 
> (+45) 35327907
> 
> __
>

[R] Rcmdr -> doItAndPrint -> summary method of S4-class object not in Rcmdr window but R Console

2004-11-22 Thread Pfaff, Bernhard
Dear list member,

John Fox proposed to me posting this problem to R-Help:

I have written a function suited for Rcmdr and included this in a R-file
located in Rcmdr/etc as well as an augmented `Rcmdr-menus.txt'.

Now, I am faced with the following problem:
method show() of a S4-class object works flawlessly, that is `doItAndPrint'
works flawlessly and its output is returned correctly into the Rcmdr-Window.
However, by using method summary() for the same S4-class object fails, in
the sense that the output is *not* printed in the Rcmdr window, but into the
R Console. The summary()-method contains cat() and slots of the S4-class
objects only.

My question is: How can it be achieved that method summary() of S4 objects
is printed in the RCmdr window and why, in the first instance, does it fail
to do so by using `doItAndPrint'.

Any help or pointer is much appreciated,

Best Regards
Bernhard

platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor0.1
year 2004   
month11 
day  15 
language R  
  




The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Regression output labels

2003-06-10 Thread Pfaff, Bernhard
> Hello to all-
>   1.  When I run a regression which implements the 
> augmented Dickey-Fuller
> test, I am confused about the names given to the regressors 
> in the output.
> I understand what "xGE" stands for in a standard "lm" test 
> involving an
> independent variable GE for instance, but if I lags and or 
> differences are
> included in the model, what do the following "output" stand for:
>   "xlag(x,-1)GE"
>   "xD.GE"
>   "xD.lag(diff(x), -i)GE"
>   "xD.D.lag(diff(x), -i)GE"
>   Thanks for the clarifications -- I don't want to 
> "misspeculate" on the
> actual interpretations, here...
> 

Hello rwatkins,

I assume that you are referring to the function:
http://www.econ.uiuc.edu/~econ472/adf.R.txt


"adf"<-
function(x, L = 2, int = T, trend = T)
{
#Construct Data for Augmented Dickey Fuller Model with L lags.
#This is a modified version for R, in which the command rts was substituted
by ts.
x <- ts(x)
D <- diff(x)
if(L > 0) {
for(i in 1:L)
D <- ts.intersect(D, lag(diff(x),  - i))
}
D <- ts.intersect(lag(x, -1), D)
if(trend == T)
D <- ts.intersect(D, time(x))
y <- D[, 2]
x <- D[, -2]
if(int == T)
summary(lm(y ~ x))
else summary(lm(y ~ x - 1))
}

As you can see by the code the lagged differences of the series are produced
repetitively in the for-loop; the function argument "L" sets the maximum
number of lagged differences of the time series to be tested for unit root.
After the for-loop the one period lag of the original variable is included
to "D" as first columne. In case of a trend inclusion, this variable is
included as last columne:

xD.lag(x, -1): is the one period lag of the original series;
xD.D.D.lag(diff(x), -i): is the one period lag of the differenced series;
xD.D.lag(diff(x), -i): is the two period lag of the differenced series and
xtime(x): is the linear time trend.  

Pls. note, that you should include as many lagged differenced x series
(function argument "L") until the residuals of the test regression do not
contain any significant autocorrelations (check their acfs and/or pacfs). 
> Also...
>   2.  When an Engle-Granger test is run on multiple 
> independent variables,
> only one cointegration vector is returned.  Can one tell 
> "which vector" --
> or what two variables' relationship  -- is being identified for the R
> output.  Likewise, if I run a Johansen test, does R "tell me" 

To which function are you referring in particular?

> specifically
> which pairs of variables are cointegrated or do I just get the rank?
> 
>   Thanks to all for your time and consideration.
> 

If you apply the Engle-Granger Two-Step-procedure in case of more than two
I(1) variables and if more than one cointegration-relationship exists you
are estimating a linear combination of the latter. In case you apply a
Johansen test (rank- or trace-test) you are only testing the space of
cointegrating vectors. In order to draw inferences about the
cointegration-relationships you must test these specifically.

As a suggestion for reading and further elaboration let me allow you to hint
you to the following literature:

1)
Hamilton, James D. (1994). Time Series Analysis. Princeton N.J.: Princeton
University
Press.

2)
Engle, Robert F., and Clive W. J. Granger. (1987). Co-Integration and Error
Correction:
Representation, Estimation and Testing. Econometrica. Vol. 55, pp. 251-276.

3)
Johansen, Søren. (1991). Estimation and Hypotheses Testing of Cointegrating
Vectors
in Gaussian Vector Autoregressive Models. Econometrica. Vol. 59, pp.
1551-1580.

4)
Johansen, Søren. (1995). Likelihood-Based Inference in Cointegrated Vector
Autoregressive
Models. Oxford: Oxford University Press.

HTH,
Bernhard


> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Rcmd check problem

2003-06-23 Thread Pfaff, Bernhard
> 
> I have the following message error when I try to buid my package :
> 
> C:\Documents and Settings\Philippe>Rcmd check mypackage
> * checking for working latex ...Error: environment variable 
> TMPDIR not 
> set  (or set to unusable value) and no default available.
>  at C:\PROGRA~1\R\rw1071\share\perl/R/Utils.pm line 165



Hello Philippe,

just a guess...have you included your miktex-path as an environmental
variable in your path (see:START -> Settings -> Control Panel -> System
Properties -> Advanced -> Environment Variables) and a tempdir likewise? 

HTH,
Bernhard
> 
> Does someone have any idea ?
> 
> Thanks
> 
> OS Windows XP
> miktex
> R 1.7.1
> ActivePerle 5.8.0
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] excel files and R

2003-06-25 Thread Pfaff, Bernhard
> 
> There's a function odbcConnectExcel, a wrapper to odbcDriverConnect.
> Neither require any work with Windows menus.
> 
Try the following sample script and save it as "foo.R":

library(RODBC)
chan1 <- odbcConnectExcel("your-file.xls")
aa <- sqlFetch(chan1, "Name of your sheet")
names(aa)
close(chan1)

as batch:
Rterm --no-restore --no-save < foo.R

works for me, at least.


HTH,
Bernhard




> On Wed, 25 Jun 2003, Simon Fear wrote:
> 
> > RODBC works fine but as far as I can tell requires that the 
> connection
> > be
> > opened through Windows menus. OK for a one-off, but not for batch
> > processing.
> > Please someone tell me what I missed - how can I open the connection
> > within
> > an R script?
> > (Windows 98)(not my fault)
> > 
> > TIA
> >  (sorry for long disclaimer, can't switch it off)
> > 
> > -Original Message-
> > From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
> > Sent: 24 June 2003 17:54
> > To: Victor H. Marím
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [R] excel files and R
> > 
> > 
> > Security Warning:
> > If you are not sure an attachment is safe to open please contact 
> > Andy on x234. There are 0 attachments with this message.
> > 
> > 
> > On Tue, 24 Jun 2003, Victor H. Marím wrote:
> > 
> > > I am new at R.  My questions is rather basic.  Looking R 
> manuals looks
> > > like there should be a way to read MS excel files into R.  Could
> > > somebody tell me which library should I use for that?
> > 
> > Several ways are in the R Data Import/Export Manual (the 
> obvious manual,
> > I
> > would have thought).  If you are working on Windows, using RODBC is
> > perhaps the simplest.
> > 
> > 
> 
> -- 
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Breusch-Godfrey Test

2003-08-04 Thread Pfaff, Bernhard
> Dear R Helpers!
> 
> bgtest{lmtest} performs the Breusch-Godfrey test for higher 
> order serial 
> correlation.
> 
> Is the Higher Order Correlation function already programmed in
> R I couldn't find it?
> 
> Sergei Petrov
> 

?acf
?pacf

HTH,

Bernhard


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] how to set the variable name in a loop

2003-08-04 Thread Pfaff, Bernhard

> Hello,
> 
> I would like to have variables whose name are var1, var2, ... 
> in a loop :
> 
> for (i in 1:10)
> {
> var(i) <- i # where var(i) is var1, 
> }

how about:

for (i in 1:10){
  eval(parse(text=paste("var", i, "<-", i, sep="")))
}

HTH,
Bernhard




> 
> Thanks in advance
> 
> Philippe
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Text Vector Printing And Storage

2003-09-17 Thread Pfaff, Bernhard
how about: ?write

something like:

your.text <- c(date(), "insert name of your R object", " end ")
write(your.text, "your-text.txt", append=TRUE)

date() and " end " should help you to separate your daily changing
character vectors.

HTH,
Bernhard

> I am using R 1.7.1 on Windows, running a program on a daily 
> basis which produces a vector of text results, where the 
> length of the vector may be different each day.
> 
> While I can display this vector in the R console using a cat 
> instruction, I am presently unable to either print it out on 
> a printer (item 2.9 in the R for Windows FAQ says I need to 
> use 'File | Print' but I've failed to find any function 
> listed under that name), 

File | Print works fine for me; have you checked your printer
settings?

> or to store this vector in a 
> textfile alongside previous days' results because they are 
> not all of the same length and cannot therefore be 
> collectively handled as a matrix or dataframe.
> 
how about: ?write

something like:

your.text <- c(date(), "insert name of your R object", " end ")
write(your.text, "your-text.txt", append=TRUE)

date() and " end " should help you to separate your daily changing
character vectors.

HTH,
Bernhard


> Any help with regard to either of these problems would be 
> greatly appreciated!
> 
> Phil
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Time Series DGPs

2003-09-25 Thread Pfaff, Bernhard
>   I was wondering if anyone had some sample time series dgp 
> code.  I am 
> particularly interested in examples of autoregressive processes and 
> error correction model DGPs.  I have attached a more specific example 
> of what I mean.  I have tried myself but would hoping someone 
> had some 
> more elegant code that would help me extend my own code.
> 
Hello Luke,

your setting does not qualify exactly as an ECM (both series have to be of
the same integration order, i.e. I(1) *and* there exists a linear
combination between them, which is I(0) -- see for instance Engle/Grangers'
seminal paper).

However, you can set up a sample ECM by generating an I(1) series, construct
a linear combination to produce a second one, run a regression and save the
residuals and finally enter these lagged by one period into your ECM.
Incidentally, avoid inclusion of contemporaneous differenced Xs due to
simultaneity-bias. Something, as follows should work:

# function for producing lags
tslag <- function(x, d=1)
 {
  n <- length(x)
  c(rep(NA,d),x)[1:n]
 }
# generate a RW
x1 <- rnorm(100)
x <- cumsum(x1)
# generate artifically another I(1)-variable that is linearly dependent
y <- 0.8*x + rnorm(100)
# run ci-regression and save error (lagged one period)
ci.lm <- summary(lm(y~x))
error <- tslag(ci.lm$residuals)
# estimate ECM
y.diff <- y - tslag(y)
x.diff.l1 <- tslag(x-tslag(x))
ecm.lm <- summary(lm(y.diff~x.diff.l1+error))

HTH,
Bernhard


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Jarque-Bera Test

2003-10-21 Thread Pfaff, Bernhard
> Dear all,
>  
> i have the question about the using of Jarque-Bera Test by 
> using R. The question is that I do not have in my package 
> "ts" this test and can not obtain any information in the 
> help-file. Could you help my? Where could I download the 
> package and which one, to use the Jarque-Bera Test?

see package "tseries"


>  
> Thank You,
> Susan
> 
> 



The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] png() and/or jpeg(): line missing by using box(which="outer")

2003-10-21 Thread Pfaff, Bernhard
Dear R list,

I do encounter the following problem by generating either a png-file
(example below) or a jpeg-file: 
By employing 'box(which="outer")' a box is drawn, except for the right line.
If I generate the plot without the 'box(which="outer")', a line at the
bottom in the graphics file still appears. However, both plots are displayed
correctly in the R Graphics Device Window, i.e  with a box including the
right side or one without any lines at the outer margins of the plot. Now, I
want either a file - including the right side of box or one that has none on
all sides. 

test <- rnorm(100)
par(mar=c(6,4,6,4), oma=c(1,1,1,1))
png("test1.png")
plot(test)
grid()
box(which="outer")
box(which="plot")
dev.off()

png("test2.png")
plot(test)
grid()
box(which="plot")
dev.off()

Incidentally, both functions are calling .Internal(devga()). I have not
encountered this problem with version R 1.7.1 (for which I used the binary
distribution on CRAN). Now, I have source compiled R 1.8.0. Although,
everything passed 'make check', I am wondering if it could be possible that
'devga.c' or any other necessary file for running png() or jpeg() have not
been compiled 'correctly', or do I have simply to adjust a par()-argument?  

Any pointers or help is appreciated.
 

Bernhard


platform: "i386-pc-mingw32"
arch: "i386"
os: "mingw32"
system: "i386, mingw32"
major: "1"
minor: "8.0"
Windows NT 5.0




The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] ESS windows/linux

2003-10-28 Thread Pfaff, Bernhard
> In front of my long intention
> migrate to linux i'm trying Xemacs 
> and ESS for first in Windows.
> Install all and get the Rd-Menu
> in Xemacs, but if i want to "Eval a region"
> of R-Code i get the message
> in the below window "No ESS Processes running"!

Have you started an R process in the first place? 

M-x R

Secondly, have your set your path in 'ess-site.el' correctly?

HTH,
Bernhard


> 
> P.S.
> Have anybody written a document like
> "Using R-Project - from Windows2Linux" 
> which describe the differencies in one
> small paper. If not, perhaps i summarize
> in next weeks my experience.
> 
> Not misunderstand it should not 
> replace the faq's, but perhaps  
> speed up migration from windows
> to linux when the linux skills at
> a beginner level.
> 
> many thanks and 
> regards,christian
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 



The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express 
written permission of the sender. If you are not the intended recipient, please 
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


FW: [R] GARCH

2004-04-02 Thread Pfaff, Bernhard
> > Hi there fellow R-Users, 
> > 
> > Can anyone recommend a good book on the theory and practice 
> > of applying
> > GARCH models. 
> 
Hello Wayne,
 
* Campbell, John, Lo, Andrew W., MacKinlay, A. Craig, The 
  Econometrics of Financial Markets, 1996, Princeton, NJ: 
  Princeton University Press.
 
 http://pup.princeton.edu/titles/5904.html
 
* Enders, Walter, Applied Econometric Time Series, 2. Edition 
  - August 2003, New York, NY: John Wiley and Sons.
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471230650,descCd-tableOf
Contents.html

and

* Hamilton, James, Time Series Analysis, 1994, New Jersey: Princeton
University Press. 

http://pup.princeton.edu/TOCs/c5386.html

springs to my mind. Campbell et al. as well as Hamilton cover GARCh models
from a more theoritical/methodological point of view, whereas the book by
Enders is more orientied to GARCh applications. All given sources are not
solely dealing with heteroskedastic models but do expose them in separate
chapters.

> 
> Also, does any one know of any R related subject material  in 
> addition to
> library(tseries).


well, packages/functions for ML-estimation.

HTH,
Bernhard



> 
> Regards
> 
> Wayne
> 
> Dr Wayne R. Jones
> Senior Statistician / Research Analyst
> KSS Limited
> St James's Buildings
> 79 Oxford Street
> Manchester M1 6SS
> Tel: +44(0)161 609 4084
> Mob: +44(0)7810 523 713
> 
> 
> 
> 
> KSS Ltd
> Seventh Floor  St James's Buildings  79 Oxford Street  
> Manchester  M1 6SS  England
> Company Registration Number 2800886
> Tel: +44 (0) 161 228 0040 Fax: +44 (0) 161 236 6305
> mailto:[EMAIL PROTECTED]  http://www.kssg.com
> 
> 
> The information in this Internet email is confidential and 
> m...{{dropped}}
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] r: arma fitting

2004-04-14 Thread Pfaff, Bernhard
> 
> hi all
> 
> i would like to model an AR model of the following form:
> 
> y(t) = a + p*y(t-5) + e(t)
> 

Hello Allan,

why not simply lm(), such as below?

n <- length(y)
lm(y[-c(1:5)] ~ y[-c((n-4):n)])

or, alternatively you could restrict coefficients ar(1) to ar(4) to zero by
using:

arima(y, order=c(5, 0, 0), fixed=c(0, 0, 0, 0, NA, NA), method="CSS")

HTH,
Bernhard


> where :
> 
> y(t) is the value of y at time t
> a is a constant
> p is the coefficient of the 5th lagged term
> {e} is a normal error series
> 
> Any help will be appreciated
> Allan
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] trend turning points

2004-04-15 Thread Pfaff, Bernhard
> > 
> > does anybody know of a nice test to detect trend turning points in
> > time series? Possibly with reference?
> 
> You can look at the function breakpoints() in the package strucchange
> and the function segmented() in the package segmented which do
> segmentation of (generalized) linear regression models. The 
> former tries
> to fit fully segmented regression models, the latter broken 
> line trends.
> References are given on the respective help pages.
> 
> A suitable test for a change in trend in linear regression 
> models is the
> OLS-based CUSUM test with a Cramer-von Mises functional of
> Kraemer & Ploberger (1996, JoE) which is available via efp() in
> strucchange and associated methods.


Hello Joerg,

additionally to Achim's comments, there is also the Zivot & Andrews test
available in the contributed package 'urca',

  Zivot, E. and Andrews, Donald W.K. (1992), Further Evidence on the
  Great Crash, the Oil-Price Shock, and the Unit-Root Hypothesis,
  Journal of Business & Economic Statistics, 10(3),
  251-270.

  Download possible at: \url{http://cowles.econ.yale.edu/}, see rubric
  'Discussion Papers (CFDPs)'.


in case you are also interested in inferences on integration of your time
series at hand.

Bernhard

> 
> hth,
> Z
> 
> > Thanks,
> > 
> > joerg
> > 
> > __
> > [EMAIL PROTECTED] mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] regression and dw

2004-04-19 Thread Pfaff, Bernhard
> > Dear R People:
> > 
> > Suppose we have a regression model that we will call
> > y.lm
> > 
> > We run the Durbin Watson test for autocorrelation
> > and we find that there is positive autocorrelation,
> > and phi = 0.72, say.
> > 
> > What is our next step, please?  
> 
> Look at the residuals more closely, e.g. look at the acf.
> 
> > Do we calculate the following
> > yprime_t = y_t - 0.72y_t-1,
> > x1prime_t = x1_t - 0.72x1_t-1,
> > 
> > and so on, and re-fit the linear mode?

Hello Erin,

beside the points mentioned by Prof. Ripley, you might also want to consider
test for order of integration of y and x and if cointegration exists between
these variables. A high R2 and a low DW is often a hindsight for a spurious
relationship, which needs to be investigated further. There is the
contributed package 'urca' available. Incidentally, a package update will be
put on CRAN shortly. If you want to receive it now, pls. contact me offline
and name your OS (i.e. zip or tar.gz).

HTH,
Bernhard  



> 
> Better to use arima with AR residuals and an xreg matrix.  
> 
> -- 
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Box-Ljung p-value -> Test for Independence

2004-04-19 Thread Pfaff, Bernhard
> 
> 1) A small p-value is evidence that there is dependence.
> So you want to see large p-values.  But a large p-value
> is not really evidence of independence -- merely a lack
> of evidence of dependence.

Hello Aroon,

additionally to the points voiced by Patrick, only if your series at hand is
normally distributed you can infer from uncorrelatedness (Ljung-Box test) to
independence. These two are equivalent in the case of normally distributed
random variables. Uncorrelated rv are not necessarily independent, whereas
the opposite is true. Hence, you want to utilise "Jarque-Bera-test", or some
test for normality, too.

HTH,
Bernhard 


> 
> You might be able to get a hint of the power of your test
> (which is what you really care about) from the working
> paper about Ljung-Box on the Burns Statistics website.
> 
> 2) The statistic is really an average of the lags up to the
> stated lag.  So if the dependence is all at lag 5, tests with
> lags below 5 have no power, the lag 5 test has maximum
> power, and the power decreases as the lag of the test
> increases above 5.
> 
> Patrick Burns
> 
> Burns Statistics
> [EMAIL PROTECTED]
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
> 
> Aroon Nataraj wrote:
> 
> > Hi all
> > I'm using the Box-Ljung test (from within R) to test if a 
> time-series 
> > in independently distributed.
> >
> > 2 questions:
> > 1) p-value returned by Box-Ljung:
> > IF I want to test if the time-series is independant at say 0.05 
> > sig-level (it means that prob of erroneously accepting that the 
> > time-series is independent is 0.05 right?)
> > --> then do I consider time-series as "independant" when
> >  --> p-value (from Box-Ljung) > 0.05
> >  OR
> >   --> p-value < 0.05
> > Or should i be using (0.95) instead of (0.05) for this case. I'm 
> > confused about this (this is a goodness-of-fit test?).
> >
> > 2) Box-Ljung takes a lag argument, say lag=k.
> > Does it check "all lags upto k"
> > OR
> > Does it check "only AT k" (i.e acf val is small at only k?)
> >
> > thank you in advance. I apologize if the questions are very basic.
> >
> > Aroon
> >
> > __
> > [EMAIL PROTECTED] mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> >
> >
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Non-Linear Regression (Cobb-Douglas and C.E.S)

2004-04-19 Thread Pfaff, Bernhard
> Dear all,
> 
> For estimating Cobb-Douglad production Function [ Y = ALPHA * 
> (L^(BETA1)) * 
> (K^(BETA2))  ], i want to use nls function (without 
> linearizing it). But 
> how can i get initial values?
> 
> 
>  > options(prompt=" R> " )
>   R> Y <- c(59.6, 63.9, 73.5, 75.6, 77.3, 82.8, 83.6, 84.9, 
> 90.3, 80.5, 
> 73.5, 60.3, 58.2, 64.4, 75.4, 85, 92.7, 85.4, 92.3, 101.2, 
> 113.3, 107.8, 
> 105.2, 107.1, 108.8, 131.4, 130.9, 134.7, 129.1, 147.8, 152.1, 154.3, 
> 159.9) # production
>   R> L <- c(39.4, 41.4, 43.9, 43.3, 44.5, 45.8, 45.9, 46.4, 
> 47.6, 45.5, 
> 42.6, 39.3, 39.6, 42.7, 44.2, 47.1, 48.2, 46.4, 47.8, 49.6, 
> 54.1, 59.1, 
> 64.9, 66, 64.4, 58.9, 59.3, 60.2, 58.7, 60, 63.8, 64.9, 66) # 
> employment
>   R> K <- c(236.2, 240.2, 248.9, 254.5, 264.1, 273.9, 282.6, 
> 290.2, 299.4, 
> 303.3, 303.4, 297.1, 290.1, 285.4, 287.8, 292.1, 300.3, 301.4, 305.6, 
> 313.3, 327.4, 339, 347.1, 353.5, 354.1, 359.4, 359.3, 365.2, 
> 363.2, 373.7, 
> 386, 396.5, 408) # capital
>   R> klein <- cbind(Y,L,K)
>   R> klein.data<-data.frame(klein)
>   R> coef(lm(log(Y)~log(L)+log(K)))
> # i used these linearized model's estimated parameters as 
> initial values
> (Intercept)  log(L)  log(K)
>   -3.6529493   1.0376775   0.7187662
>   R> nls(Y~ALPHA * (L^(BETA1)) * (K^(BETA2)), 
> data=klein.data, start = 
> c(ALPHA=-3.6529493,BETA1=1.0376775,BETA2=0.7187662), trace = T)
> 6852786785 :  -3.6529493  1.0376775  0.7187662
> 1515217 :  -0.02903916  1.04258165  0.71279051
> 467521.8 :  -0.02987718  1.67381193 -0.05609925
> 346945.7 :   -0.5570735  10.2050667 -10.2087997
> Error in numericDeriv(form[[3]], names(ind), env) :
>  Missing value or an Infinity produced when 
> evaluating the model
> 
> 
> 1. What went wrong? I think the initial values are not good 
> enough: How can 
> i make a grid search?
> 
> 2. How can i estimate C.E.S Production Function [  Y = GAMA * 
> ((DELTA*K^(-BETA)) + ((1-DELTA)*L^(-BETA)))^(-PHI/BETA)  ] 
> using the same 
> data? How to get the initial value?
> 

Dear James, Wettenhall,

as far as the CES production function is concerned, you might want to
utilise the Kmenta approximation. The following link elucidates this
approach and other feasible estimation techniques.

http://www.cu.lu/crea/projets/mod-L/prod.pdf


HTH,
Bernhard

> N.B.: The data file is available at 
http://www.angelfire.com/ab5/get5/klein.txt

Any response / help / comment / suggestion / idea / web-link / replies will 
be greatly appreciated.

Thanks in advance for your time.

___

Mohammad Ehsanul Karim <[EMAIL PROTECTED]>
Institute of Statistical Research and Training
University of Dhaka, Dhaka- 1000, Bangladesh

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] import Excel file ?

2004-04-20 Thread Pfaff, Bernhard
> 
> Good afternoon,
> 
> I would like to know how can I import Excel files in R ? Do I have to 
> transform them in text files (.txt) ?
> Thank you

Hello Emilie,

two possibilities come to my mind:

1) Save your execl file as csv and use read.csv()

2) Use the contributed package "RODBC"
library(RODBC)
chan <- odbcConnectExcel("Path to your Excel file")
your.df <- sqlFetch(chan, "name of your data sheet")
close(chan)

and of course, last but not least, consult the manual: R Data Import/Export

HTH,
Bernhard
> 
> Emilie Haon-Lasportes
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] bilinear and non linear

2004-05-11 Thread Pfaff, Bernhard
> 
> Dear all,
> there are R packages able to simulate or estimate bilinear 
> model for time
> series?
> I know it is an open problem, but do exist something for very 
> simplified
> bilinear models?

Hello Dario,

well, it should be possible to estimate a bilinear model by employing nls()
or optim().

> 
> Alternatively, what kinfd of non linear time series models 
> are performed
> in R?

Almost any, have a look at the contributed packages "tseries" and "ts". You
can as well set up your own likelihood function and solve numerically (see
above). There are/should be no limitations.

> 
> If R is not able, could someone suggest me for some 
> commercial softwares
> to deal with bilinear models?


by googling on "bilenear models", I found the following link, which mentions
"XploRe" of Prof. Härdle:

http://www.quantlet.com/mdstat/scripts/xlg/html/xlghtmlnode53.html
http://www.xplore-stat.de/index_js.html


HTH,
Bernhard 


> i'm afraid of a negative answer ...
> thanks in advance,
> Daria
> 
> 
> Daria Mendola
> Dipartimento di Scienze Statistiche e Matematiche
> "Silvio Vianelli"
> Università di Palermo
> Viale delle Scienze - Edificio 13
> 90128 Palermo, Italia
> tel. +39 091 6626210
> fax  +39 091 485726
> email: [EMAIL PROTECTED]
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] regression slope

2004-07-21 Thread Pfaff, Bernhard
see also the contributed document by John Verzani, Simple R, page 87f.

> Adaikalavan Ramasamy wrote:
> 
> > I would try to construct the confidence intervals and 
> compare them to
> > the value that you want
> > 
> >>x <- rnorm(20)
> >>y <- 2*x + rnorm(20)
> >>summary( m1 <- lm(y~x) )
> > 
> > 
> > 
> > Coefficients:
> > Estimate Std. Error t value Pr(>|t|)
> > (Intercept)   0.1418 0.1294   1.0950.288
> > x 2.2058 0.1289  17.108  1.4e-12 ***
> > 
> > 
> > That says that the slope estimate is 2.2058 with standard error of
> > 0.1289. So the approximate 99% CI is 2.2058 +/- 3*0.1289 = (1.819,
> > 2.593) which is clearly greater than 1.
> > 
> > 
> >>summary(m1)[[4]][2,1] + 3* summary(m1)[[4]][2,2]
> > 
> > [1] 2.592629
> > 
> >>summary(m1)[[4]][2,1] - 3* summary(m1)[[4]][2,2]
> > 
> > [1] 1.819026
> > 
> 


> I think the preferred way of doing this is with confint:
> 
> # 3 sigma limits
> confint(m1, parm = "x", level = 1 - pt(-3, m1$df.resid) * 2)
> # 95% confidence (default)
> confint(m1, parm = "x")
> 
> > For your next question, you simply compare the CI of one slope to
> > another and see if they overlap. 
> > 
> > There is probably a way to construct proper significance 
> testing to get
> > p-values and such. You can try reading MASS4 or hopefully 
> someone in the
> > list might provide with a neater answer.
> > 
> > 
> > On Tue, 2004-07-20 at 17:02, Avril Coghlan wrote:
> > 
> >>Hello,
> >>
> >>  I'm a newcomer to R so please
> >>forgive me if this is a silly question.
> >>
> >>It's that I have a linear regression:
> >>fm <- lm (x ~ y)
> >>and I want to test whether the
> >>slope of the regression is significantly
> >>less than 1. How can I do this in R?
> >>
> >>I'm also interested in comparing the
> >>slopes of two regressions:
> >>fm1 <- lm (x ~ y)
> >>fm2 <- lm (a ~ b)
> >>and asking if the slope of fm1 is
> >>less than the slope of fm2. Is this
> >>easy to do in R?
> >>
> >>
> >>I will be very grateful for any help.
> >>
> >>regards,
> >>Avril Coghlan
> >>(University College Dublin, Ireland)
> >>
> >>__
> >>[EMAIL PROTECTED] mailing list
> >>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >>PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
>>
> 
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Testing autocorrelation & heteroskedasticity of residuals in ts

2004-07-21 Thread Pfaff, Bernhard
> 
> Hi,
> 
> I'm dealing with time series. I usually use stl() to
> estimate trend, stagionality and residuals. I test for
> normality of residuals using shapiro.test(), but I
> can't test for autocorrelation and heteroskedasticity.
> Is there a way to perform Durbin-Watson test and
> Breusch-Pagan test (or other simalar tests) for time
> series?
> I find dwtest() and bptest() in the package lmtest,

Hello Vito,

how about:

library(lmtest)
data(nottem)
test <- summary(stl(nottem, s.win=4))
bptest(formula(nottem ~ -1 + test$time.series[,1] + test$time.series[,2]))
dwtest(formula(nottem ~ -1 + test$time.series[,1] + test$time.series[,2]))

i.e. you define the residuals by providing the residuals as formula. 
Note:
testres <- nottem-test$time.series[,1]-test$time.series[,2]
cbind(testres, test$time.series[,3])

Anyway, are these tests applicable to stl as far as the underlying
assumptions for the error term is concerned?

Bernhard


> but it requieres an lm object, while I've a ts object.
> Any help will be appreciated.
> Best
> Vito
> 
> =
> Diventare costruttori di soluzioni
> 
> Visitate il portale http://www.modugno.it/
> e in particolare la sezione su Palese 
http://www.modugno.it/archivio/cat_palese.shtml

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Correlation test in time series

2003-11-26 Thread Pfaff, Bernhard
> Thanks for you help,
> 
> And how to test covariance = zero in time series ,
> cov(r_t, r_t-1)=0
> and r_t  are homoscedastik and dependent ?

How about:

?acf
?pacf

in package 'ts'

HTH,
Bernhard

> 
>  Thanks
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 



The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express 
written permission of the sender. If you are not the intended recipient, please 
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Scatterplot axes

2003-12-10 Thread Pfaff, Bernhard
> Please, could someone help me figure out what seems to be a 
> very simple
> problem (and is still taking me hours...).
> I want to draw a simple scatterplot but with 'equal' axes, 
> i.e. I want both
> axes to go from -3 to 3. Values for x lie between -2 and 0.5, 
> values for y

Hello Ellen,

how about:

(x <- seq(-2, 0.5, length=10))
(y <- seq(-3, 3, length=10))
plot(y~x, xlim=c(-3,3), ylim=c(-3, 3))

HTH,
Bernhard



> between -2.2 and 3. I have tried 'usr' and 'eqscplot' and a few other
> options, but it doesn't give me the desired result.
> Many thanks!!!
> Ellen
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 



The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] How to generate a report with graphics and tables?

2004-01-29 Thread Pfaff, Bernhard
> 
> Hello R-Users,
> 
> I have some data sets which change on a daily bases. So far I have 
> imported  these sets into R, done all my evaluations resulting in a 
> couple of plots, charts and tables of numbers which I copy&pasted via 
> clipboard into Powerpoint.
 ^^
Hello Olaf,

if you follow the previously given advices, i.e using Sweave/LaTeX, you
might consider the package "pdfscreen" and/or an utility program "ppower",
to enhance your "LaTeX-presentation".

HTH,
Bernhard

http://www.tp4.ruhr-uni-bochum.de/SoftwareDocs/pdfsc/pdfscr-doc.html

http://www.ctan.org/tex-archive/support/ppower4/?action=/tex-archive/support
/  


> The procedure is always the same and I wonder, whether there is no 
> easier way for doing so. Is there some type of "report generator" 
> available or some HowTo on this.
> 
> Can anybody give me a hint on where to look for?
> 
> Regards,
> 
> Olaf Bürger
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express 
written permission of the sender. If you are not the intended recipient, please 
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] S+Finmetrics cointegration functions

2004-03-26 Thread Pfaff, Bernhard
> 
> Dear all,
> 
> S+Finmetrics has a number of very specilised functions.  I am 
> particularly interested in the estimation of cointegrated 
> VARs (chapter 
> 12 of Zivot and Wang).  In this context the functions coint() and 
> VECM() stand out.  I looked at package "dse1", but found no 
> comparable 
> functionality.  Are there any other packages you could point 
> me to?  In 
> general, are there efforts for replicating within one package the 
> functionality of S+Finmetrics?  Thank you very much in 
> advance for any 
> guidance.


Dear Ivan,

yesterday, I have uploaded an update of package 'urca' (version 0.3-3). In
this update the Johansen procedure as outlined in:

  Johansen, S. (1988), Statistical Analysis of Cointegration Vectors,
  \emph{Journal of Economic Dynamics and Control}, \bold{12}, 231--254.

  Johansen, S. and Juselius, K. (1990), Maximum Likelihood Estimation and
  Inference on Cointegration -- with Applications to the Demand for
  Money, \emph{Oxford Bulletin of Economics and Statistics}, \bold{52,
2}, 169--210.

  Johansen, S. (1991), Estimation and Hypothesis Testing of
  Cointegration Vectors in Gaussian Vector Autoregressive Models,
  \emph{Econometrica}, \bold{Vol. 59, No. 6}, 1551--1580.

is implemented. Beside containing the Johansen procedure the data sets used
in Johansen, S. and Juselius, K. (1990) are provided, too, such that you can
directly cross check their results and investigate further. 
Various unit root tests encountered in applied econometrics are also
available in this package; among these are:

1) Elliott, G., Rothenberg, T.J. and Stock, J.H. (1996)
2) Kwiatkowski, D., Phillips, P.C.B., Schmidt, P. and Shin, Y., (1992)
3) Phillips, P.C.B. and Perron, P. (1988)
4) Schmidt, P. and Phillips, P.C.B. (1992)
5) Zivot, E. and Andrews, Donald W.K. (1992)
6) Phillips, P.C.B. and Ouliaris, S. (1990)

The package is written in *pure* R and S4 classes are utilised. It is
intended to amend this package by other functionalities in the context of
VECM / cointegration analysis in the near future (e.g. such as impulse
responses, Luetkepohl et al. (2004), "TESTING FOR THE COINTEGRATING RANK OF
A VAR PROCESSWITH LEVEL SHIFT AT UNKNOWN TIME", *Econometrica* Vol. 72 No.
2, 647 -- 662 and the like).

Hopefully this package is of use for you and the econometric oriented R
community as well.

Bernhard


> 
> Best regards,
> 
> ___
> Ivan Alves
> mailto://[EMAIL PROTECTED]
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Package update: 'urca' version 0.3-3

2004-03-26 Thread Pfaff, Bernhard
Dear R-list member,

an update of package 'urca' has been uploaded to CRAN (Mirror: Austria). 
In the updated release unit root and cointegration tests encountered in
applied econometric analysis are implemented. The package is written in
'pure' R and utilises S4 classes.

In particular, the Johansen procedure with likelihood ratio tests for the
inclusion of a linear trend, restrictions on beta and/or alpha matrices, as
well as the data used by Johansen, S. and Juselius, K. (1990) in their
seminal paper have been added. 
Where applicable web-links to the original papers/articles and/or data
sources have been included to the help files, too.


Contents (abbreviated list:
***

ablrtestLikelihood ratio test for restrictions on
alpha and beta
alrtest Likelihood ratio test for restrictions on
alpha
blrtest Likelihood ratio test for restrictions on beta
ca.jo   Johansen Procedure for VECM
ca.jo-class Representation of class 'ca.jo'
ca.po   Phillips & Ouliaris Cointegration Test
ca.po-class Representation of class 'ca.po'
cajo.test-class Representation of class 'cajo.test'
denmark Data set for Denmark, Johansen & Juselius
ecb Macroeconomic data of the Euro Zone
finland Data set for Finland, Johansen & Juseliues
lttest  Likelihood ratio test for linear trend 
npext   Nelson & Plosser extended data set
nporg   Nelson & Plosser original data set
plot-methodsMethods for Function plot in Package 'urca'
plotres Graphical inspection of VECM residuals
show-methodsMethods for Function show in Package 'urca'
summary-methods Methods for Function summary in Package 'urca'
ur.ers  Elliott, Rothenberg & Stock Unit Root Test
ur.ers-classRepresentation of class 'ur.ers'
ur.kpss Kwiatkowski et al. Unit Root Test
ur.kpss-class   Representation of class 'ur.kpss'
ur.pp   Phillips & Perron Unit Root Test
ur.pp-class Representation of class 'ur.pp'
ur.sp   Schmidt & Phillips Unit Root Test
ur.sp-class Representation of class 'ur.sp'
ur.za   Zivot & Andrews Unit Root Test
ur.za-class Representation of class 'ur.za' 

Your comments are welcome. Looking forward to hear from,

Best,
Bernhard 

Dr. Bernhard Pfaff
Global Debt Research - Index and Quantitative Strategy
Dresdner Kleinwort Wasserstein
Phone:  +49 (0)69 713 12273 
Mobile: na 
Fax:+49 (0)69 713 19816


Bloomberg: DRKW




The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] optimize() - Solution is invariant with respect to parameters - lexical function

2002-12-19 Thread Pfaff, Bernhard
Dear R-List member,

suppose the following single valued functional form is given: y = f(x | a,
b, c). Now I want to use optimize to solve for the value of x that satisfy
the function.
As an example, pls. take a look at the following:

input <- function(y,a,b,c){
f <- function(x){
  (a + b*x + c*x^2 - y)^2
}
optimize(f,c(1,100))
}
#
# example with x=2
#
input(y=7,a=1,b=1,c=1)
temp1 <- input(y=7,a=1,b=1,c=1)$minimum
temp1
1 + temp1 + temp1^2
#
# example with x=3
#
input(y=14,a=2,b=1,c=1)
temp2 <- input(y=14,a=2,b=1,c=1)$minimum
temp2
2 + temp2 + temp2^2

So far, so good(?). Now, the function that I am interesting in has the
following form:


bsiv.opt <- function(op, s, x, r, tt){
  iv <- function(sig){
   (s*pnorm((log(s/x)+(r+0.5*sig^2)*tt)/sig*sqrt(tt)) -
x*exp(-r*tt)*pnorm((log(s/x)+(r+0.5*sig^2)*(tt))/sig*sqrt(tt)-sig*sqrt(tt))
- op)^2
  }
  optimize(iv,c(1,100))
}
#
# example 1
#
bsiv.opt(4.75, 93.625, 90, 0.0512, 22)
#
# example 2
#
bsiv.opt(4.75, 93.625, 80, 0.0512, 22)

My question is as follows: although, I have altered one parameter value, the
solved minimum value does not change; how come? What have I made wrong?
Any hints and pointers are most welcome.

Rgds,
Bernhard 




--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] optimize() - Solution is invariant with respect to parame ters - l exical function

2002-12-19 Thread Pfaff, Bernhard
Solved the problem myself, thks, for any efforts taken!

-Original Message-
From: Pfaff, Bernhard [mailto:[EMAIL PROTECTED]]
Sent: 19 December 2002 14:58
To: [EMAIL PROTECTED]
Subject: [R] optimize() - Solution is invariant with respect to
parameters - l exical function


Dear R-List member,

suppose the following single valued functional form is given: y = f(x | a,
b, c). Now I want to use optimize to solve for the value of x that satisfy
the function.
As an example, pls. take a look at the following:

input <- function(y,a,b,c){
f <- function(x){
  (a + b*x + c*x^2 - y)^2
}
optimize(f,c(1,100))
}
#
# example with x=2
#
input(y=7,a=1,b=1,c=1)
temp1 <- input(y=7,a=1,b=1,c=1)$minimum
temp1
1 + temp1 + temp1^2
#
# example with x=3
#
input(y=14,a=2,b=1,c=1)
temp2 <- input(y=14,a=2,b=1,c=1)$minimum
temp2
2 + temp2 + temp2^2

So far, so good(?). Now, the function that I am interesting in has the
following form:


bsiv.opt <- function(op, s, x, r, tt){
  iv <- function(sig){
   (s*pnorm((log(s/x)+(r+0.5*sig^2)*tt)/sig*sqrt(tt)) -
x*exp(-r*tt)*pnorm((log(s/x)+(r+0.5*sig^2)*(tt))/sig*sqrt(tt)-sig*sqrt(tt))
- op)^2
  }
  optimize(iv,c(1,100))
}
#
# example 1
#
bsiv.opt(4.75, 93.625, 90, 0.0512, 22)
#
# example 2
#
bsiv.opt(4.75, 93.625, 80, 0.0512, 22)

My question is as follows: although, I have altered one parameter value, the
solved minimum value does not change; how come? What have I made wrong?
Any hints and pointers are most welcome.

Rgds,
Bernhard 




--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: Part II Re: [R] read.ssd {foreign} (Reading a permanent SAS d ataset into an R data frame)

2002-12-20 Thread Pfaff, Bernhard
try:

library(foreign)
read.ssd("J:\\QM\\Reports\\Sarthur\\SAS_Application\\SAS_Data_Sets","use")

instead, hth, Merry Christmas, Bernhard

-Original Message-
From: Stephen Arthur [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2002 16:55
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Part II Re: [R] read.ssd {foreign} (Reading a permanent SAS
dataset into an R data frame)


Hello,

I adopted the suggestion to use the R command

> foreign

before the 

>
read.ssd("J:\\QM\\Reports\\Sarthur\\SAS_Application\\SAS_Data_Sets","use")

statement (notice, I am at work now, so the directory
structure changes).  Do I need any of the other
read.ssd parameters to get this statement to work,
because...

... I get the following error message in R: 

"
SAS failed.  SAS program at
C:\TEMP\Rtmp12421\file21582.sas 
a log and other error products should be in the
vicinity
NULL
Warning messages: 
1: sas not found 
2: SAS return code was -1 in:
read.ssd("J:\\QM\\Reports\\Sarthur\\SAS_Application\\SAS_Data_Sets",
 
> 
"

Why am I getting the message "sas not found", when I
have SAS installed on my machine?

I checked the PROC COPY SAS program generated in the
indicated temporary file:

"
libname src2rd
'J:\QM\Reports\Sarthur\SAS_Application\SAS_Data_Sets';
libname rd xport 'C:\TEMP\Rtmp12421\file14817';
proc copy in=src2rd out=rd;
select use ;
"

SAS log

"
NOTE: SAS initialization used:
  real time   4.64 seconds
  cpu time0.73 seconds
"

Can anyone help me get to the next step of this
process?  I believe I am close to getting R to read
SAS permanent data sets directly, which I would really
like to be able to do.

Thanks,

Stephen



--- [EMAIL PROTECTED] wrote:
> On Thu, 19 Dec 2002, Stephen Arthur wrote:
> 
> > I just downloaded and installed R 1.6.1 on my
> Windows
> > machine where I also run SAS.
> >
> > I want to use the 'read.ssd' function so that I
> can
> > convert a permanent SAS data set into an R data
> frame.
> >

> > C:\Program
> > Files\R\rw1061\library\foreign\html\read.ssd.html
> >
> > When I run the first R command, in the example, on
> my
> > SAS library:
> >
> > > list.files("C:\\My Documents\\SAS_Data_Sets")
> >
> > I get the correct output.
> >
> > When I run the second R command, in the example,
> >
> > > read.ssd("C:\\My
> Documents\\SAS_Data_Sets","use")
> >

> 2) To use a package you need to use e.g.
> 
> library(foreign)

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] Elements of a character vector in different colours?

2003-01-09 Thread Pfaff, Bernhard
Dear R-List,

is it possible to format elements of a character vector in different colors
and how would this be achieved?

Problem:
Suppose, you have a model for forecasting purposes. Beside the forecast
[variable: 'forecast' in the example below] a forecast interval is also
computed [variable: 'int' in the example below. The forecast should now be
translated in verbal terms if the forecast interval is below or above a
certain threshold value [in the example below, this value is set to 50]. 
After evaluation the object text should be formatted in either "green", or
"red", or "black".
 
outcome <- c("positive","negative","neutral")
forecast <- 60
int <- c(55,65)
#
text <- outcome[3]
text[forecast > 50 & int[1] > 50] <- outcome[1]
text[forecast < 50 & int[2] < 50] <- outcome[2]
text

I tried the following

outcome <- c("positive","negative","neutral")[col=c("green","red","black"]

without success, i.e. three times "na" formatted in green is returned. I did
also check the former help-emails without finding any pointers to solve my
problem.
As a side note: the object 'text' will be used in the supplementary package
R2HTML. I want to avoid programming the conditional colouring with ASP by
reading in an ascii-file that holds the value of 'text' and hence not using
R2HTML at all.

R: 1.61
OS: Windows NT
i386

Any help or hints are warmly appreciated.

Bernhard




--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] Option pricing

2003-02-03 Thread Pfaff, Bernhard
Hello Rabaie,

how about the contributed package: "RQuantLib"?

HTH,
Bernhard


-Original Message-
From: Rabaie Remon [mailto:[EMAIL PROTECTED]]
Sent: 02 February 2003 19:24
To: [EMAIL PROTECTED]
Subject: [R] Option pricing



Dear sir:

I want just ask if there is in R any package to use like in S+, for the 
Basic option pricing (Binomail model, Black-Scholes pricing formula)

Thank you,

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] Package: cluster -- plot.partition() change title: main=""

2003-02-05 Thread Pfaff, Bernhard
Dear R-list members,

I am using the cluster package and by the generation of plot.partition I ran
into the problem that an alternative title overlaps the default title.

> plot.partition(clara.14,which.plot=2,stand=TRUE, main="Silhouette plot of
14 clusters")

The manual states that all optional arguments for clusplot.default may also
be supplied to plot.partition(). Altering the title in clusplot() works.
Question: What am I doing wrong and what would be the correct way to insert
the graphic title "Silhouette plot of 14 clusters" alone?

I am using R 1.61 on Windows NT and the latest available cluster package
from CRAN.

Many thks in advance.

Rgds,
Bernhard






--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] density(): obtaining p-values

2003-03-03 Thread Pfaff, Bernhard
Dear R-List-Member,

is there a more elegant way to obtain p-values of a vector x, whose
empirical density has been estimated with density(), than summing up the
rectangles as an approximation of the area beneath the empirical
distribution function and interpolating the values of x by using approx()?

pval.emp <- function(x)
  {
   df <- density(x,from=min(x),to=max(x),kernel="gaussian")
   width <- df$x[2]-df$x[1]
   rect <- df$y*width
   cdf.emp <- cumsum(rect)
   approx(df$x,cdf.emp,x)$y
  }

Many thks in advance,
Bernhard




--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Embed R in other applications

2003-03-04 Thread Pfaff, Bernhard
see the contributed pacakge "R2HTML"; in case you have access to a databank:
"RODBC" package and the like might also be an option in combination with
*.php and/or *.asp-files for web-publishing.
I have implemented both and it runs succesfully without any "hickups".
Updating the data, running R-program as batch via scheduler and outputting
directly or writing it first into a databank for further processing.

HTH,
Bernhard

-Original Message-
From: Bai Yan [mailto:[EMAIL PROTECTED]
Sent: 04 March 2003 06:01
To: [EMAIL PROTECTED]
Subject: [R] Embed R in other applications


Hello all,

I want to create webpages which can display the R results. The first step
is essentially getting input from client, generating graphics and
returning a page containing those images.

What should I do for this? Are there some sources on the web? Any hints
will be very helpful.

Thanks very much :)

Yan

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


Recall: [R] Embed R in other applications

2003-03-04 Thread Pfaff, Bernhard
Pfaff, Bernhard would like to recall the message, "[R] Embed R in other
applications".


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] R help

2003-03-12 Thread Pfaff, Bernhard

 Dear friends,
 I work with Matlab and now a bit in trouble with getting used to R. Could
you give me some help with the following questions:

 1. how to generate the random matrix mxn with constant mean and variance,
say N(0,1)?

 2. how to create a code (function), say "myfunction", and make it available
for use every time I run R?

 3. how to make a package, say "e1071", available for use without loading it
every time when I start R?

 Thank you.

 Regards,

 Max



ad 3)
?Startup


Cheers,
Bernhard


-

ur needs

[[alternate HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Using R2HTML

2003-04-01 Thread Pfaff, Bernhard
Hello,
I'm using R2HTML library to make a HTML page output (both data frames and
graphics):

HTMLStart(outdir=paste(getwd(),"/prove html", sep = ""),filename="index",
echo = F, HTMLframe = T, withprompt = "HTML> ", CSSFile = "R2HTML.CSS",
Title = "Indici di attività")
...

barplot(tab41[,2],main="...",ylab="%",names.arg=rownames(tab41),cex.names=0.
7)
grid(nx=0,ny=NULL,lty=2)
barplot(tab41[,3],main="...",ylab="",names.arg=rownames(tab41),cex.names=0.7
)
grid(nx=0,ny=NULL,lty=2)
barplot(tab41[,4],main="...",ylab="giorni",names.arg=rownames(tab41),cex.nam
es=0.7)
grid(nx=0,ny=NULL,lty=2)

HTMLplot(Caption=paste("Indici di attività - centro
n.",cod.centro),GraphDirectory = get(".HTML.outdir", env = get("HTMLenv",
envir = .GlobalEnv)), GraphFileName = "ind-pos",Align = "center")

But I get this error:

Error in dev.print(png, file = AbsGraphFileName, width = 400) :
can only print from screen device
Execution halted

Can anyone help me?
Thanks

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Hello Gianluca,

save your graph as jpg-file first and then include it in your html-file
like:


HTMLInitFile(...)
.
.
.
HTML("")
.
.
.
HTMLEndFile()

HTH,
Bernhard


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
--

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] R help: Correlograms

2003-06-06 Thread Pfaff, Bernhard


Hello,

 
I have time series and need to draw simple and partial correlograms with
associated Q-statistics (the same as in EViews). Can I do it in R? Thanks


Hello Shutnik,

see ?Box.test in the ts-package for Q-statistics.

To my knowledge a plot function as in EViews (left-hand panel are ACFs and
PACFs as bars and right-hand panel are acfs, pacfs as values with Q-stats
and p-values) is not existent, hence you have to set up the plot by
yourself. In order, to do so, may be the following function might be of use
to you ("Ljung-Box"):

qstat <- function(x, order=12)
{
  if (order >= (length(x)-1))
{
  print("Vector length falls short of autocorrelations to compute.")
}
  else
{
  x <- as.ts(na.omit(x))
  Total <- length(x)
  factor <- Total*(Total+2)
  xacf <- acf(x, lag=(order), plot=FALSE)
  denom <- rep(Total, order)-seq(1, order)
  Lag <- seq(1, order)
  tausq <- xacf$acf[2:length(xacf$acf)]^2/denom
  Q <- 0[1:order]
  temp <- 0[1:order]
  for(i in 1:order)
{
  temp[i] <- sum(tausq[1:i])
}
  Qstat <- factor*temp
  pval <- 1 - pchisq(Qstat,i)
  Ljung.Box <- cbind(Lag, Qstat, pval)
  Ljung.Box
}
}
#
y <- 1:100
qstat(y, order=10)


HTH,
Bernhard



--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Newbie trying to Lag Variables in a regression

2003-05-30 Thread Pfaff, Bernhard
<[EMAIL PROTECTED]> writes:

> Perhaps I am making this too hard, but how does one regress y(t) on a
> constant, x(t-1) and y(t-1)?  I've tried the manuals and until I get
> Dalgaard's book (just ordered on Amazon), I am stuck!

Not sure the book will unstick you...

However, the simple way is to create a new variable which shifts the
response, i.e. 

yshft <- c(y[-1], NA) # pad with missing
summary(lm(yshft ~ x + y))

Alternatively, lag the regressors:

N <- length(x)
xlag <- c(NA, x[1:(N-1)])
ylag <- c(NA, y[1:(N-1)])
summary(lm(y ~ xlag + ylag))


Hello rwatkins,

in case you have to cope oftenly with lagged exogenous and/or endogenous
variables the following function might be handy, in particular if you want
to create longer lagged series (this is controlled by setting the argument
'd' to the relevant integer of the lagged period):  

#
# Function: tslag (lagging a vector)
#
tslag <- 
function(x, d=1)
{
  x <- as.vector(x)
  n <- length(x)
  c(rep(NA,d),x)[1:n]
}

HTH,
Bernhard



-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] tseries "adf.test"

2003-06-04 Thread Pfaff, Bernhard
I have a question regarding the adf.test command in the tseries library.

I have a vector of time series observations (2265 daily log prices
for the
OEX to be exact).  I also have this same data in first-differenced form.  I
want to test both vectors individually for staionarity with an Augmented
Dickey-Fuller test.  I noticed when I use the adf.test command from the
tseries library, the general regression command used incorporates a constant
and a linear trend -- (trend "order" of 1, I presume).  My specific
questions are as follows: (1) is it possible to alter the function to use a
regression that does not incluse a linear trend? , because (2) it seems to
me that I do not need to "detrend" if I've already taken first differences.

Thanks in advance for your assistance.
Rick


Hello Rick,

you might find the following link useful:

http://www.econ.uiuc.edu/~econ472/tutorial9.html

Pls note, that one typically follows a testing strategy in order to infer
the characteristics of the time series in question (pure random walk, random
with drift or random walk with drift and deterministic trend). The F-type
test statistics (denoted by phi1, phi2, phi3 in the literature) can be
calculated by making use of anova() and checking against the relevant
critical values of these test statistics.

HTH,
Bernhard


--
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] cointegration analysis

2007-08-09 Thread Pfaff, Bernhard Dr.
Hello Dorina,

if you apply ca.jo to a system with more than five variables, a
*warning* is issued that no critical values are provided. This is not an
error, but documented in ?ca.jo. In the seminal paper of Johansen, only
cv for up to five variables are provided. Hence, you need to refer to a
different source of cv in order to determine the cointegration rank.

Best,
Bernhard

>
>
>Hello,
>
>I tried to use urca package (R) for cointegration analysis. The data
>matrix to be investigated for cointegration contains 8 columns
>(variables). Both procedures, Phillips & Ouliaris test and Johansen's
>procedures give errors ("error in evaluating the argument 'object' in
>selecting a method for function 'summary'" respectiv "too many
>variables, critical values cannot be computed"). What can I do?
>
>With regards,
>
>Dorina LAZAR
>Department of Statistics, Forecasting, Mathematics
>Babes Bolyai University, Faculty of Economic Science
>Teodor Mihali 58-60, 400591 Cluj-Napoca, Romania
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] Seasonality

2007-08-10 Thread Pfaff, Bernhard Dr.
Hello Alberto, hello Felix,

aside of monthplot() and stl(), there is the possibility to use Census 
X-12-ARIMA. The program can be downloaded from:

http://www.census.gov/srd/www/x12a/

It should be mentioned that this is *not* a pure R solution, but one can set up 
the relevant scripts and output files and call the program from R and read in 
the relevant numbers back into R again.

Best,
Bernhard 

>?monthplot
>
>?stl
>
>
>On 8/10/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
>> I have a time series x = f(t), where t is taken for each
>> month. What is the best function to detect if _x_ has a seasonal
>> variation? If there is such seasonal effect, what is the
>> best function to estimate it?
>>
>> Function arima has a "seasonal" parameter, but I guess this is
>> too complex to be useful.
>>
>> Alberto Monteiro
>>
>> __
>> 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.
>>
>
>
>-- 
>Felix Andrews / 安福立
>PhD candidate
>Integrated Catchment Assessment and Management Centre
>The Fenner School of Environment and Society
>The Australian National University (Building 48A), ACT 0200
>Beijing Bag, Locked Bag 40, Kingston ACT 2604
>http://www.neurofractal.org/felix/
>voice:+86_1051404394 (in China)
>mobile:+86_13522529265 (in China)
>mobile:+61_410400963 (in Australia)
>xmpp:[EMAIL PROTECTED]
>3358 543D AAC6 22C2 D336  80D9 360B 72DD 3E4C F5D8
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] Restricted VAR parameter estimation

2007-08-20 Thread Pfaff, Bernhard Dr.
Hello Megh,

in principle you can do OLS on an equation-per-equation basis. However,
in this case the estimator might be asymptotically inefficient. One can
use FGLS instead. This is outlined for instance in:

Helmut Luetkepohl, 2007. "Econometric Analysis with Vector
Autoregressive Models," Economics Working Papers ECO2007/11, European
University Institute. 
http://cadmus.iue.it/dspace/bitstream/1814/6918/1/ECO-2007-11.pdf

Incidentally, you can also use restrict() [OLS-based] in package vars;
version 1.3-1 has been uploaded to /incoming on CRAN and it should
appear on the mirrors soon. 

Best,
Bernhard 


>
>I have a VAR model with five macro-economic variables, y[1], 
>y[2], y[3], y[4], y[5]. They are related to each other in 
>following manner.
>
>y[1,t] = alpha[1,0] + beta[1,1, 
>1]*y[1,t-1]++beta[1,1, 12]*y[1,t-12] + beta[1,2, 
>1]*y[2,t-1]++beta[1,2, 12]*y[2,t-12] + e[1,t]
>
>y[2,t] = alpha[2,0] + beta[2,2, 
>1]*y[2,t-1]++beta[2,2, 12]*y[2,t-12] + e[2,t]
>
>y[3,t] = alpha[3,0] + beta[3,1, 
>1]*y[1,t-1]++beta[3,1, 12]*y[1,t-12] 
>+ beta[3,2, 1]*y[2,t-1]++beta[3,2, 12]*y[2,t-12]
>+ beta[3,3, 1]*y[3,t-1]++beta[3,3, 12]*y[3,t-12]
>+ beta[3,4, 1]*y[4,t-1]++beta[3,4, 12]*y[4,t-12] + e[3,t]
>
>y[4,t] = alpha[4,0] + beta[4,3, 
>1]*y[3,t-1]++beta[4,3, 12]*y[3,t-12] 
>+ beta[4,4, 1]*y[4,t-1]++beta[4,4, 12]*y[4,t-12] + e[4,t]
>
>y[5,t] = alpha[5,0] + beta[5,3, 
>1]*y[3,t-1]++beta[5,3, 12]*y[3,t-12] 
>+ beta[5,5, 1]*y[5,t-1]++beta[5,5, 12]*y[4,t-12] + e[5,t]
>
>All variables are stationary
>
>Now I want to estimate the coefficients under a VAR[12] 
>framework. Is it mathematically correct to estimate 
>coefficients of each equaltion with simple OLS separately? Or 
>how I can use R [mAr.est() function) to estimate them?
>   
>  Regards,
>
>
>   
>-
>
>   [[alternative HTML version deleted]]
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] possible bug in vars package (predict.varest) ???

2007-08-31 Thread Pfaff, Bernhard Dr.
Hello Spencer,

which version of vars are you using? This has been fixed a while ago
(see ChangeLog). Incidentally, the data in Canada is quarterly data, as
stated in ?Canada. Aside of this, your code snippet works fine.

Best,
Bernhard

ps: There is no need to download the tarball as suggested by Mark,
instead you can do: vars:::predict.varest

>hello,
>
>I have been trying to use the predict function in the vars package to
>forecast from a seasonal VAR model. The following code sample 
>illustrates
>what I am trying to do and the error that I get when trying to do it.
>
>I run the following code, that results in the following error:
>
>data(Canada)
>
>endoC <- Canada[1:72,1:3]
>exoC <- Canada[1:72,4]
>var.2c <- VAR(endoC, p = 2, season=12,exogen=exoC,type = "const")
>exoC_2 <- as.matrix(Canada[73:84,4])
>
>predict(var.2c, n.ahead = 12,dumvar=exoC_2)
>
>Error:
>
>Error in as.matrix(cycle, nrow = season, ncol = season - 1) :
>unused argument(s) (nrow = 12, ncol = 11)
>
>from what I can guess, the predict.varest function is using 
>as.matrix() and
>passing nrow and ncol, as.matrix() does not take those two 
>parameters but
>matrix() does.
>
>Does anyone have a suggestion of how to get around it? Is 
>there a way I can
>get to the predict.varest() function and alter it myself?
>
>Thanks,
>
>Spencer
>
>   [[alternative HTML version deleted]]
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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] Announcement: CRAN packages 'urca' and 'vars' on R-Forge

2007-09-04 Thread Pfaff, Bernhard Dr.
Dear useR,

the CRAN packages 'urca' and 'vars' are now hosted on R-Forge as
projects 'AICTS I' and 'AICTS II', respectively. The packages' summary
page can be directly accessed via:

AICTS I:
http://r-forge.r-project.org/projects/urca/

AICTS II:
http://r-forge.r-project.org/projects/vars/

All R-Forge features for both projects have been enabled. For more
information about R-Forge, visit: http://r-forge.r-project.org/


Best,
Bernhard
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] lag orders with ADF.test

2007-02-13 Thread Pfaff, Bernhard Dr.
>Hello!
> I do not understand what is meant by:
>
> "aic" and "bic" follow a top-down strategy based on the
>Akaike's and Schwarz's information criteria
>
>in the datails to the ADF.test function. What does a "top-down
>strategy" mean? Probably the respective criterion is minimized

Hello Martin,

are you referring to ADF.test() in package "uroot"? If so, it would be good to 
adress this question to the package maintainer first, which I have cc'ed.
Different approaches for determining an appropriate lag length for ADF tests 
are propagated in the literature. One of them is the usage of information 
criteria; a second one starting from a high lag number and cutting the lag 
length down by signifcance (top to bottom) or vice versa (bottom to top); or 
finally inspect the ACF/PACF's of the residuals in the ADF-test regression and 
choose the lowest possible lag length such that the residuals are uncorrelated.

Best,
Bernhard


>and the mode vector contains the lag orders at which the
>criterion attains it local minima? When the calculation is
>over, the ADF.test function gives info about "Lag orders".
>What are these lag orders? Are they the local minima of the criterion?
>
> I will be very thankful if you clarify this to me. I browsed
>a lot, but I could not find a clear answer.
>
> Thank you for your attention.
> Regards,
> Martin
>
>-
>http://auto-motor-und-sport.bg/
>С бензин в кръвта!
>
>__
>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.
> 
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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] COM objects with early bindings in R

2005-10-17 Thread Pfaff, Bernhard Dr.

Dear list member,

I am using the packages RDCOMClient and SWinTypeLibs and try to import a COM
object (created in Delphi) in R that is of type 'early binding' instead of
late 'late binding'. Is there a possibility to do this in R?

Currently, the following returns an error message:

l1 = LoadTypeLib("c:\\Programme\\INVESCO\\QaCalendar\\Calendar.dll")
print(getTypeLibTypes(l1))
  IQaCalPeriodicInitQaCalPeriodicIQaSeriesInit 
  "dispatch""coclass"   "dispatch" 
QaSeries_QaSerLib QaSerLib 
   "coclass"   "dispatch""coclass" 
  IQaCalSporadicInitQaCalSporadic   _QaCalendarLib 
  "dispatch""coclass"   "dispatch" 
   QaCalendarLib QaCalendarIntersectRules  QaDistanceRules 
   "coclass"   "enum"   "enum" 
createCOMSClass(l1[["QaSerLib"]], "test")
Error in generateOperators(libEntry, className) : 
invalid subscript type  

Any help, pointers or a working example is much appreciated.

Best Regards,
Bernhard

platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor1.1
year 2005   
month06 
day  20 
language R

__
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


[R] CRAN package: update of 'vars' submitted

2006-08-09 Thread Pfaff, Bernhard Dr.
Dear useR!

an updated version of package 'vars' has been shipped to CRAN lately.

Information on package 'vars':
==

Title: VAR Modelling
Version:   0.1.3
Date:  2006-07-27
Author:Bernhard Pfaff
Maintainer:Bernhard Pfaff 
Depends:   R (>= 2.0.0), MASS, strucchange
Saveimage: yes
Description:   Estimation, lag selection, diagnsotic testing,
   forecasting, causality analysis, forecast error variance
   decomposition and impulse response functions of VAR
   models and estimation of SVAR models (A-model, B-model,
   AB-model).
License:   GPL 2 or newer
URL:   http://www.pfaffikus.de


The package is shipped with a NAMESPACE and S3-classes/methods have been
employed.
It should be noted, that this package is still in its infancy, and more
features and functionalities are in the pipeline. Hence, I would
appreciate your feedback -- off list, adressed to the email adress in
the DESCRIPTION file.

Best,
Bernhard

Dr. Bernhard Pfaff
Global Structured Products Group
(Europe)

Invesco Asset Management Deutschland GmbH
Bleichstrasse 60-62
D-60313 Frankfurt am Main

Tel: +49(0)69 29807 230
Fax: +49(0)69 29807 178
Email: bernhard_pfaff at fra.invesco.com 
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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] Omegahat-site down?

2006-08-24 Thread Pfaff, Bernhard Dr.
Dear R-list subscriber,

is it possible that the omegahat-site is down? I was looking for package
'RDCOMClient', but could not establish a connection. In case somebody
has the latest binary zip-file for Windows, would she/he mind to send it
directly to my emaim adress stated in the signature?

Many thanks, and sorry for bothering/misusing R-help in this instance.

Best,
Bernhard 

Dr. Bernhard Pfaff
Global Structured Products Group
(Europe)

Invesco Asset Management Deutschland GmbH
Bleichstrasse 60-62
D-60313 Frankfurt am Main

Tel: +49(0)69 29807 230
Fax: +49(0)69 29807 178
Email: [EMAIL PROTECTED] 
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] Multivariate AR - prediction

2006-10-06 Thread Pfaff, Bernhard Dr.
Hello Alexander,

try package CRAN package 'vars'.

Best,
Bernhard

>Hi,
>
>does anybody know how to predict a multivariate AR within R?
>If I just estimate a multi AR-object and plug it into predict I get an
>error from the aperm - just works for univariates.
>
>thx 
>alex
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] .arch.uni in function call in arch test of vars package

2006-10-11 Thread Pfaff, Bernhard Dr.
>The arch test requires a varest object and I am trying to 
>write one that 
>will use R-metrics arima, arch, Garch objects, or at least a vector. 
>Also the arch function has the following line of code that I can not 
>find the function anywhere
>
>archs.resids <- apply(resids, 2, function(x) .arch.uni(x,
> lags.single = lags.single))
>
Hello Joe,

have a look at the source code (internal.R). For your convenience the
function is:

## univariate ARCH test
".arch.uni" <-
function(x, lags.single){
  lags.single <- lags.single + 1
  mat <- embed(scale(x)^2, lags.single)
  arch.lm <- summary(lm(mat[, 1] ~ mat[, -1]))
  STATISTIC <- arch.lm$r.squared*length(resid(arch.lm))
  names(STATISTIC) <- "Chi^2"
  PARAMETER <- lags.single - 1
  names(PARAMETER) <- "df"
  PVAL <- 1 - pchisq(STATISTIC, df = PARAMETER)
  METHOD <- "ARCH test (univariate)"
  result <- list(statistic = STATISTIC, parameter = PARAMETER, p.value =
PVAL, method = METHOD, data.name = deparse(substitute(x)))
  class(result) <- "htest"
  return(result)
}


Best,
Bernhard


>does any one know about the function .arch.uni?
>
>Thank you
>Joe
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] Multivariate regression

2006-10-30 Thread Pfaff, Bernhard Dr.
Hello Ravi,

have you considered the SUR method proposed by Zellner? An
implementation of it is provided in CRAN-package 'systemfit' (see
?systemfit for more information).

Best,
Bernhard

>
>Suppose I have a multivariate response Y (n x k) obtained at a set of
>predictors X (n x p).  I would like to perform a linear 
>regression taking
>into consideration the covariance structure of Y within each 
>unit - this
>would be represented by a specified matrix V (k x k), assumed 
>to be the same
>across units.  How do I use "lm" to do this?  
>
> 
>
>One approach that I was thinking of is as follows:
>
> 
>
>Flatten Y to a vector, say, Yvec (n*k x 1).  Create Xvec (n*k, 
>p*k) such
>that it is made up of block matrices Bij (k x k), where Bij is 
>a diagonal
>matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p).  
>Now I can use
>"lm" in a univariate mode to regress Yvec against Xvec, with covariance
>matrix Vvec (n*k x n*k).  Vvec is a block-diagonal matrix with 
>blocks of V
>along the diagonal.  This seems like a valid approach, but I 
>still don't
>know how to specify the covariance structure to do weighted 
>least squares.
>
> 
>
>Any help is appreciated.
>
> 
>
>Best,
>
>Ravi.
>
> 
>
>---
>-
>---
>
>Ravi Varadhan, Ph.D.
>
>Assistant Professor, The Center on Aging and Health
>
>Division of Geriatric Medicine and Gerontology 
>
>Johns Hopkins University
>
>Ph: (410) 502-2619
>
>Fax: (410) 614-9625
>
>Email: [EMAIL PROTECTED]
>
>Webpage:  
>http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
>
> 
>
>---
>-
>
>
> 
>
>
>   [[alternative HTML version deleted]]
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] Bloomberg Data Import to R

2006-02-08 Thread Pfaff, Bernhard Dr.
Hello Sumanto,

your question might be more appropriately been posted to the R-sig-finance
list:

[EMAIL PROTECTED] (I have cc'ed this mail to this list).

To my knowledge neither a function nor a CRAN-package does exist. However,
on the last useR! conference Dirk Edelbuettel presented a proprietary
package that utilised the C API of Bloomberg (type WAPI  on a Bloomberg
terminal). I am not sure whether Dirk is nowadays inclined or allowed by his
employee to share this package.

As an alternative, you could download data from Bloomberg into Excel, first
(assuming that you are working in a Windows environment) and then load it
into R via RODBC, for example.

Cheers,
Bernhard



Hi R-Experts,

 

Can anyone tell me how Bloomberg data can be directly downloaded to R?
Is there any package?

Sumanta Basak.



---
This e-mail may contain confidential and/or privileged infor...{{dropped}}

__
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
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] Basic R Problem

2006-02-17 Thread Pfaff, Bernhard Dr.
Hello Peter,

in case your OS is windows and you connect to the Internet via a
Proxy-Server, you can/should set --internet2 in properties of the R icon on
your desktop. See the FAQ for more on this topic.

Bernhard

-Ursprüngliche Nachricht-
Von: Peter Arnold [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 17. Februar 2006 16:39
An: r-help@stat.math.ethz.ch
Betreff: [R] Basic R Problem


> To: Anyone Who Can Help

I am new to R and am trying to install a couple of packages but receive
this warning/error message.  Please help by providing suggestions or
solutions to this problem


>> chooseCRANmirror()
>> utils:::menuInstallPkgs()
> Warning: unable to access index for repository
> http://www.ibiblio.org/pub/languages/R/CRAN/bin/windows/contrib/2.2
> Warning: unable to access index for repository
> http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.2
> Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE,
> type = type) :
> no packages were specified


Best regards,



Peter Arnold, CFA
President
PRA Investment Counsel, Inc.
704-341-8193
www.prainvestment.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
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] Is there a way....

2006-04-26 Thread Pfaff, Bernhard Dr.
Hello Levent,

there has recently been a thread on the ESS list by using setnu in EMACS:

https://stat.ethz.ch/pipermail/ess-help/2006-April/003450.html 


Bernhard

-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Uwe Ligges
Gesendet: Mittwoch, 26. April 2006 13:38
An: Levent TERLEMEZ
Cc: r-help@stat.math.ethz.ch
Betreff: Re: [R] Is there a way

Levent TERLEMEZ wrote:

> Hello,
> 
> I would like to get rid of counting lines in fix() when i made a 
> mistake in coding? Is there an easy way to an line numbers to editor? 

I think the feature you are requesting is not available.
Beside, it is a good idea to use some appropriate editor and source() 
your function rather than using the fix() function.

Uwe Ligges





> Thanks.
> 
> Levent TERLEMEZ.
> 
> __
> 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

__
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
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] What are the differences between ACF and PACF in time seriesanalysis?

2006-04-27 Thread Pfaff, Bernhard Dr.
Hello Michael,

see as an online resource:
http://www.statsoft.com/textbook/sttimser.html or get hold on a time
series analysis textbook, like one of the monographies written by
Hamilton; Luetkepohl; Brockwell & Davis; Harvey or Box & Jenkins, to
name but a few.

In a nutshell, PACF 'eliminates' intermediate autocorrelations compared
to ACF, e.g. an AR(1) process will ordinarily have a slowly decaying ACF
and a single spike in the PACF at lag 1. Both are utilised in the
process of order determination in the context of the Box-Jenkins
approach for time series modelling. 

Best,
Bernhard 

Hi all,

I am desperately looking for answer to my previous question: what are
the
differences between ACF and PACF in time series and their applications?
I
got confused a lot by these two functions in R... Already having ACF,
why do
people decide to create PACF?

Thanks a lot

[[alternative HTML version deleted]]

__
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
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] urppTest Z-tau? Z-alpha?

2006-05-03 Thread Pfaff, Bernhard Dr.
Hello Anne,

you will find the necessary details in the following paper, its
publication in 'Biometrika' is cited in ?ur.pp.

http://cowles.econ.yale.edu/P/cp/p07a/p0706.pdf

Best,
Bernhard

>Hello,
>
>Could someone give me a hint about what might be the 
>difference between running urppTest
>with Z-alpha and Z-tau in type=c("Z-alpha", "Z-tau")? 
>
>Is this the underlying equation:
>delta_y(t) = mu + tau*timetrend+(1-rho)*y(t-1) + 
>alpha_1*delta_y(t-1) + ... +
>alpha_k*delta_y(t-k) + error term ?
>
>I looked at Banerjee et al. mentioned in the fSeries 
>documentation, but that didn't help.
>
>Thanks a lot,
>Katrin
>
>__
>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
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] Net courses for R?

2006-05-03 Thread Pfaff, Bernhard Dr.
Hello Scott,

see:

http://www.statistics.com/content/courses/R/index.html
http://www.statistics.com/content/courses/graphicsR/index.html
http://www.statistics.com/content/courses/modelingR/index.html

there has been a recent posting on this list, if I recall it correctly.

Best,
B.
>-Ursprüngliche Nachricht-
>Von: [EMAIL PROTECTED] 
>[mailto:[EMAIL PROTECTED] Im Auftrag von Scott 
>Cunningham
>Gesendet: Mittwoch, 3. Mai 2006 16:34
>An: r-help@stat.math.ethz.ch
>Betreff: [R] Net courses for R?
>
>Are there any online courses for learning R?
>
>__
>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
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


[R] Link to useR! 2006 from ww.r-project.org not working

2006-05-03 Thread Pfaff, Bernhard Dr.
I noticed that:

http://www.r-project.org/useR-2006/

seems to be inexistent (page not found).

Best,
Bernhard

Dr. Bernhard Pfaff
Global Structured Products Group
(Europe)

Invesco Asset Management Deutschland GmbH
Bleichstrasse 60-62
D-60313 Frankfurt am Main

Tel: +49(0)69 298 07230
Fax: +49(0)69 298 07178
Email: [EMAIL PROTECTED] 
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] How can I test temporal autocorrelation of binary data?

2005-11-01 Thread Pfaff, Bernhard Dr.

Depending on what you are really want to infer from the autocorrelations,
you want to consider the runs-test, too.

HTH,
Bernhard



If you mean you want to test that there is no autocorrelation,
then there is some information on using the Ljung-Box test on
such data in the working paper 'Robustness of the Ljung-Box
test and its rank equivalent' on the Burns Statistics website.

The executive summary is that the test seems to do okay as
long as one of the values is not too dominant.  What 'dominant'
means depends on the length of the series.

If some one has a better answer, I'm keen to hear it.


Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

[EMAIL PROTECTED] wrote:

>Hi,
>
>I have a binary (o/1 - coded) data set and want to test it's
autocorrelation
>structure. Is that function implemented in R?
>Can I use the ACF - funtion with binary data?
>
>Thanks for your help,
>Daniel
>
>__
>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
>
>
>
>  
>

__
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*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
__
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

Re: [R] cointegration rank

2005-11-21 Thread Pfaff, Bernhard Dr.
Dear R - helpers,

I am using the urca package to estimate cointegration relations, and I
would be really grateful if somebody could help me with this questions:

After estimating the unrestriced VAR with "ca.jo" I would like to impose
the rank restriction (for example rank = 1) and then obtain the
restricted estimate of PI to be utilized to estimate the VECM model.

Is it possible? 

It seems to me that the function "cajools" estimates the VECM without
the restrictions. Did I miss something? How is it possible to impose
them?

Thanks a lot in advance!

Carlo


Hello Carlo,

you can achieve this, by calculating your desired PI-matrix by hand, given
the slots 'V' and 'W' of your ca.jo object and then execute a restricted
OLS-estimation, if I understand your goal correctly. 
Please, bear in mind the non-uniqueness of the factorization of the
PI-matrix by doing so.

HTH,
Bernhard


__
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*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
__
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

Re: [R] cointegration rank

2005-11-21 Thread Pfaff, Bernhard Dr.
Thanks a lot!

I have another question on "cointegration", so I will go on this post.

Is it possible to estimate a cointegration with some exogenous
explanatory variables? Since, after testing for exogeneity, I would like
to re-estimate the relation keeping some of the previous endogenous as
exogenous.

Many thanks!

Carlo


Hello Carlo,

you can use the 'dumvar' argument for his purpose, and exclude the relevant
variables from your data matrix 'x'.

HTH,
Bernhard


On Nov 21, 2005 11:21 AM, "Pfaff, Bernhard Dr."
<[EMAIL PROTECTED]> wrote:

> Dear R - helpers,
> 
> I am using the urca package to estimate cointegration relations, and I
> would be really grateful if somebody could help me with this
> questions:
> 
> After estimating the unrestriced VAR with "ca.jo" I would like to
> impose
> the rank restriction (for example rank = 1) and then obtain the
> restricted estimate of PI to be utilized to estimate the VECM model.
> 
> Is it possible? 
> 
> It seems to me that the function "cajools" estimates the VECM without
> the restrictions. Did I miss something? How is it possible to impose
> them?
> 
> Thanks a lot in advance!
> 
> Carlo
> 
> 
> Hello Carlo,
> 
> you can achieve this, by calculating your desired PI-matrix by hand,
> given
> the slots 'V' and 'W' of your ca.jo object and then execute a
> restricted
> OLS-estimation, if I understand your goal correctly. 
> Please, bear in mind the non-uniqueness of the factorization of the
> PI-matrix by doing so.
> 
> HTH,
> Bernhard
> 
> 
> __
> 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*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
__
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

Re: [R] cointegration rank

2005-11-22 Thread Pfaff, Bernhard Dr.
Hello Carlo,

no, this is not possible, per se. In case of a structural break in terms of
a one-time level shift, you might want to consider the function cajolst().
Another possibility would be to run a regression with the dummy-variables
and use the fitted values for your data matrix x. That is, the data is
'pre-filtered' by the impact of the dummy variables.

HTH,
Bernhard


Another question on cointegration...

Is it possible to insert in the model dummy variables restricted in the
cointegration space?

Many thanks,

Carlo


On Nov 21, 2005 01:23 PM, "Pfaff, Bernhard Dr."
<[EMAIL PROTECTED]> wrote:

> Thanks a lot!
> 
> I have another question on "cointegration", so I will go on this post.
> 
> Is it possible to estimate a cointegration with some exogenous
> explanatory variables? Since, after testing for exogeneity, I would
> like
> to re-estimate the relation keeping some of the previous endogenous as
> exogenous.
> 
> Many thanks!
> 
> Carlo
> 
> 
> Hello Carlo,
> 
> you can use the 'dumvar' argument for his purpose, and exclude the
> relevant
> variables from your data matrix 'x'.
> 
> HTH,
> Bernhard
> 
> 
> On Nov 21, 2005 11:21 AM, "Pfaff, Bernhard Dr."
> <[EMAIL PROTECTED]> wrote:
> 
> > Dear R - helpers,
> > 
> > I am using the urca package to estimate cointegration relations, and
> > I
> > would be really grateful if somebody could help me with this
> > questions:
> > 
> > After estimating the unrestriced VAR with "ca.jo" I would like to
> > impose
> > the rank restriction (for example rank = 1) and then obtain the
> > restricted estimate of PI to be utilized to estimate the VECM model.
> > 
> > Is it possible? 
> > 
> > It seems to me that the function "cajools" estimates the VECM
> > without
> > the restrictions. Did I miss something? How is it possible to impose
> > them?
> > 
> > Thanks a lot in advance!
> > 
> > Carlo
> > 
> > 
> > Hello Carlo,
> > 
> > you can achieve this, by calculating your desired PI-matrix by hand,
> > given
> > the slots 'V' and 'W' of your ca.jo object and then execute a
> > restricted
> > OLS-estimation, if I understand your goal correctly. 
> > Please, bear in mind the non-uniqueness of the factorization of the
> > PI-matrix by doing so.
> > 
> > HTH,
> > Bernhard
> > 
> > 
> > __
> > 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*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
__
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

Re: [R] Q about RSQLite

2006-01-03 Thread Pfaff, Bernhard Dr.
Hello Liu,

this might be caused by NA entries in your SQLite table. Have a look at the
following code:


(test <- data.frame(matrix(c(1:10, NA, NA), ncol=2, nrow=6)))
con <- dbConnect(SQLite(), dbname = "test.db")
dbWriteTable(con, "test", test, type="BLOB", overwrite=TRUE)
d1 <- dbReadTable(con, "test")
dbDisconnect(con)
d1


HTH,
Bernhard  

-Ursprüngliche Nachricht-
Von: Wensui Liu [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 31. Dezember 2005 07:09
An: r-help@stat.math.ethz.ch
Betreff: [R] Q about RSQLite

Happy new year, dear listers,

I have a question about Rsqlite.

when I fetch the data out of sqlite database, there is something like '\r\n'
at the end of last column. Here is the example:
   Sepal_Length Sepal_Width Petal_Length Petal_WidthSpecies
1   5.1 3.5  1.4 0.2 setosa\r\n
2   4.9 3.0  1.4 0.2 setosa\r\n
3   4.7 3.2  1.3 0.2 setosa\r\n
4   4.6 3.1  1.5 0.2 setosa\r\n
5   5.0 3.6  1.4 0.2 setosa\r\n
6   5.4 3.9  1.7 0.4 setosa\r\n
7   4.6 3.4  1.4 0.3 setosa\r\n
8   5.0 3.4  1.5 0.2 setosa\r\n
9   4.4 2.9  1.4 0.2 setosa\r\n
10  4.9 3.1  1.5 0.1 setosa\r\n

Any idea?

Thank you so much

[[alternative HTML version deleted]]

__
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
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] Obtaining the adjusted r-square given the regression coef ficients

2006-01-11 Thread Pfaff, Bernhard Dr.
Hello Alexandra,

R2 is only defined for regressions with intercept. See a decent econometrics
textbook for its derivation.

HTH,
Bernhard

-Ursprüngliche Nachricht-
Von: Alexandra R. M. de Almeida [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 11. Januar 2006 03:48
An: r-help@stat.math.ethz.ch
Betreff: [R] Obtaining the adjusted r-square given the regression
coefficients

Dear list
  
I want to obtain the adjusted r-square given a set of coefficients (without
the intercept), and I don't know if there is a function that does it.
Exist
I know that if you make a linear regression, you enter the dataset and have
in "summary" the adjusted r-square. But this is calculated using the
coefficients that R obtained,and I want other coefficients that i calculated
separately and differently (without the intercept term too).
I have made a function based in the equations of the book "Linear Regression
Analisys" (Wiley Series in probability and mathematical statistics), but it
doesn't return values between 0 and 1. What is wrong
The functions is given by:

  
adjustedR2<-function(Y,X,saM) 
{
 if(is.matrix(Y)==F) (Y<-as.matrix(Y))
 if(is.matrix(X)==F) (X<-as.matrix(X))
 if(is.matrix(saM)==F) (saM<-as.matrix(saM))  
 RX<-rent.matrix(X,1)$Rentabilidade.tipo   
 RY<-rent.matrix(Y,1)$Rentabilidade.tipo   
 r2m<-matrix(0,nrow=ncol(Y),ncol=1)   
 RSS<-matrix(0,ncol=ncol(Y),nrow=1)   
 SYY<-matrix(0,ncol=ncol(Y),nrow=1)   
 for (i in 1:ncol(RY))
 {
RSS[,i]<-(t(RY[,i])%*%RY[,i])-(saM[i,]%*%(t(RX)%*%RX)%*%t(saM)[,i])   
SYY[,i]<-sum((RY[,i]-mean(RY[,i]))^2)
r2m[i,]<-1-(RSS[,i]/SYY[,i])*((nrow(RY))/(nrow(RY)-ncol(saM)-1))
 }
 dimnames(r2m)<-list(colnames(Y),c("Adjusted R-square"))  
 return(r2m) 
} 

  

  Thanks!
Alexandra



  Alexandra R. Mendes de Almeida

 



-

[[alternative HTML version deleted]]

__
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
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] R vs. Excel (R-squared)

2006-01-24 Thread Pfaff, Bernhard Dr.
Hello Lance,

this was discussed on the list lately, see:

http://tolstoy.newcastle.edu.au/~rking/R/help/06/01/18934.html 


Bernhard

-Ursprüngliche Nachricht-
Von: Lance Westerhoff [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 24. Januar 2006 17:51
An: r-help@stat.math.ethz.ch
Betreff: [R] R vs. Excel (R-squared)

Hello All-

I found an inconsistency between the R-squared reported in Excel vs.  
that in R, and I am wondering which (if any) may be correct and if  
this is a known issue.  While it certainly wouldn't surprise me if  
Excel is just flat out wrong, I just want to make sure since the R- 
squared reported in R seems surprisingly high.  Please let me know if  
this is the wrong list.  Thanks!

To begin, I have a set of data points in which the y is the  
experimental number and x is the predicted value.  The Excel- 
generated graph (complete with R^2 and trend line) is provided at  
this link if you want to take a look:

http://www.quantumbioinc.com/downloads/public/excel.png

As you can see, the R-squared that is reported by Excel is -0.1005.   
Now when I bring the same data into R, I get an R-square of +0.9331  
(see below).  Being that I am new to R and semi-new to stats, is  
there a difference between "multiple R-squared" and R-squared that  
perhaps I am simply interpreting this wrong, or is this a known  
inconsistency between the two applications?  If so, which is  
correct?  Any insight would be greatly appreciated!


==

 > # note: a is experimental and c is predicted
 > summary(lm(a~c-1))

Call:
lm(formula = a ~ c - 1)

Residuals:
 Min  1Q  Median  3Q Max
-2987.6 -1126.6  -181.7   855.3  5602.8

Coefficients:
   Estimate Std. Error t value Pr(>|t|)
c  0.90.01402   71.33   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1423 on 365 degrees of freedom
Multiple R-Squared: 0.9331, Adjusted R-squared: 0.9329
F-statistic:  5088 on 1 and 365 DF,  p-value: < 2.2e-16

 > version
  _
platform powerpc-apple-darwin7.9.0
arch powerpc
os   darwin7.9.0
system   powerpc, darwin7.9.0
status
major2
minor2.1
year 2005
month12
day  20
svn rev  36812
language R

==


Thank you very much for your time!

-Lance

Lance M. Westerhoff, Ph.D.
General Manager
QuantumBio Inc.

WWW:http://www.quantumbioinc.com
Email:[EMAIL PROTECTED]


"Safety is not the most important thing. I know this sounds like heresy,
but it is a truth that must be embraced in order to do exploration.
The most important thing is to actually go."  ~ James Cameron

__
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
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] reducing learning curves?

2006-01-25 Thread Pfaff, Bernhard Dr.
Hello Michael,

you might want to utilise Emacs/ESS. ESS provides auto-completion by using
 for a process buffer '*R*' and C-c for a source file '*.R'
(ess-mode). 

As far as debugging is concerned, R offers:

?browser
?debug
?trace

for example. Additionally, there is a CRAN package named 'debug' available
and an article in RNews:
Mark Bravington. Debugging without (too many) tears. R News, 3(3):29-32,
December 2003, about it.

HTH,
Bernhard  



-Ursprüngliche Nachricht-
Von: Michael [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 25. Januar 2006 09:10
An: R-help@stat.math.ethz.ch
Betreff: [R] reducing learning curves?

Hi all,

I am really new to the R language. I am a long time Matlab and C++ user and
I was "forced" to learn R because I am taking a statistics class.

I am seeking to reduce the learning curve to as smooth as possible.

Are there any addon/plug-in features that can reduce the learning curve, for
example, the following features can be very helpful for new learners:

1. Matlab-like command line auto-completion: Matlab has huge amount of
command and nobody is able to remember them off the head. So a nice feature
of Matlab command line is that I just need to type the first a few letters
and then I press "TAB" key, there will be a list of possible commands
popping up so I just need to select one. This helps a lot in terms of
learning for new comers. A more advanced command auto-completion is Visual
C++-like, which is implemented in program editor. It helps a lot while doing
programming;

2. A good IDE editor with embedded inline debugger: can be as good as VC++,
but also can be as simple as Matlab's debugger, which can breakpoint and
trace line-by-line... the editor can do syntax correction, syntax check,
syntax highlighting, code formatting, etc.

Could you please recommend some good addon/plugins that have the above
features?

Could you please also suggest some tips/tools/tricks that can help me reduce
the learning curve?

Thank you very much!

Michael.

[[alternative HTML version deleted]]

__
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
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] urca package - summary method -

2007-05-16 Thread Pfaff, Bernhard Dr.
>
>Hi
>
>  I am using the package urca and I am interested about the KPSS test.
>  That works fine except the method "summary" did not work in 
>the script,
>  only when it is typed direct in the console the results are 
>shown( not a
>  source file).

Hello,

which version of urca are using? The problem you mentioned has been
fixed in November  last last year (see R-Help, there is an extensive
thread about the explicit loading of methods as well as the Changelog of
urca:

2006-11-04  Dr. Bernhard Pfaff  <[EMAIL PROTECTED]>

* NAMESPACE: import(methods) inserted
).

I have checked again with:


library(urca)
data(nporg)
gnp <- na.omit(nporg[, "gnp.r"])
gnp.l <- log(gnp)
kpss.gnp <- ur.kpss(gnp.l, type="tau", lags="short")
summary(kpss.gnp)
summary(ur.kpss(gnp.l, type="tau", lags="short"))


and

R CMD BATCH --no-restore kpsstest.R

which runs flawlessly. Hence, a simple update of 'urca' should solve
your problem.

Best,
Bernhard

>
>  Is there any problem with these method ?
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] Combine graphical and textual output

2007-07-02 Thread Pfaff, Bernhard Dr.
Hello Dieter,

aside of Petr's suggestion, you might want to look at the 'relax'
package. Here, you can produce html as well as tex for on-the-fly
reports. The reports are set up within a tcl/tk window.

Best,
Bernhard 

>
>Hi,
>
>I would like to know whether anybody knows a simple way to combine 
>textual and graphical output in R.
>
>A typical analysis produces textual output (e.g. model fits) and plots 
>in R. I would like to know whether R has the possibility of combining 
>these into a single 'report' or output. An example of a program that 
>does this is SPSS. After running the analysis you have a 
>combination of 
>textual output (tables) and plots that are easy to print and 
>distribute.
>
>I know of the possibility to embed R code into LATEX (using 
>Sweave), but 
>I wouldn't call this quick since a lot of coding will go into writing 
>the Sweave file.
>
>Any other suggestions?
>
>Regards,
>Dieter
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] ca.jo

2007-07-10 Thread Pfaff, Bernhard Dr.
Hello Yihsu,

have a look at ?cajorls. With this function a VECM is estimated, whence
the cointegration rank has been determined (ca.jo). For further
analysis, you might want to consider the function vec2var in package
vars and methods irf, fevd and predict, as well as the diagnostic tests
that are available in vars.

Best,
Bernhard

>
>Dear R users;
>
>I'm using ca.jo for a VECM model.  Is there a way that I can 
>get sd/p-value
>to see whether coefficients estimated are statistical 
>significant?   Thank
>you
>
>Yours,
>
>Yihsu
>
>   [[alternative HTML version deleted]]
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] extract p-value from urppTest

2006-05-08 Thread Pfaff, Bernhard Dr.
Hello Anne,

the function 'ur.pp' contained in the package 'urca' has been ported
into the package 'fSeries' (see the documentaion of ?urppTest). 
help("ur.pp-class", package="urca") will tell you that p-values are not
part of this class, i.e., these are not computed but critical values are
returned.
Now, inside of the function 'urppTest', 'ur.pp' is called and an object
of class 'fHTEST' is returned (you can see this, by simply typing
'urppTest'). The class 'fHTEST' does contain the slot 'test' (it is a
list). You can see this by spotting at getClass("fHTEST"). However, what
is stored into test is the outcome of 'show(your ur.pp-object)', i.e.
the print-out of the test statistic.
In contrast, by typing 'adfTest' you will easily see, that the p-values
are calculated within this function and are part of the slot 'test'.

Best,
Bernhard


>Dear List,
>
>How do I pick the p-value out of the urppTest result?
>
>For adfTest the p-value can be extracted by
>
>  [EMAIL PROTECTED]
>
>following
>
>  A2 <- adfTest(myData[,i], lags=2, type=c("c"))
>
>What do I do for urppTest? The above doesn't seem to work. 
>There is a slot @test with
>$output, which is a list of various test results that didn't 
>want to give away only the
>p-value (I'm fairly new to R, so this might well be my fault). 
>
>I thought I had found a way around this by
>
> # dissolve testresult into lines
>   listasvectors <- unlist([EMAIL PROTECTED])
>
> # pick the line containing p-value
>  getpvalue <- unlist(strsplit(listasvectors[17], " "))
>
> # isolate the p-value (number only)
>   getpvalue[14]
>
>However, I'm doing this in a loop and it seems for each test 
>result there is a different
>number of entries or seperators " ". For example, "<" 
>sometimes ends up being displayed as
>the p-value.
>
>I'd be very happy about any help on how to extract the p-value.
>
>Thanks,
>Katrin
>
>__
>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
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] Cointegration Test in R

2006-06-30 Thread Pfaff, Bernhard Dr.
Hello Dennis,

have you considered the function bh6lrtest() in the package urca? 
To my knowledge, there is no other package available that offers VECM 
functionalities. 

Best,
Bernhard

ps: As you migth be interested in VAR and SVAR too: I am currently working on 
such a package which should be submitted to CRAN after summer. 

Dr. Bernhard Pfaff
Global Structured Products Group
(Europe)

Invesco Asset Management Deutschland GmbH
Bleichstrasse 60-62
D-60313 Frankfurt am Main

Tel: +49(0)69 29807 230
Fax: +49(0)69 29807 178
Email: [EMAIL PROTECTED]  

>-Ursprüngliche Nachricht-
>Von: [EMAIL PROTECTED] 
>[mailto:[EMAIL PROTECTED] Im Auftrag von 
>Dennis Heidemann
>Gesendet: Donnerstag, 29. Juni 2006 21:20
>An: R-help@stat.math.ethz.ch
>Betreff: [R] Cointegration Test in R
>
>Hello!
>
>I'm using the blrtest() function in the urca package
>to test cointegration relationships.
>Unfortunately, the hypothesis (restrictions on beta) 
>specifies the same restriction on all cointegration vectors.
>Is there any possibility to specify different restrictions on
>the cointegration vectors?
>Are there any other packages in R using cointegration tests?
>
>Thanks and best regards.
>Dennis Heidemann
>   [[alternative HTML version deleted]]
>
>__
>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
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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


Re: [R] KPSS test

2006-07-07 Thread Pfaff, Bernhard Dr.
Hello Sachin,

a sequential testing procedure is described in the useR! book:

  @Book{,
title = {Analysis of Integrated and Cointegrated Time Series with R},
author = {B. Pfaff},
publisher = {Springer},
edition = {First},
address = {New York},
year = {2006},
note = {ISBN 0-387-27960-1},
  }

Best,
Bernhard


Dr. Bernhard Pfaff
Global Structured Products Group
(Europe)

Invesco Asset Management Deutschland GmbH
Bleichstrasse 60-62
D-60313 Frankfurt am Main

Tel: +49(0)69 29807 230
Fax: +49(0)69 29807 178
Email: [EMAIL PROTECTED]  

>-Ursprüngliche Nachricht-
>Von: [EMAIL PROTECTED] 
>[mailto:[EMAIL PROTECTED] Im Auftrag von Sachin J
>Gesendet: Donnerstag, 6. Juli 2006 21:49
>An: [EMAIL PROTECTED]
>Cc: r-help@stat.math.ethz.ch
>Betreff: Re: [R] KPSS test
>
>Hi Mark,
>   
>  Thanx for the help. I will verify my results with PP and DF 
>test. Also as suggested I will take a look at the references 
>pointed out. One small doubt: How do I decide what terms ( 
>trend, constant, seasonality ) to include while using these 
>stationarity tests. Any references would be of great help. 
>   
>  Thanx,
>  Sachin
>   
>  
>
>[EMAIL PROTECTED] wrote:
>  >From: 
>>Date: Thu Jul 06 14:17:25 CDT 2006
>>To: Sachin J 
>>Subject: Re: [R] KPSS test
>
>sachin : i think your interpretations are right given the data
>but kpss is quite a different test than the usual tests
>because it assumes that the null is stationarity while dickey 
>fuller ( DF ) and phillips perron ( PP ) ) assume that the 
>null is a unit root. therefore, you should check whetheer
>the conclusions you get from kpss are consistent with what you 
>would get from DF or PP. the results often are not consistent.
>
>also, DF depends on what terms ( trend, constant ) 
>you used in your estimation of the model. i'm not sure if kpss 
>does also. people generally report Dickey fuller results but they
>are a little biased towards acepting unit root ( lower
>power ) so maybe that's why
>you are using KPSS ? Eric Zivot has a nice explanation
>of a lot of the of the stationarity tests in his S+Finmetrics 
>book.
>
>testing for cyclical variation is pretty complex because
>that's basically the same as testing for seasonality.
>check ord's or ender's book for relatively simple ways of doing that.
>
>
>
>
>
>
>
>
>
>
>
>
>>
>>>From: Sachin J 
>>>Date: Thu Jul 06 14:17:25 CDT 2006
>>>To: R-help@stat.math.ethz.ch
>>>Subject: [R] KPSS test
>>
>>>Hi,
>>> 
>>> Am I interpreting the results properly? Are my conclusions correct?
>>> 
>>> > KPSS.test(df)
>>>  
>>> KPSS test
>>>  
>>> Null hypotheses: Level stationarity and stationarity around 
>a linear trend.
>>> Alternative hypothesis: Unit root.
>>>
>>> Statistic for the null hypothesis of 
>>> level stationarity: 1.089 
>>> Critical values:
>>> 0.10 0.05 0.025 0.01
>>> 0.347 0.463 0.574 0.739
>>>
>>> Statistic for the null hypothesis of 
>>> trend stationarity: 0.13 
>>> Critical values:
>>> 0.10 0.05 0.025 0.01
>>> 0.119 0.146 0.176 0.216
>>>
>>> Lag truncation parameter: 1 
>>> 
>>>CONCLUSION: Reject Ho at 0.05 sig level - Level Stationary
>>> Fail to reject Ho at 0.05 sig level - Trend Stationary 
>>> 
 kpss.test(df,null = c("Trend"))
>>> KPSS Test for Trend Stationarity
>>> data: tsdata[, 6] 
>>>KPSS Trend = 0.1298, Truncation lag parameter = 1, p-value = 0.07999
>>> 
>>> CONCLUSION: Fail to reject Ho - Trend Stationary as p-value 
>< sig. level (0.05)
>>> 
 kpss.test(df,null = c("Level"))
>>> KPSS Test for Level Stationarity
>>> data: tsdata[, 6] 
>>>KPSS Level = 1.0891, Truncation lag parameter = 1, p-value = 0.01
>>> Warning message:
>>>p-value smaller than printed p-value in: kpss.test(tsdata[, 
>6], null = c("Level")) 
>>> 
>>> CONCLUSION: Reject Ho - Level Stationary as p-value > sig. 
>level (0.05)
>>> 
>>> Following is my data set
>>> 
>>> structure(c(11.08, 7.08, 7.08, 6.08, 6.08, 6.08, 23.08, 32.08, 
>>>8.08, 11.08, 6.08, 13.08, 13.83, 16.83, 19.83, 8.83, 20.83, 17.83, 
>>>9.83, 20.83, 10.83, 12.83, 15.83, 11.83), .Tsp = c(2004, 
>2005.917, 
>>>12), class = "ts")
>>>
>>> Also how do I test this time series for cyclical varitions? 
>>> 
>>> Thanks in advance.
>>> 
>>> Sachin
>>>
>>> 
>>>-
>>>
>>> [[alternative HTML version deleted]]
>>>
>>>__
>>>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
>
>
>
>   
>-
>
>
>   [[alternative HTML version deleted]]
>
>__
>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
>
*
Confidentiality Note: The information contained in this mess...{{dropp

Re: [R] solution to a regression with multiple independent variable

2006-11-06 Thread Pfaff, Bernhard Dr.
Hello John,

you can derive these estimators by considering a step-wise approach:

1) Derive the estimators by evaluating a model with demeaned variables,
i.e.
consider (\tilde{X}'\tilde{x})^-1 \tilde{x}'\tilde{y}, where \tilde{...}
refers to the demeaned variables.
2) Obtain the estimate of the intercept, by utilising the
"Schwerpunkteigenschaft" of the OLS estimator.


HTH,
Bernhard


>Please forgive a statistics question.
>I know that a simple bivariate linear regression, y=f(x) or in R
>parlance lm(y~x) can be solved using the variance-covariance matrix:
>beta(x)=covariance(x,y)/variance(x). I also know that a linear
>regression with multiple independent variables, for example  y=f(x,z)
>can also be solved using the variance-covariance matrix, but I don't
>know how to do this. Can someone help me go from the 
>variance-covariance
>matrix to the solution of a regression with multiple independent
>variables? It is not clear how one applies the matrix solution b=
>(x'x)-1*x'y to the elements of the variance-covariance matrix, i.e. how
>one gets the required values from the variance-covariance matrix.
>Any help, or suggestions would be appreciated.
>
>Thanks,
>John
>
>John Sorkin M.D., Ph.D.
>Chief, Biostatistics and Informatics
>Baltimore VA Medical Center GRECC,
>University of Maryland School of Medicine Claude D. Pepper OAIC,
>University of Maryland Clinical Nutrition Research Unit, and
>Baltimore VA Center Stroke of Excellence
>
>University of Maryland School of Medicine
>Division of Gerontology
>Baltimore VA Medical Center
>10 North Greene Street
>GRECC (BT/18/GR)
>Baltimore, MD 21201-1524
>
>(Phone) 410-605-7119
>(Fax) 410-605-7913 (Please call phone number above prior to faxing)
>[EMAIL PROTECTED]
>
>Confidentiality Statement:
>This email message, including any attachments, is for the 
>so...{{dropped}}
>
>__
>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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] Error message using normality test in vars

2006-12-29 Thread Pfaff, Bernhard Dr.
>
>I'm running a vector-time series model with the vars package.  When I 
>test the univariate and multivariate normality of the residuals using 
>normality(), I get the results, but also this warning
>
>Warning messages:
>1: longer object length
> is not a multiple of shorter object length in: b2 - rep(3, 4)
>2: longer object length
> is not a multiple of shorter object length in: b2 - rep(3, 4)
>
>
>What does this mean and do I need to worry about it.
>

Dear David,

thanks for pointing this out. The warning is caused in the calculation
of the kurtosis in function .jb.multi which is contained in
R/internal.R. The relevant expression should be 'rep(3, K)'. An updated
version of package 'vars' will be submitted in due course. I will ship
you version of the corrected package off list.

Best,
Bernhard
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] problem in adf command

2007-01-19 Thread Pfaff, Bernhard Dr.
>that is, equation with constant and trend is used.if i did not include 
>
>constant or trend in the equation and run the
>
>command then how i can run this command in tseries.
>
> 
Dear Zahid,

you can employ ur.df() in package 'urca' or the wrapped functions from
'urca' contained in package 'fSeries', see ?ur.df and ?UnitrootTests for
more information, respectively.

Best,
Bernhard
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] problem in adf command

2007-01-19 Thread Pfaff, Bernhard Dr.
ur.df(y, type = c("none", "drift", "trend"), lags = 1) 

 in urca.
this gives me all out put .but i need only p.value fromm the
output.

when i run the following command 
ur.df(y, type = c("none", "drift", "trend"), lags =
 1)$p.value 
this in response null.kindly help me in this regard. thanks
With  Best Regards


Hello Zahid,
 
you do not need to send your message three times to the list. As
the package's documentation outlines: 'urca' utilises formal classes
(i.e. S4). Hence, to obtain slots, you should use '@' and not '$'.
Anyway, who is telling you, that p.value is a slot of a returned ur.df
object? At least not ?ur.df. Now, if you take a look at ?UnitrootTests
in package 'fSeries' you will read that these test implementation do
contain p.values, hence:
 
library(urca)
library(fSeries)
## to generate some data use the example
example(UnitrootTests)
test.adf <- adfTest(y, type = 'c')
slotNames(test.adf)
names([EMAIL PROTECTED])
[EMAIL PROTECTED]

 
Best,
Bernhard
 
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] Finding the Min.

2007-01-30 Thread Pfaff, Bernhard Dr.
?which.min

>
>Dear all R users,
>   
>  Suppose I have a dataset like that, data = 
>   
>  1 1.957759e-09
>2 1.963619e-09
>3 1.962807e-09
>4 1.973951e-09
>5 1.983401e-09
>6 1.990894e-09
>7 2.000935e-09
>8 1.998391e-09
>9 1.973322e-09
>   10 1.983202e-09
>   
>  I want to see at which row minimum value of the second 
>column occures.
>   
>  Therefore I made the following loop:
>   
>  i=1
>  while (min(data[,2]) != data[i,2]) 
> {
>  i = i+1
> }
>  
>  > i
>[1] 1
>
>  Is there any more effective way to do that in terms of time 
>consumption?
>   
>  Thanks
>  stat
>
>   
>-
> Here's a new way to find what you're looking for - Yahoo! Answers 
>   [[alternative HTML version deleted]]
>
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.


Re: [R] time series analysis

2007-02-02 Thread Pfaff, Bernhard Dr.
Hello John,

as a starting point you might also want to have a look at:

@book{BOOK,
author={Robert S Pindyck and Daniel L Rubinfeld},
title={Econometric Models and Economic Forecasts},
year={1997},
publisher={McGraw-Hill/Irwin},
isbn={0079132928}
}

The monographies of Hamilton and Lütkepohl might then be taken into focus.

Best,
Bernhard 

>John --
>
>Well, as a start, have a look at "Modern Applied Statistics with S," by
>Venables and Ripley, both of which names you will recognize if you read
>this list often.  There is a 30-page chapter on time series (with
>suggestions for other readings), obviously geared to S and R, that is a
>good jumping-off place.
>
>Ben Fairbank
>
>
>-Original Message-
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of lamack lamack
>Sent: Thursday, February 01, 2007 3:12 PM
>To: R-help@stat.math.ethz.ch
>Subject: [R] time series analysis
>
>Does anyone know a good introductory book or tutorial about 
>time series 
>analysis? (time
>series for a beginner).
>
>Thank you so much.
>
>John Lamak
>
>_
>Descubra como mandar Torpedos SMS do seu Messenger para o celular dos
>seus 
>amigos. http://mobile.msn.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.
>
*
Confidentiality Note: The information contained in this mess...{{dropped}}

__
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.