[R] write a table to file with unequal length of lists

2006-09-01 Thread Zhu Wang
Dear R helpers,

To illustrate my problem, here is a simplified example. I want to write 
a table to a file similar to:
x  a
1  4,5
2  8,9,10

Note the length of elements of a is 2 and 3 respectively.  This can be 
created by, for example,
x - c(1,2)
a - NULL
a[1] - list(c(4,5))
a[2] - list(c(8,9,10)

Any suggestions to write such a table to file would be appreciated.

Thanks,

Zhu Wang

__
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] write a table to file with unequal length of lists

2006-09-01 Thread Zhu Wang
Yes, the code does the job. Thanks, Zhu Wang

Rolf Turner wrote:
 What about

x - 1:2
a - list(c(4,5),c(8,9,10)) # Which is the way you *should*
   # have constructed a!
ddd - data.frame(x=x,a=I(unlist(lapply(a,paste,collapse=,
write.table(ddd,file=ddd.out,quote=FALSE,row.names=FALSE)

   cheers,

   Rolf Turner
   [EMAIL PROTECTED]

 Original message:

   
 Dear R helpers,

 To illustrate my problem, here is a simplified example. I want to write 
 a table to a file similar to:
 x  a
 1  4,5
 2  8,9,10

 Note the length of elements of a is 2 and 3 respectively.  This can be 
 created by, for example,
 x - c(1,2)
 a - NULL
 a[1] - list(c(4,5))
 a[2] - list(c(8,9,10)

 Any suggestions to write such a table to file would be appreciated.

 Thanks,

 Zhu Wang

__
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] write a table to file with unequal length of lists

2006-09-01 Thread Zhu Wang
Apparently I missed cat. Thanks. Zhu Wang

Gabor Grothendieck wrote:
 A simple for loop would do it:

 x - 1:2; a - list(4:5, 8:10) # test data

 cat(x a\n, file = ) # only if you want a header
 for(i in seq(along = x)) cat(x[i], a[[i]], \n, file = )


 On 9/1/06, Zhu Wang [EMAIL PROTECTED] wrote:
 Dear R helpers,

 To illustrate my problem, here is a simplified example. I want to write
 a table to a file similar to:
 x  a
 1  4,5
 2  8,9,10

 Note the length of elements of a is 2 and 3 respectively.  This can be
 created by, for example,
 x - c(1,2)
 a - NULL
 a[1] - list(c(4,5))
 a[2] - list(c(8,9,10)

 Any suggestions to write such a table to file would be appreciated.

 Thanks,

 Zhu Wang

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with Fortran 95 code in R

2006-06-15 Thread Zhu Wang
Dear helpers:

I am trying to call some Fortran 95 code with R-2.3.0 but had problem as 
below. Any pointers would be appreciated. Thanks, Zhu Wang

On Linux,
R CMD SHLIB rfh.f
R
 dyn.load(rfh.so)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
   unable to load shared library '/home/zwang/rf/rfh.so':
 /home/zwang/rf/rfh.so: undefined symbol: _gfortran_allocate

On Unix,
R CMD SHLIB rfh.f
R
 dyn.load(rfh.so)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
   unable to load shared library '/home/zwang/rf/rfh.so':
 ld.so.1: /usr/local/R-2.3.0/lib/R/bin/exec/R: fatal: relocation error: 
file /home/zwang/rf/rfh.so: symbol __f90_allocate2: referenced symbol 
not found

__
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] dependencies ERROR during R CMD check

2006-06-03 Thread Zhu Wang
Dear all,

I was trying to build my own R package cts on LINUX but got the following
checking package dependencies error and a warning message. What were wrong?

Thanks,

Zhu  

# R CMD check cts
* checking for working latex ... OK
* using log directory '/home/zwang/R/pkg/cts.Rcheck'
* using Version 2.3.0 (2006-04-24)
* checking for file 'cts/DESCRIPTION' ... OK
* this is package 'cts' version '0.1-3'
* checking package dependencies ... ERROR
Warning message:
no package 'the_name_of_the_package' was found in: packageDescription(p, lib =
lib, fields = pkgFlds, encoding = NA)

The DESCRIPTION file looks like the following:

Package: cts
Title: Not shown
Version: 0.1-3
Author: Name not shown
Maintainer: Zhu
Depends: R (= 2.3.0)
Description: Not shown 
License: GPL version 2 or newer (see file COPYING)
Packaged: Mon Jun 3 11:24:42 2006

__
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] GEE in Fortran

2005-11-16 Thread Zhu Wang
Dear all,

Does anybody happen to have written some GEE source code in Fortran to 
solve a Generalized Estimation Equation Model? Or kindly point out me a 
good starting point. Thanks.

 Zhu Wang
 SCHARP

__
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] Re: help in R calling C function (Lei Liu)

2004-06-27 Thread Zhu Wang

 Message: 4
 Date: Sun, 27 Jun 2004 03:18:43 -0400
 From: Lei Liu [EMAIL PROTECTED]
 Subject: [R] help in R calling C function
 To: [EMAIL PROTECTED]
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=us-ascii; format=flowed
 
 Hi there,
 
 I want to call a C function in R. I have some experience on it, but this 
 time I need to call another C function in the main C function. As a 
 simple example, I use the following C code:
 
 #include stdio.h
 #include math.h
 #include stdlib.h
 #include time.h
 
 
 void main(double *alpha)
 {
   double test();
   double beta;
   beta= *alpha *2 + test(*alpha);
 }
 
 double test(double *alpha)
 {
   double value;
   value = *alpha *3;
   return(value);
 }
 
 I used gcc -c main.c and Rcmd SHLIB main.o and I got the main.dll file. 
 In R I use the following code to call the C function main:

I do not have too much experience using C, but do you need to compile
your test.c as well, something like

gcc -c main.c test.c

 dyn.load(c:/Program Files/R/rw1060/bin/main.dll)

I also suggest you to double check the path is correct.
 a=4.2
 b=.C('main', as.double(a))

Here you probably mean

a - 4.2
b - .C('main',as.double(a))

 But the R system crashed. I know I can only define the function type in C 
 as void to be called by R. But what if I want to call another C function 
 in the main C function? Thank you for your help!
 
 Sincerely,
 
 Lei Liu
 
 
 

-- 
Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332

__
[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] Building package on Windows: No rule to make target '-llapack'

2004-06-10 Thread Zhu Wang
On Thu, 2004-06-10 at 06:40, Prof Brian Ripley wrote:
 On Wed, 9 Jun 2004, Zhu Wang wrote:
 
  I have a problem to build a package on Windows XP while there is no
  problem on Linux. The Makefile is something like:
 
 There would be a problem on Linux, if that Makefile were used.  I suspect
 it is not used.

Believe or not, it works.

  ###
  LIBNAME=cts
  
  PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
 
 (You should not need $(FLIBS) here.)
 
  OBJS=file1.o ... file20.o -llapack -lblas
 
 The last two are not objects, and -llapack refers to something like 
 liblapack.a.  I don't see how this can work anywhere.  On the other hand, 
 you have lapack and blas selected in PKG_LIBS, but you are not using that 
 macro.

I did this because I did not find good examples about how to link Lapack
and Blas using R. So I tried this and it works.

  $(LIBNAME)$(SHLIB_EXT): $(OBJS)
  $(SHLIB_LD) $(SHLIB_LDFLAGS) -o $@ $(OBJS) $(FLIBS)
  
  clean:
  @rm -f *.o *.$(SHLIB_EXT)
  
  realclean: clean
  #
  
  To build the package on Windows XP, I have followed the instructions to
  install tools/software required and it seems the 'make' worked fine,
  except for the error message:
  
  make[3]: No rule to make target 'llapack', needed by 'cts.a'. stop.
  
  Now I think maybe two problems: one is that maybe I do not have Lapack and Blas 
  installed
  on Windows XP and second is that I do not set up a correct file, something like 
  'configure'.
  Maybe there are more problems. I have read some files in \src\gnuwin32, but I did 
  not find
  what I needed.
 
 What are you actually trying to do?  It is not normal for a package to
 have a Makefile in its src directory, which is what I guess (but only
 guess) you have presented.  All that is normally needed is a Makevars
 file.  Take a look at e.g. that in mclust.

I did find an R package which uses Makefile in its src directory, and I
just happened to be familiar with. But it was on the author's website
and not on CRAN. Maybe that's a bad example. I will take a look at that
in mclust.

 Is this your package or someone else's (in which case why are you not
 asking the author)?  Either you or that author needs to read `Writing R 
 Extensions' and look at some of the many examples in CRAN packages.

This is mine. I agree with you. Certainly there are more stuff I need to
know about 'Writing R Extensions'. The package is on my website, see
below. Using the following:

#R CMD check cts
#R CMD INSTALL cts

I have successfully installed the package. Thanks for your advice. On
the other hand, it might be a successful story how R is robust!

-- 
Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332
Phone:(214)768-2453  Fax:(214)768-4035
[EMAIL PROTECTED]
http://people.smu.edu/zhuw

__
[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] Building package on Windows: No rule to make target '-llapack'

2004-06-09 Thread Zhu Wang
Dear all,

I have a problem to build a package on Windows XP while there is no problem on Linux. 
The Makefile is something like:
###
LIBNAME=cts

PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

OBJS=file1.o ... file20.o -llapack -lblas

$(LIBNAME)$(SHLIB_EXT): $(OBJS)
$(SHLIB_LD) $(SHLIB_LDFLAGS) -o $@ $(OBJS) $(FLIBS)

clean:
@rm -f *.o *.$(SHLIB_EXT)

realclean: clean
#

To build the package on Windows XP, I have followed the instructions to install 
tools/software required and it seems the 
'make' worked fine, except for the error message:

make[3]: No rule to make target 'llapack', needed by 'cts.a'. stop.

Now I think maybe two problems: one is that maybe I do not have Lapack and Blas 
installed
on Windows XP and second is that I do not set up a correct file, something like 
'configure'.
Maybe there are more problems. I have read some files in \src\gnuwin32, but I did not 
find
what I needed.

Thanks for any advice.

Zhu Wang

Statistical Science Department
Southern Methodist University

__
[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] Question about building library and BLAS

2004-05-31 Thread Zhu Wang
Dear helpers,

I am trying to create a library which uses some Fortran source files and Lapack and 
Blas
subroutines. The Fortran source files from the original author contain subroutines 
isamax.f, sgefa.f and sgesl.f, which are part of BLAS subroutines on my Linux computer,
but maybe different (old) versions. So in addition to these subroutines, there are 
other
Lapack and Blas subroutines involved. There is no problem to compile and run these 
files
using g77, such as the following to create car:

g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 car
isamax.f, sgefa.f sgesl.f foo1.f ... foo20.f -llapack -lblas

By doing this, the procedure does not use subroutines isamax.f, sgefa.f sgesl.f in 
BLAS,
as expected. In fact, there are problems to use these subroutines in BLAS, for some 
reason.

Now what I want is to build an R library. The Makefile is the following:

LIBNAME=car
 
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
 
OBJS=isamax.o saxpy.o sscal.o foo1.o ... foo20.o -llapack -lblas

$(LIBNAME)$(SHLIB_EXT): $(OBJS)
$(SHLIB_LD) $(SHLIB_LDFLAGS) -o $@ $(OBJS) $(FLIBS)
 
clean:
@rm -f *.o *.$(SHLIB_EXT)
 
realclean: clean

Some compiling outputs are the following:

g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c isamax.f
-o isamax.o
...
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c foo1.f -o
foo1.o
..
gcc -shared -o car.so isamax.o .. foo20.o -llapack -lblas
-L/usr/local/lib -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2
-L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../.. -lfrtbegin -lg2c
-lm -lgcc_s

However, it turns out that this process did not take into account these 
three files isamax, sgefa.f and sgesl.f. 
Instead, it used subroutines in Blas, but again for some reason, it provided
error. 

My question is how do I set up my Makefile, or maybe other files, such that I have
the same result as I did to compile and run these Fortran files directly.

Thanks in advance.

-- 
Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332
Phone:(214)768-2453  Fax:(214)768-4035
[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


Re: [R] Question about building library and BLAS

2004-05-31 Thread Zhu Wang
On Mon, 2004-05-31 at 11:39, Douglas Bates wrote:

 I should have read your message more carefully.  Those three Fortran
 routines that you mention are single precision and it would be silly
 to use them on modern computers.  R only provides single precision
 floating point for compatibility.  All numerical linear algebra is
 doing in double precision.  Check where sgefa and sgesl are being
 called and see if they really need to be in single precision.  I'm
 sure if you replace them by calls to dgefa and dgesl (and suitably
 change the precision of the arguments) they will run as fast as
 before. 

Thanks. I have replaced sgefa and sgesl with dgefa and dgesl. The
results are confirmed by running the compiled Fortran code. I will
convey this to the original author.

  In fact you can probably use the Lapack routines dgetrf and
 dgetrs instead and get a performance boost.

I will try to improve later.

-- 
Zhu Wang

__
[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] Problem: creating shared objects using lapack and blas

2004-05-28 Thread Zhu Wang
I am having trouble with creating shared objects with Fortran files,
which use numerical libraries Lapack and Blas. I have read the section
in Writing R Extensions but could not find what I needed and I am not
at the stage to create a library.

What I did was 

$R CMD SHLIB --output=car file1.f file2.f ... file50.f -llapack -lblas

No error message so far,

But

$dyn.load(./car)
Error in dyn.load(x, as.logical(local), as.logical(now)) : 
unable to load shared library /home/zwang/R/pkg/car/src/./car:
  /home/zwang/R/pkg/car/src/./car: undefined symbol: slamch_

I think the way I used to link Lapack and Blas was not correct, even
though it worked fine when I used for running Fortran code before.

Thanks for any advice.

Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332

__
[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] Re: Problem: creating shared objects using lapack and blas

2004-05-28 Thread Zhu Wang
To solve my own problem, it seems better to follow instructions in
Writing R Extensions to build a library. I am making progress.

Thanks,

Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332

On Fri, 2004-05-28 at 13:11, Zhu Wang wrote:
 I am having trouble with creating shared objects with Fortran files,
 which use numerical libraries Lapack and Blas. I have read the section
 in Writing R Extensions but could not find what I needed and I am not
 at the stage to create a library.
 
 What I did was 
 
 $R CMD SHLIB --output=car file1.f file2.f ... file50.f -llapack -lblas
 
 No error message so far,
 
 But
 
 $dyn.load(./car)
 Error in dyn.load(x, as.logical(local), as.logical(now)) : 
   unable to load shared library /home/zwang/R/pkg/car/src/./car:
   /home/zwang/R/pkg/car/src/./car: undefined symbol: slamch_
 
 I think the way I used to link Lapack and Blas was not correct, even
 though it worked fine when I used for running Fortran code before.
 
 Thanks for any advice.
 
 Zhu Wang
 
 Statistical Science Department
 Southern Methodist University
 Dallas, TX 75275-0332
--

__
[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] missing values for mda package

2004-04-09 Thread zhu wang
Thanks. I was able to use na.omit to remove NAs. But it seems to me this
kills one of the advantages of the original algorithm for handling
missing values.

On Tue, 2004-04-06 at 11:54, Uwe Ligges wrote:
 zhu wang wrote:
  
  Dear helpers,
  
  I am trying to use the mda package downloaded from the R website, but
  the data set has missing values so I got an error message. Should I
  manually handle these missing values? I was trying to read the documents
  to specify any option related to missing values, but I did not find it.
  Please forgive me if I ignore something obvious.
 
 If it is not documented (hence probably not available) and you don't
 know how to tell the functions to handle missing values, try to do it
 yourself. ?NA suggests:
 See Also: [...] 'na.action', 'na.omit', 'na.fail' on how methods can be
 tuned to deal with missing values.
 
 Uwe Ligges
 
 
 
  Thanks,
  
  Zhu Wang
  
  Statistical Science Department
  Southern Methodist University
  Dallas, TX 75275-0332
  Phone: (214)768-2453
  Fax: (214)768-4035
  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
-- 
Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332
Phone: (214)768-2453
Fax: (214)768-4035
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


[R] missing values for mda package

2004-04-06 Thread zhu wang
Dear helpers,

I am trying to use the mda package downloaded from the R website, but
the data set has missing values so I got an error message. Should I
manually handle these missing values? I was trying to read the documents
to specify any option related to missing values, but I did not find it.
Please forgive me if I ignore something obvious.

Thanks,

Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332
Phone: (214)768-2453
Fax: (214)768-4035
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


[R] butterworth filter code?

2004-02-21 Thread zhu wang
Hello,

Does anybody have butterworth filter code in R?

Thanks,

-- 
Zhu Wang

Statistical Science Department
Southern Methodist University
Dallas, TX 75275-0332
Phone: (214)768-2453
Fax: (214)768-4035
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


[R] Re: generic algorithm

2003-10-23 Thread zhu wang
Sorry, it is my bad. 

I mean genetic algorithm. It seems genoud {rgenoud} is the one I am
looking for.

On Thu, 2003-10-23 at 09:51, zhu wang wrote:
 Dear all,
 
 Is there any generic algorithm code for optimization implemented in R? I
 searched without success.
 
 Thanks,
-- 
Zhu Wang

Statistical Science Department
Southern Methodist University
Phone: (214)768-2453
Fax: (214)768-4035
Email: [EMAIL PROTECTED]

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


[R] carma (package growth)

2003-09-03 Thread zhu wang
Dear helpers,

I am wondering if I can use the growth package to fit continuous ARMA
time series. To be specific,

y - arima.sim(model=list(ar=c(1.7,-0.8)),n=100)

How do I use carma to fit y if possible? The package is for longitudinal
data but I suspect I can use it for my problem. I looked at the help
file without success.

Thanks for any ideas.


-- 
Zhu Wang

Statistical Science Department
Southern Methodist University
Phone: (214)768-2453
Fax: (214)768-4035
Email: [EMAIL PROTECTED]

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


[R] Rwave cgt plot time axis problem

2003-08-04 Thread zhu wang
Dear helpers,

When I use the function cgt of library Rwave, the time axis of the plot 
is always on the [0,1] scale regardless of the original time. This 
happedn when I tried to reproduce some pictures of Practical 
Time-Frequency Analysis, e.g. Figure 3.5 and 3.6 using the codes 
provided in the book. But the figures of the book display the real 
sampling time using the same codes. It seems there is no argument for 
the time scale for 'cgt'. Is this a bug or my misunderstanding?

Hope somebody can help me.

Thanks,

Zhu Wang

Statistical Science Department
Southern Methodist University
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] What's wrong with ar for my data?

2003-06-19 Thread zhu wang
Thanks.


On Thu, 2003-06-19 at 01:52, Prof Brian Ripley wrote:
 You are apparently fitting a series for which the selected order is zero,
 and ar.burg is not designed to cope with that (and would in any case tell 
 you nothing useful).  The default method does cope, from your output.
 
 Why are you fitting an AR model to a series with apparently no 
 correlation?
 

The data are from simulation. Thanks for pointing out to me no
correlation. 

 On 19 Jun 2003, zhu wang wrote:
 
  Dear helpers,
  
  When I use ar to fit the data with length 180, I have the following
  error:
  
  ar(x,method=burg)
  Error in acf(x, type = covariance,lag.max=order,plot=FALSE):
   lag.max must be at least 1
  
  If I use 
  
  ar(x), then I have
  
  Call (x=x)
 
 [I very much doubt that is what you get.]
 
  
  
  order selected 0 sigma^2 estimated as 5374
  
  Obviously I missed some points for using ar. 
  This is R 1.7.0 under Redhat Linux 9.0
-- 
zhu wang [EMAIL PROTECTED]

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


[R] What's wrong with ar for my data?

2003-06-18 Thread zhu wang
Dear helpers,

When I use ar to fit the data with length 180, I have the following
error:

ar(x,method=burg)
Error in acf(x, type = covariance,lag.max=order,plot=FALSE):
 lag.max must be at least 1

If I use 

ar(x), then I have

Call (x=x)


order selected 0 sigma^2 estimated as 5374

Obviously I missed some points for using ar. 
This is R 1.7.0 under Redhat Linux 9.0
Thanks in advance.

Zhu Wang
Statistical Science Department
Southern Methodist University

-- 
zhu wang [EMAIL PROTECTED]

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


Re: [R] Questions for package ts prediction

2003-06-09 Thread zhu wang
On Mon, 2003-06-09 at 03:56, Prof Brian Ripley wrote:
 You have a scoping problem: the predict method needs to find the data:
 please supply an explicit newdata argument.  Your first example works
 because `y' happens to be globally visible and be the right object.
 
Thanks. That makes sense.

 On 9 Jun 2003, zhu wang wrote:
 
  I am trying to write a function to return prediction values using
  package ts. I have written three different versions since I am not sure
  what's wrong with my func2. func and func1 return the same results.But
  func1 and func2 don't. In particular, the only difference between
  func1 and func2 is the function variable name being y and data,
  respectively.  But running the last line of the following script will
  give the message:
  
  Error in ts(x): object is not a matrix.
  
  I am confused. Also, could somebody kindly let me what's the answer if
  any for the following sunspot example from the package help:
  
  data(sunspot)
  (sunspot.ar - ar(sunspot.year)) 
  # why not just sunspot.ar - ar(sunspot.year) ?
 
 Have you tried it?  Please do so, and you will learn the difference!
 This idiom is widely used in the R help files.
 
I have tried it before but now I know the trick here.

  predict(sunspot.ar, n.ahead=25)
-- 
zhu wang [EMAIL PROTECTED]

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


[R] Questions for package ts prediction

2003-06-08 Thread zhu wang
Dear helpers,

I am trying to write a function to return prediction values using
package ts. I have written three different versions since I am not sure
what's wrong with my func2. func and func1 return the same results.But
func1 and func2 don't. In particular, the only difference between
func1 and func2 is the function variable name being y and data,
respectively.  But running the last line of the following script will
give the message:

Error in ts(x): object is not a matrix.

I am confused. Also, could somebody kindly let me what's the answer if
any for the following sunspot example from the package help:

data(sunspot)
(sunspot.ar - ar(sunspot.year)) 
# why not just sunspot.ar - ar(sunspot.year) ?
predict(sunspot.ar, n.ahead=25)

Thanks in advance.

Zhu Wang
Statistical Science Department
Southern Methodist University

(214)768-2453
-- 
zhu wang [EMAIL PROTECTED]

# time series prediction

func-function(data)
  {(esti- ar(data))
   return(predict(object=esti,newdata=data,n.head=5))
 }
func1-function(y)
  {(esti- ar(y))
   return(predict(esti,n.head=5))
 }
func2-function(data)
  {(esti- ar(data))
   return(predict(esti,n.head=5))
 }

y-arima.sim(model=list(ar=c(1.7,-0.8)),n=100)
func(y)
func1(y)
func2(y)

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


FW: [R] unable to open connection

2003-02-03 Thread zhu wang

Thanks to Brian D. Ripley and Uwe Ligges. It works now.
 
 Zhu Wang
 
 Statistical Science Department
 Southern Methodist University
 3225 Daniel Avenue, Heroy 123
 Dallas, TX 75275
 Tel:  (214)768-2453
 Fax: (214)768-4035
 
 
  -Original Message-
  From: Uwe Ligges [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, February 02, 2003 5:22 AM
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: [R] unable to open connection
 
  [EMAIL PROTECTED] wrote:
  
   It works here on Windows with R 1.6.2.  I rebuilt the precompiled
  version,
   as that seems no longer to so so (although it did when it was
built
   under I think 1.5.0).
  
   The original posting did not give an OS.  If this is Windows, the
  comments
   in the ReadMe and rw-FAQ apply: compile it from source yourself,
and
  don't
   report problems on R-help.  The service provided does not extend
to
   checking that packages keep working with each new R version.
  
   My recompiled version will get to CRAN tonight: right now see
   http://toucan.stats.ox.ac.uk/R/RWin/waveslim.zip
 
  Great, Brian, it works now. But where is the relevant difference?
  I haven't tried to recompile, because I thought it does not matter.
 
  Uwe

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



[R] unable to open connection

2003-02-01 Thread zhu wang
Dear list members,
 
I have problem to load data of the library waveslim.
After I load the library waveslim and tried to load data ibm
 
data(ibm)
Error in file(file, r) : unable to open connection
In addition: Warning message: 
cannot open file `ibm.txt'
 
I also tried other data sets without success. It works for other
libraries though.
 
Any suggestions? Thanks.
 
Zhu Wang
 
Statistical Science Department
Southern Methodist University
3225 Daniel Avenue, Heroy 123
Dallas, TX 75275 
Tel:  (214)768-2453
Fax: (214)768-4035
 

[[alternate HTML version deleted]]

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