[Rd] [Fwd: buglet (?) in de.restore()]

2007-09-10 Thread Ben Bolker

  I'm resending this after a decent interval of 20 days -- any
opinions?  Should I file it as a bug report?  Is it my mistake?

  cheers
Ben Bolker


 Original Message 
Subject:buglet (?) in de.restore()
Date:   Tue, 21 Aug 2007 13:29:33 -0400
From:   Ben Bolker <[EMAIL PROTECTED]>
To: r-devel@r-project.org



  If one calls data.entry() with a matrix:

A = matrix(0,2,2)
data.entry(A)

everything works fine except that it triggers a warning:

Warning message:
the condition has length > 1 and only the first element will be used in:
  if (dim(x) == dim(args[[i]])) rn <- dimnames(args[[i]])[[1]] else rn 
<- NULL

This is triggered by the following lines in de.restore() [in 
src/library/utils/R/de.R]:
>   if( dim(x) == dim(args[[i]]) )
> rn <- dimnames(args[[i]])[[1]]
> else rn <- NULL
  It would seem to make sense to replace the condition with

if (nrow(x) == nrow(args[[i]]))

  (de.restore() is only called if an element of the list passed to 
data.entry
has more than one column)

 On a side note, I'm curious why

> > A = matrix(0,2,2)
> > is.vector(A)
> [1] FALSE
> > is(A,"vector")
> [1] TRUE
 ...

--
sessionInfo()
R version 2.5.1 (2007-06-27)
i486-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] "stats" "graphics"  "grDevices" "utils" "datasets"  "methods" 
[7] "base"

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [Fwd: buglet (?) in de.restore()]

2007-09-10 Thread Duncan Murdoch
On 9/10/2007 8:47 AM, Ben Bolker wrote:
>   I'm resending this after a decent interval of 20 days -- any
> opinions?  Should I file it as a bug report?  Is it my mistake?

I think a bug report is in order.

> 
>   cheers
> Ben Bolker
> 
> 
>  Original Message 
> Subject:  buglet (?) in de.restore()
> Date: Tue, 21 Aug 2007 13:29:33 -0400
> From: Ben Bolker <[EMAIL PROTECTED]>
> To:   r-devel@r-project.org
> 
> 
> 
>   If one calls data.entry() with a matrix:
> 
> A = matrix(0,2,2)
> data.entry(A)
> 
> everything works fine except that it triggers a warning:
> 
> Warning message:
> the condition has length > 1 and only the first element will be used in:
>   if (dim(x) == dim(args[[i]])) rn <- dimnames(args[[i]])[[1]] else rn 
> <- NULL
> 
> This is triggered by the following lines in de.restore() [in 
> src/library/utils/R/de.R]:
>>   if( dim(x) == dim(args[[i]]) )
>> rn <- dimnames(args[[i]])[[1]]
>> else rn <- NULL
>   It would seem to make sense to replace the condition with
> 
> if (nrow(x) == nrow(args[[i]]))
> 
>   (de.restore() is only called if an element of the list passed to 
> data.entry
> has more than one column)
> 
>  On a side note, I'm curious why
> 
>> > A = matrix(0,2,2)
>> > is.vector(A)
>> [1] FALSE
>> > is(A,"vector")
>> [1] TRUE

The glib answer for the first result is that it's because it's 
documented that way.  I guess it's so that you can distinguish simple 
vectors from matrices or other more complex objects.

As to the second, you're testing whether A inherits from the class 
"vector", i.e. indexing works on it.  Most things in R inherit from 
class vector, so that comes out TRUE.  (Things that don't:  NULL, 
environments, some other special stuff.)

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [Fwd: buglet (?) in de.restore()]

2007-09-10 Thread Peter Dalgaard
Ben Bolker wrote:
>   I'm resending this after a decent interval of 20 days -- any
> opinions?  Should I file it as a bug report?  Is it my mistake?
>   
It just slipped through the cracks, I suppose. I think it looks like a
buglet -- the [[1]] in dimnames(args[[i]])[[1]] doesn't make sense
unless dim(args[[i]]) is nonscalar. The suggested fix should be neutral
since nrow(x)==dim(x)[1] by definition.

I've fixed it now, but in principle it is the kind of material that bug
reports are made of.

-p
>   cheers
> Ben Bolker
>
>
>  Original Message 
> Subject:  buglet (?) in de.restore()
> Date: Tue, 21 Aug 2007 13:29:33 -0400
> From: Ben Bolker <[EMAIL PROTECTED]>
> To:   r-devel@r-project.org
>
>
>
>   If one calls data.entry() with a matrix:
>
> A = matrix(0,2,2)
> data.entry(A)
>
> everything works fine except that it triggers a warning:
>
> Warning message:
> the condition has length > 1 and only the first element will be used in:
>   if (dim(x) == dim(args[[i]])) rn <- dimnames(args[[i]])[[1]] else rn 
> <- NULL
>
> This is triggered by the following lines in de.restore() [in 
> src/library/utils/R/de.R]:
>   
>>   if( dim(x) == dim(args[[i]]) )
>> rn <- dimnames(args[[i]])[[1]]
>> else rn <- NULL
>> 
>   It would seem to make sense to replace the condition with
>
> if (nrow(x) == nrow(args[[i]]))
>
>   (de.restore() is only called if an element of the list passed to 
> data.entry
> has more than one column)
>
>  On a side note, I'm curious why
>
>   
>>> A = matrix(0,2,2)
>>> is.vector(A)
>>>   
>> [1] FALSE
>> 
>>> is(A,"vector")
>>>   
>> [1] TRUE
>> 
>  ...
>
> --
> sessionInfo()
> R version 2.5.1 (2007-06-27)
> i486-pc-linux-gnu
>
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] "stats" "graphics"  "grDevices" "utils" "datasets"  "methods" 
> [7] "base"
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>   


-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] partial correlation function for multivariate time series

2007-09-10 Thread Simone Giannerini
Dear all,

I found the following behaviour with pacf() in the multivariate case,

set.seed(10)
x <- rnorm(1000,sd=1)
y <- rnorm(1000,sd=1)
pacf(ts(cbind(x,y)),plot=FALSE,lag.max=10)

Partial autocorrelations of series 'cbind(x, y)', by lag

, , x

 x  y
0.047 (  1)0.000 ( -1)
0.011 (  2)0.000 ( -2)
0.005 (  3)0.000 ( -3)
0.013 (  4)0.000 ( -4)
0.050 (  5)0.000 ( -5)
0.034 (  6)0.000 ( -6)
0.026 (  7)0.000 ( -7)
   -0.029 (  8)0.000 ( -8)
   -0.010 (  9)0.000 ( -9)
   -0.013 ( 10)0.000 (-10)

, , y

 x  y
  374.052 (  1)   -0.045 (  1)
   66.717 (  2)   -0.024 (  2)
 -535.810 (  3)   -0.031 (  3)
  120.802 (  4)   -0.020 (  4)
  142.824 (  5)0.004 (  5)
 -211.711 (  6)   -0.010 (  6)
  201.856 (  7)0.058 (  7)
  286.079 (  8)   -0.035 (  8)
 -134.057 (  9)0.032 (  9)
  -18.200 ( 10)0.019 ( 10)

Since there are multiple ways of defining the pacf for multivariate time
series
(see e.g. G.C. Reinsel, Elements of multivariate time series analysis, II
edition, Springer, section 3.3) and given that
in ?pacf there is no reference to articles or books regarding its
computation
I do not know whether this behaviour is expected or it is a bug instead.
In the first case could you provide a reference for it? In the second case I
might file a bug report.
Thank you for the great work you are doing for the scientific community.

kind regards,

Simone Giannerini

WINDOWS

platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  5.1
year   2007
month  06
day27
svn rev42083
language   R
version.string R version 2.5.1 (2007-06-27)

LINUX

> R.Version()
$platform
[1] "x86_64-unknown-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "2"

$minor
[1] "5.1"

$year
[1] "2007"

$month
[1] "06"

$day
[1] "27"

$`svn rev`
[1] "42083"

$language
[1] "R"

$version.string
[1] "R version 2.5.1 (2007-06-27)"
-- 
__

Simone Giannerini
Dipartimento di Scienze Statistiche "Paolo Fortunati"
Universita' di Bologna
Via delle belle arti 41 - 40126  Bologna,  ITALY
Tel: +39 051 2098262  Fax: +39 051 232153
__

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Snow on Windows Cluster

2007-09-10 Thread Luke Tierney

Thanks for the note.

Could you give me more info on the "small failures on stopping cluster"?

I don't currently have a windows system I can test this on so I can't
fold it into the snow release yet. But hopefully I can in the next
month or so. I may get back in touch at that point.

Meanwhile I have been working with a modified shell script that can be
used with mpirun under lam on unix.  I've attached the current
version.  It may turn out that this approach is a little more
maitainable on the Windows side as well.  The way this gets used is

mpirun -np 5 RMPISNOW

to run a master and 4 workers, and then in the master

cl <- getMPIcluster()

instead of using makeCluster or makeMPIcluster.  I have not yet found
the MICH2 analog of the LAMRANK environment variable but suspect
something similar does exist.

Best,

luke


On Mon, 3 Sep 2007, Markus Schmidberger wrote:


Hello,

the package snow is not working on a windows cluster with MPICH2 and Rmpi. 
There is an error in makeCluster:


launch failed: CreateProcess(/usr/bin/env 
"RPROG="C:\Programme\R\R-2.5.1\bin\R" "OUT=/dev/null" "R_LIBS=" 
C:/Programme/R/R-2.5.1/library/snow/RMPInode.sh) on 'cl1' failed, error 3 - 
Das System kann den angegbenen Pfad nicht finden.


I looked into makeMPIcluster. It could not work, mpi.comm.spawn gets the 
shell command for unix to start the slaves. A simple solution is to use the 
windows-code from mpi.spawn.rslaves, then it looks like this. And is working 
on our windows-cluster. (small failures on stopping cluster)


# Fro windows
if (.Platform$OS=="windows"){
  workdrive <- unlist(strsplit(getwd(),":"))[1]
  tmpdrive <- unlist(strsplit(tempdir(),":"))[1]
  worktmp <- as.logical(toupper(workdrive)==toupper(tmpdrive))
  tmpdir <- unlist(strsplit(tempdir(),"/Rtmp"))[1]
  localhost <- Sys.getenv("COMPUTERNAME")
  networkdrive <-.Call("RegQuery", 
as.integer(2),paste("NETWORK\\",workdrive,sep=""),

 PACKAGE="Rmpi")
  remotepath <-networkdrive[which(networkdrive=="RemotePath")+1]
  mapdrive=TRUE
  mapdrive <- as.logical(mapdrive && !is.null(remotepath))
  Rscript=system.file("slaveload.R", package="snow")
  arg <- c(Rscript, R.home(), workdrive, getwd(),worktmp, tmpdir,
 localhost, mapdrive, remotepath)
  #Rscript,R_HOME,WDrive,WDir,WorkTmp,TmpDir,Master,MapDrive,RemotePath
  print("super")
  count<-mpi.comm.spawn(
  slave=system.file("Rslaves.bat", package="Rmpi"),
  slavearg=arg,
  nslaves=count)
} else{   # for unix
  count <- mpi.comm.spawn(slave = "/usr/bin/env",
  slavearg = args,
  nslaves = count,
  intercomm = intercomm)
}

Doing some work, there should be a better and nicer solution with directly 
using mpi.spawn.Rslaves.


Best
Markus




--
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu#! /bin/sh

# if definded, prepend R_SNOW_LIB to $_LIBS
if test ! -z "${R_SNOW_LIB}" ; then
R_LIBS=${R_SNOW_LIB}:${R_LIBS}; export R_LIBS
fi

# find the library containing the snow package; should eventually use Rscript
snowdir=`echo 'invisible(cat(tryCatch(dirname(.find.package("snow")), error = 
function(e) ""),"\n",sep=""))' | R --slave`

# for now this hijack the R_PROFILE mechanism to start up the R
# sessions and load snow and Rmpi into them
R_PROFILE=${snowdir}/snow/RMPISNOWprofile; export R_PROFILE

if test -z "${LAMRANK}" ; then
echo "not using LAM-MPI; currently only LAM-MPI is supported"
exit 1
else 
# use the LAMRANK environment variable set by LAM-MPI's mpirun to
# run R with appropriate arguments for master and workers.
if test "${LAMRANK}" == "0" ; then
exec R $*
else
exec R --slave > /dev/null 2>&1
fi
fi
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Test posting

2007-09-10 Thread Dominick Samperi
This is a test posting to R-devel used to
determine why some postings are dropped.
This one avoids mentioning the name of
an operating system that may trigger a junk
reaction.

Please ignore.

DS

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel