Re: [R] Rmpi installation trouble

2012-10-10 Thread Prof Brian Ripley

Note:

libmpi.dylib: cannot open shared object file: No such file or directory

Linux does not have .dylib's: Darwin (part of Mac OS X) does.

This is not an R question (it seems to be about your MPI installation) 
and you need to discuss it with the package maintainer (see the posting 
quide).


OpenMPI was found in /usr/local so it seems not to be a system 
installation.  So you'll need to give full details about that.


On 10/10/2012 05:46, Erin Hodgess wrote:

Dear R People:

I'm trying to install Rmpi (latest version) on Ubuntu.

However, I'm getting the following error:

erin@erin-Y480:~$ R

R version 2.15.1 (2012-06-22) -- Roasted Marshmallows
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

   Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


install.packages(Rmpi,depen=TRUE)

Installing package(s) into ‘/home/erin/R/x86_64-pc-linux-gnu-library/2.15’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://cran.at.r-project.org/src/contrib/Rmpi_0.6-1.tar.gz'
Content type 'application/x-gzip' length 92977 bytes (90 Kb)
opened URL
==
downloaded 90 Kb

* installing *source* package ‘Rmpi’ ...
** package ‘Rmpi’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
I am here /usr/local and it is OpenMPI
Trying to find mpi.h ...
Found in /usr/local/include
Trying to find libmpi.so or libmpich.a ...
Found libmpi in /usr/local/lib
checking for openpty in -lutil... yes
checking for main in -lpthread... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -DPACKAGE_NAME=\\
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\
-DPACKAGE_BUGREPORT=\\ -DPACKAGE_URL=\\ -I/usr/local/include
-DMPI2 -DOPENMPI -fpic  -O3 -pipe  -g  -c RegQuery.c -o RegQuery.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -DPACKAGE_NAME=\\
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\
-DPACKAGE_BUGREPORT=\\ -DPACKAGE_URL=\\ -I/usr/local/include
-DMPI2 -DOPENMPI -fpic  -O3 -pipe  -g  -c Rmpi.c -o Rmpi.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -DPACKAGE_NAME=\\
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\
-DPACKAGE_BUGREPORT=\\ -DPACKAGE_URL=\\ -I/usr/local/include
-DMPI2 -DOPENMPI -fpic  -O3 -pipe  -g  -c conversion.c -o
conversion.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -DPACKAGE_NAME=\\
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\
-DPACKAGE_BUGREPORT=\\ -DPACKAGE_URL=\\ -I/usr/local/include
-DMPI2 -DOPENMPI -fpic  -O3 -pipe  -g  -c internal.c -o internal.o
gcc -std=gnu99 -shared -o Rmpi.so RegQuery.o Rmpi.o conversion.o
internal.o -L/usr/local/lib -lmpi -lutil -lpthread -L/usr/lib/R/lib
-lR
installing to /home/erin/R/x86_64-pc-linux-gnu-library/2.15/Rmpi/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
libmpi.dylib: cannot open shared object file: No such file or directory
Error : .onLoad failed in loadNamespace() for 'Rmpi', details:
   call: fun(libname, pkgname)
   error: Cannot start MPI_Init(). Exit
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/erin/R/x86_64-pc-linux-gnu-library/2.15/Rmpi’

The downloaded source packages are in
‘/tmp/RtmpWCdvrW/downloaded_packages’
Warning message:
In install.packages(Rmpi, depen = TRUE) :
   installation of package ‘Rmpi’ had non-zero exit status




Any suggestions would be much appreciated.

Sincerely,
Erin




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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


[R] Data Frame processing.

2012-10-10 Thread CrimMagic
Hi Everyone! :D

Just need a little help on data frames. I was wondering if anyone would know
a way to rename the row numbers on a data frame.

e.g.
head(df)
Hats  Dogs Horses
52 Glen9.53   0.00  0.00 
18 Jane 1.48  1.48   1.48  
15 Lona1.36  0.45   1.14 
9   Hung   0.80  0.40   0.50  
25 Artian  0.68  0.23   0.45  

Since i re-ordered my original df by decreasing Hats size, the row numbers
are now out or order. Is there a code or something to re-number the new data
frame?

Thanks in advance for any help! :D




--
View this message in context: 
http://r.789695.n4.nabble.com/Data-Frame-processing-tp4645664.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Regarding R's png device in linux

2012-10-10 Thread Anshul Gupta





Hi, 
I am a developer from Oracle. I wanted to create a png file out of png device 
with a bit depth of 8.  I am using R on linux. But I noticed that R 
automatically switches between 8 and 24 bit depth. i tried a lot of things from 
your grDevices package but unable to control the bitdepth. I would be really 
grateful to you guys if you can suggest me some way to solve this issue.

-/Ag

Anshul Gupta 
Mobile : +91-814773074
Linkedin : http://in.linkedin.com/pub/anshul-gupta/19/b36/4a7  
Personal Website : http://www.guptaanshul.com


When we are dreaming alone it is only a dream. When we are dreaming with 
others, it is the beginning of reality. -- Dom Helder Camara


  
[[alternative HTML version deleted]]

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


[R] package request

2012-10-10 Thread sagarnikam123
which package from CRAN used for Big-Data analysis ?
is there any separate package for Big-Data analysis?
or for making reports  Business intelligence 



--
View this message in context: 
http://r.789695.n4.nabble.com/package-request-tp4645661.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Text file: multiple matrix

2012-10-10 Thread Purna chander
Hi,

You can try this and see. I'm assuming that the initial text file
named test.txt.

x-read.table(test.txt,header=T)  # if headers are present in test.txt
  or
x-read.table(test.txt)

# Actually, read.table() command skips the blank lines.

n-256

for (i in 1:100){
  filename=paste(file_,i,.txt,sep=)
  m-x[((i-1)*256+1):(i*256),]
  write.table(m,filename,row.names=F,col.names=F)
}

Regards,
Purna


On 10/9/12, ludovico ludovicofr...@hotmail.it wrote:
 Hi there! I'm a newbie in R
 This is my problem: I have a txt file composed by 100 matrix (256x256)
 separated by a blank line! How can I save automatically the matrix in
 separated txt file (100)?
 e.g.
 1° matrix from line 1 to line 256
 257 blank line
 2°matrix from line 258 to line 513
 514 blank line
 3° matrix from line 515 to line 770
 771 blank line
 4° matrix from line 772 to line 1027..
 Thanks





 --
 View this message in context:
 http://r.789695.n4.nabble.com/Text-file-multiple-matrix-tp4645551.html
 Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] Data Frame processing.

2012-10-10 Thread Rui Barradas

Hello,

Try the following.

rownames(df) - seq_len(nrow(df))

Hope this helps,

Rui Barradas
Em 10-10-2012 08:41, CrimMagic escreveu:

Hi Everyone! :D

Just need a little help on data frames. I was wondering if anyone would know
a way to rename the row numbers on a data frame.

e.g.

head(df)

 Hats  Dogs Horses
52 Glen9.53   0.00  0.00
18 Jane 1.48  1.48   1.48
15 Lona1.36  0.45   1.14
9   Hung   0.80  0.40   0.50
25 Artian  0.68  0.23   0.45

Since i re-ordered my original df by decreasing Hats size, the row numbers
are now out or order. Is there a code or something to re-number the new data
frame?

Thanks in advance for any help! :D




--
View this message in context: 
http://r.789695.n4.nabble.com/Data-Frame-processing-tp4645664.html
Sent from the R help mailing list archive at Nabble.com.

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


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


[R] Optimx Package Error

2012-10-10 Thread nserdar
estimate- optimx(init.par,Linn,gr=NULL,method= L-BFGS-B, hessian=TRUE,
control =
list(trace=1),lower=c(0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf))
fn is  Linn 
Function has  10  arguments
par[ 1 ]:  0   ? 0   ? 1 In Bounds   
par[ 2 ]:  0   ? 0   ? 1 In Bounds   In Bounds  
par[ 3 ]:  0   ? 0   ? 1 In Bounds   In Bounds   In Bounds 
par[ 4 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds   In
Bounds
par[ 5 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds   In
Bounds   In Bounds   
par[ 6 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds   In
Bounds   In Bounds   In Bounds  
par[ 7 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds   In
Bounds   In Bounds   In Bounds   In Bounds 
par[ 8 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds   In
Bounds   In Bounds   In Bounds   In Bounds   In Bounds
par[ 9 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds   In
Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   
par[ 10 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds   In
Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In
Bounds  
Error in optimx(init.par, Linn, gr = NULL, method = L-BFGS-B, hessian =
TRUE,  : 
  Cannot evaluate function at initial parameters

Please let me know how to deal with this problem.

Regards,
Serdar



--
View this message in context: 
http://r.789695.n4.nabble.com/Optimx-Package-Error-tp4645669.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Optimx Package Error

2012-10-10 Thread Jeff Newmiller
This is operator error. Do not attempt to optimize over an infinite range.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

nserdar snes1...@hotmail.com wrote:

estimate- optimx(init.par,Linn,gr=NULL,method= L-BFGS-B,
hessian=TRUE,
control =
list(trace=1),lower=c(0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf))
fn is  Linn 
Function has  10  arguments
par[ 1 ]:  0   ? 0   ? 1 In Bounds   
par[ 2 ]:  0   ? 0   ? 1 In Bounds   In Bounds  
par[ 3 ]:  0   ? 0   ? 1 In Bounds   In Bounds   In Bounds   
 
par[ 4 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds  
In
Bounds
par[ 5 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds  
In
Bounds   In Bounds   
par[ 6 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds  
In
Bounds   In Bounds   In Bounds  
par[ 7 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds  
In
Bounds   In Bounds   In Bounds   In Bounds 
par[ 8 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds  
In
Bounds   In Bounds   In Bounds   In Bounds   In Bounds
par[ 9 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds  
In
Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   
par[ 10 ]:  -Inf   ? 1   ? Inf In Bounds   In Bounds   In Bounds 
 In
Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In
Bounds  
Error in optimx(init.par, Linn, gr = NULL, method = L-BFGS-B, hessian
=
TRUE,  : 
  Cannot evaluate function at initial parameters

Please let me know how to deal with this problem.

Regards,
Serdar



--
View this message in context:
http://r.789695.n4.nabble.com/Optimx-Package-Error-tp4645669.html
Sent from the R help mailing list archive at Nabble.com.

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

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


Re: [R] RGL package surface plot

2012-10-10 Thread S Ellison
 I'm completely new at R... I have sinkhole survey data (lat, long, and
 elevation) and have been trying to plot a rotatable 3d plot 
 for several hours... cannot get it right. 

You can use loess and predict.loess to generate a fitted 3d surface that can be 
plotted using contour() and similar.
  
However, given the environmental nature of your problem, you might also look at 
the geoR package, which implements kriging, one of the more comon fitting 
methods for environmental data. There's a discussion of using that for 
prediction of a grid and a subsequent (base graphics) 3-D plot at 
http://streaming.stat.iastate.edu/~stat506/notes/ordkrigeexamp.pdf


S Ellison

 I'm completely new at R... I have sinkhole survey data (lat, long, and
 elevation) and have been trying to plot a rotatable 3d plot 
 for several hours... cannot get it right. Examples I see tend 
 to be grid data (one elevation value per grid cell); however, 
 my data are more random (known elevations at known (but 
 random) x-y positions). Data format is tab separated, i.e.:
 
 lat   long   elev
 3443   2
 36.832.54 6.2
 ...etc...
 
 please help!
 
 arik
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/RGL-package-surface-plot-tp4645642.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

***
This email and any attachments are confidential. Any use...{{dropped:8}}

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


Re: [R] Regarding R's png device in linux

2012-10-10 Thread Prof Brian Ripley

On 10/10/2012 07:23, Anshul Gupta wrote:


Hi,
I am a developer from Oracle. I wanted to create a png file out of
png

device with a bit depth of 8. I am using R on linux. But I noticed that
R automatically switches between 8 and 24 bit depth. i tried a lot of
things from your grDevices package but unable to control the bitdepth. I
would be really grateful to you guys if you can suggest me some way to
solve this issue.

Let me read the help page to you ...

 ‘png’ will normally use a palette if there are less than 256
 colours on the page, and record a 24-bit RGB file otherwise (or a
 32-bit RGBA file if ‘type = cairo’ and non-opaque colours are
 used).  ...

So, it is obvious that you need to use less than 256 colours (which is 
all PNG8 can support: it is not a 'bit depth' as it uses a palette).



-/Ag

Anshul Gupta
Mobile : +91-814773074
Linkedin : http://in.linkedin.com/pub/anshul-gupta/19/b36/4a7
Personal Website : http://www.guptaanshul.com



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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

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


Re: [R] Constant Error in R

2012-10-10 Thread S Ellison
 I keep getting this Error in x^2 : non-numeric argument to 
 binary operator
 using multiple different codes, ones which have been verified 
 to work by my professor and other students.

I confirm the previous poster's lack of error in running the code supplied. I 
also agree that something strange is going on.

But the error message says you have a non-numeric argument in a binary 
operator. That means that i) you are using a binary operator (^ in this case) 
either yourself or in a function you;re calling and ii) either x or 2 is 
non-numeric. 

Two possibilities that are siompler than recompiling:
First, are you calling the lm() you think you are? Run traceback() after the 
error to see where it actually occurred. You may find a user-defined function 
that is masking lm(). That could hang around from a previous R session if you 
defined one and saved the image on closing.

Second: Check the class of your input data. Then fix whichever variable should 
be numeric and isn't. (this is less likely as lm() returns a different error 
with non-numeric input).

S

***
This email and any attachments are confidential. Any use...{{dropped:8}}

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


Re: [R] Constant Error in R

2012-10-10 Thread Jim Holtman
learn how to debug your program.  I think the call is:

options(error = recover)

don't have R on my iPad so cannot check.  When you do this, you drop into the 
'browser' at which point you can examine the value and see that you have a 
non-numeric object.

Sent from my iPad

On Oct 10, 2012, at 6:12, S Ellison s.elli...@lgcgroup.com wrote:

 I keep getting this Error in x^2 : non-numeric argument to 
 binary operator
 using multiple different codes, ones which have been verified 
 to work by my professor and other students.
 
 I confirm the previous poster's lack of error in running the code supplied. I 
 also agree that something strange is going on.
 
 But the error message says you have a non-numeric argument in a binary 
 operator. That means that i) you are using a binary operator (^ in this case) 
 either yourself or in a function you;re calling and ii) either x or 2 is 
 non-numeric. 
 
 Two possibilities that are siompler than recompiling:
 First, are you calling the lm() you think you are? Run traceback() after the 
 error to see where it actually occurred. You may find a user-defined function 
 that is masking lm(). That could hang around from a previous R session if you 
 defined one and saved the image on closing.
 
 Second: Check the class of your input data. Then fix whichever variable 
 should be numeric and isn't. (this is less likely as lm() returns a different 
 error with non-numeric input).
 
 S
 
 ***
 This email and any attachments are confidential. Any use...{{dropped:8}}
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] Filling points in a trellis object

2012-10-10 Thread Pierrick Bruneau
With the following code :

dat1 - matrix(nrow=4, ncol=2)  
dat1[1,] - c(-2, 1)
dat1[2,] - c(-1.7, 0.9)
dat1[3,] - c(0.1, 0.6)
dat1[4,] - c(0.5, 0.5)
theplot - xyplot(V2 ~ V1, as.data.frame(dat1), pch=c(4,1,5,4))
plot(theplot, prefix=theplot) # for a predictable name
grid.edit(theplot.xyplot.points.panel.1.1, gp=gpar(lwd=c(2,2,2,2),
cex=c(2,3,3,2),
  col=1, fill=c(transparent, grey, grey, transparent)))


I would like to plot 4 points, and have the circle and diamond shapes
filledwith grey. What am I missing ?

Thanks by advance for your help,
Pierrick Bruneau
Research Fellow
CRP Gabriel Lippmann

[[alternative HTML version deleted]]

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


Re: [R] problem with convergence in mle2/optim function

2012-10-10 Thread Berend Hasselman

On 10-10-2012, at 00:21, Adam Zeilinger wrote:

 Dear R help,
 
 Thanks again for the responses.  I increased the lower constraint to:
 
 lower = list(p1 = 0.0001, p2 = 0.0001, mu1 = 0.0001, mu2 = 0.0001).
 
 I also included an upper box constraint of:
 
 upper = list(p1 = Inf, p2 = Inf, mu1 = p1t, mu2 = p2t).
 
 Making these changes improved the rate of convergence among stochastic 
 simulation runs, but I still had convergence problems.
 
 I found success in switching from mle2/optim to spg (BB package).  So far, 
 spg has produced similarly precise estimates as L-BFGS-B and consistently 
 provides parameter estimates.
 
 If anyone is interested, here is the new objective function and spg call, 
 instead of my previous objective function and mle2 call.  All other parts of 
 my reproducible code are the same as I've previously supplied:
 
 ##
 library(BB)
 
 # Objective function for spg()
 NLL2 - function(par, y){
  p1 - par[1]
  p2 - par[2]
  mu1 - par[3]
  mu2 - par[4]
  t - y$tv
  n1 - y$n1
  n2 - y$n2
  n3 - y$n3
  P1 - (p1*((-1 + exp(sqrt((mu1 + mu2 + p1 + p2)^2 -
4*(mu2*p1 + mu1*(mu2 + p2)))*t))*((-mu2)*(mu2 - p1 + p2) +
mu1*(mu2 + 2*p2)) - mu2*sqrt((mu1 + mu2 + p1 + p2)^2 -
4*(mu2*p1 + mu1*(mu2 + p2))) -
exp(sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)))*t)*
mu2*sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2))) +
2*exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
4*(mu2*p1 + mu1*(mu2 + p2*t)*mu2*
sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)/
exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
4*(mu2*p1 + mu1*(mu2 + p2*t)/(2*(mu2*p1 + mu1*(mu2 + p2))*
sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2 
  P2 - (p2*((-1 + exp(sqrt((mu1 + mu2 + p1 + p2)^2 -
4*(mu2*p1 + mu1*(mu2 + p2)))*t))*(-mu1^2 + 2*mu2*p1 +
mu1*(mu2 - p1 + p2)) - mu1*sqrt((mu1 + mu2 + p1 + p2)^2 -
4*(mu2*p1 + mu1*(mu2 + p2))) -
exp(sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)))*t)*
mu1*sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2))) +
2*exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
4*(mu2*p1 + mu1*(mu2 + p2*t)*mu1*
sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)/
exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
4*(mu2*p1 + mu1*(mu2 + p2*t)/(2*(mu2*p1 + mu1*(mu2 + p2))*
sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2
  P3 - 1 - P1 - P2
  p.all - c(P1, P2, P3)
  #cat(NLL.free p.all {P1,P2,P3}\n)
  #print(matrix(p.all, ncol=3))
  -sum(dmnom2(c(n1, n2, n3), prob = p.all, log = TRUE))
 }
 
 par - c(p1t, p2t, mu1t, mu2t)
 
 spg.fit - spg(par = par, fn = NLL2, y = yt,
lower = c(0.001, 0.001, 0.001, 0.001),
control = list(maxit = 5000))
 
 
 
 My next problem is that spg takes about twice as long as L-BFGS-B to 
 converge.  The spg help file strongly suggests the use of an exact gradient 
 function to improve speed.  But I am having trouble writing a gradient 
 function.  Here is what I have so far:
 
 I derived the gradient function by taking the derivative of my NLL equation 
 with respect to each parameter.  My NLL equation is the probability mass 
 function of the trinomial distribution.  Here is some reproducible code:
 
 #
 library(Ryacas)
 
 p1 - Sym(p1); p2 - Sym(p2); mu1 - Sym(mu1); mu2 - Sym(mu2)
 t - Sym(t); n1 - Sym(n1); n2 - Sym(n2); n3 - Sym(n3)
 
 P1.symb - ((p1*((-1 + exp(sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2)))*t))*((-mu2)*(mu2 - p1 + p2) +
  mu1*(mu2 + 2*p2)) - mu2*sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2))) -
  exp(sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)))*t)*
  mu2*sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2))) +
  2*exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2*t)*mu2*
  sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)/
  exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2*t)/(2*(mu2*p1 + mu1*(mu2 + p2))*
  sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)
 
 P2.symb - ((p2*((-1 + exp(sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2)))*t))*(-mu1^2 + 2*mu2*p1 +
  mu1*(mu2 - p1 + p2)) - mu1*sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2))) -
  exp(sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)))*t)*
  mu1*sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2))) +
  2*exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2*t)*mu1*
  sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)/
  exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
  

[R] HoltWinters

2012-10-10 Thread Applied Stat
Hi,

I am trying to fit the HoltWinters exponential smoothing on a monthly time
series data in R. My questions are:
1. I know that the level, trend and seasonality are updated over time. So
are the output coefficients a, b and s1-s12 for a specific time t (a,b and
s12 for last observataion for example) ?

2. I am trying to work out the fitted values but I could not figure out
the h value used in HoltWinters function?

Thanks in advance
Sara B.

[[alternative HTML version deleted]]

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


[R] r-plot help-it prints outside frame

2012-10-10 Thread piranha piranha
Hello,

i have been doing browns exponential smooting for myself and have a little
trouble with plotting values:

par(xpd=TRUE)
plot(vector,xlab=Period,ylab=Values)
legend(max(vector), legend = c(Original values, Estimated values),
col=c(blue,red),lwd=0.5, cex=1, xjust=0.1, yjust=-0.3)
lines (vector, type = o, col=blue)  #original values
lines (est_vector, type = o, col=red) # estimated values
lines (length(vector)+1,forecast, type = o, col=green) #forecasted
value

i get result as in pdf file attached in this email.

Two red values are outside of frame and i need also to get green value
inside of a frame.Can you help me? I am really stucked with this. thx!


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


Re: [R] Optimx Package Error

2012-10-10 Thread nserdar
Sorry but I don't understand what your opinion. 

Also try this initial values : ( 0.5, 0.5, 0.5, 1 ,1,1,1,1,1,1) 

Then I got same error.

Regards,
Serdar



--
View this message in context: 
http://r.789695.n4.nabble.com/Optimx-Package-Error-tp4645669p4645673.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] own function: computing time

2012-10-10 Thread tonja . krueger
Hi all,

I wrote a function that actually does what I want it to do, but it tends to be 
very slow for large amount of data. On my computer it takes 5.37 seconds for 
16000 data points and 21.95 seconds for 32000 data points. As my real data 
consists of 1800 data points it would take ages to use the function as it 
is now. 
Could someone help me to speed up the calculation?

Thank you, Tonja

system.time({
x - runif(32000)
y - runif(32000)

xy - cbind(x,y) 

outer - function(z){
!any(x  z[1]  y  z[2])}
j - apply(xy,1, outer)

plot(x,y)
points(x[j],y[j],col=green)

})

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


[R] Connect R and Lyx in UBUNTU

2012-10-10 Thread ATANU
Recently I have been using R in UBUNTU 11.10. 
Can anyone please tell me how to connect R and Lyx in UBUNTU? I have been
successful in doing that under Windows but I got stuck for Ubuntu.

Thanks in advance

-Atanu




--
View this message in context: 
http://r.789695.n4.nabble.com/Connect-R-and-Lyx-in-UBUNTU-tp4645675.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] r-plot help-it prints outside frame

2012-10-10 Thread Duncan Murdoch

On 12-10-10 5:31 AM, piranha piranha wrote:

Hello,

i have been doing browns exponential smooting for myself and have a little
trouble with plotting values:

 par(xpd=TRUE)


The line above says allow plotting outside the frame.


 plot(vector,xlab=Period,ylab=Values)
 legend(max(vector), legend = c(Original values, Estimated values),
col=c(blue,red),lwd=0.5, cex=1, xjust=0.1, yjust=-0.3)
 lines (vector, type = o, col=blue)  #original values
 lines (est_vector, type = o, col=red) # estimated values
 lines (length(vector)+1,forecast, type = o, col=green) #forecasted
value

i get result as in pdf file attached in this email.

Two red values are outside of frame and i need also to get green value
inside of a frame.Can you help me? I am really stucked with this. thx!


Don't include the par() call above.

If you want to see those red values that fall below the frame, then use 
ylim in the original plot() call to set the limits, e.g.


plot(..., ylim=range(c(vector, est_vector, forecast)))

Duncan Murdoch

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


Re: [R] r-plot help-it prints outside frame

2012-10-10 Thread Jessica Streicher
You could set xlim and slim when using plot()

plot(vector,xlab=Period,ylab=Values,xlim=range(0,length(vector)+1),ylim=range(vector,est_vector,forecast))

i think - you forgot to provide data for the vectors :)

On 10.10.2012, at 11:31, piranha piranha wrote:

 Hello,
 
 i have been doing browns exponential smooting for myself and have a little
 trouble with plotting values:
 
par(xpd=TRUE)
plot(vector,xlab=Period,ylab=Values)
legend(max(vector), legend = c(Original values, Estimated values),
 col=c(blue,red),lwd=0.5, cex=1, xjust=0.1, yjust=-0.3)
lines (vector, type = o, col=blue)  #original values
lines (est_vector, type = o, col=red) # estimated values
lines (length(vector)+1,forecast, type = o, col=green) #forecasted
 value
 
 i get result as in pdf file attached in this email.
 
 Two red values are outside of frame and i need also to get green value
 inside of a frame.Can you help me? I am really stucked with this. thx!
 Rplot.pdf__
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Connect R and Lyx in UBUNTU

2012-10-10 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/10/12 11:57, ATANU wrote:
 Recently I have been using R in UBUNTU 11.10. Can anyone please tell me how 
 to connect R and
 Lyx in UBUNTU? I have been successful in doing that under Windows but I got 
 stuck for Ubuntu.

This is a LyX question, and I would suggest to ask it on the LyX mailing list.

Cheers,

Rainer

 
 Thanks in advance
 
 -Atanu
 
 
 
 
 -- View this message in context:
 http://r.789695.n4.nabble.com/Connect-R-and-Lyx-in-UBUNTU-tp4645675.html Sent 
 from the R help
 mailing list archive at Nabble.com.
 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlB1X0MACgkQoYgNqgF2egohDgCfWLnBRYKZGenXeLqxfgwj4TWD
FckAnjKK+fuD3C//yMbqveUiH4UjasT5
=4j+E
-END PGP SIGNATURE-

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


[R] Strange email i'm getting whenever i post to the list

2012-10-10 Thread Jessica Streicher
From:   발송실패알림 naver-mai...@naver.com
Subject:[발송실패 안내] 
envy721c@naver.cobSDsnLzroZwg66mU7J287J20IOyghOyGoeuQmOyngCDrqrvtlojsig==teuLiOuLpC4=

The only plain english in the message is that the mail was denied by the 
receiver

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


Re: [R] Strange email i'm getting whenever i post to the list

2012-10-10 Thread Rui Barradas

Hello,

Yes, since yesterday. I thought it was a virus in my system but after 
running the anti-virus twice and after your mail I guess it's something 
else.


Rui Barradas
Em 10-10-2012 12:50, Jessica Streicher escreveu:

From:   발송실패알림 naver-mai...@naver.com
Subject:[발송실패 안내] 
envy721c@naver.cobSDsnLzroZwg66mU7J287J20IOyghOyGoeuQmOyngCDrqrvtlojsig==teuLiOuLpC4=

The only plain english in the message is that the mail was denied by the 
receiver

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


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


Re: [R] Strange email i'm getting whenever i post to the list

2012-10-10 Thread arun
Hi,
From yesterday onwards, I also got the same message.  I contacted 
r-help-ow...@r-project.org.  David replied:


I just got one too. It is an automated response from  the mail server that 
handles bobo:

bobo bleza...@gmail.com

Just put him on your PLONK list and you will not be bothered again. And won't 
need to bother the moderators either.

-- David.

A.K.




- Original Message -
From: Jessica Streicher j.streic...@micromata.de
To: r-help@r-project.org help r-help@r-project.org
Cc: 
Sent: Wednesday, October 10, 2012 7:50 AM
Subject: [R] Strange email i'm getting whenever i post to the list

From:     발송실패알림 naver-mai...@naver.com
    Subject:     [발송실패 안내] 
envy721c@naver.cobSDsnLzroZwg66mU7J287J20IOyghOyGoeuQmOyngCDrqrvtlojsig==teuLiOuLpC4=

The only plain english in the message is that the mail was denied by the 
receiver

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


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


Re: [R] own function: computing time

2012-10-10 Thread Rui Barradas

Hello,

'outer' is a bad name for a function, it's already an R one. See ?outer.
As for your algorithm, it runs quadratically in the length of x and y so 
you should expect a quadratic time behavior. What are you trying to do? 
Your code gets max(x), max(y) and some other points near those. Can you 
rethink what goes on before the algorithm?


Also, you're timing everything, it would be better to just

system.time({j - apply(xy, 1, outer)})

Hope this helps,

Rui Barradas
Em 10-10-2012 11:15, tonja.krue...@web.de escreveu:

Hi all,

I wrote a function that actually does what I want it to do, but it tends to be 
very slow for large amount of data. On my computer it takes 5.37 seconds for 
16000 data points and 21.95 seconds for 32000 data points. As my real data 
consists of 1800 data points it would take ages to use the function as it 
is now.
Could someone help me to speed up the calculation?

Thank you, Tonja

system.time({
x - runif(32000)
y - runif(32000)

xy - cbind(x,y)

outer - function(z){
!any(x  z[1]  y  z[2])}
j - apply(xy,1, outer)

plot(x,y)
points(x[j],y[j],col=green)

})

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


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


[R] pattern matching

2012-10-10 Thread arunkumar1111
hi

My string contain 


string = The sales is good when my num1 between 1 to 5 . else the sales is
poor.

i want to find the patten between 1 to 5 . between and to will be constant
but the numbers would be changing. How to search for that pattern.

Please help



-
Thanks in Advance
Arun
--
View this message in context: 
http://r.789695.n4.nabble.com/pattern-matching-tp4645688.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Filling points in a trellis object

2012-10-10 Thread pbruneau
With the following code :



I would like to plot 4 points, and have the circle and diamond shapes filled
with grey. What am I missing ?

Thanks by advance for your help,
Pierrick Bruneau
Research Fellow
CRP Gabriel Lippmann



--
View this message in context: 
http://r.789695.n4.nabble.com/Filling-points-in-a-trellis-object-tp4645679.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] impossible to fill point glyphs in a lattice plot

2012-10-10 Thread Pierrick Bruneau
(sorry for repetition: the previous mail resulted from a weird manipulation
in the forum)

With the following code :

dat1 - matrix(nrow=4, ncol=2)
dat1[1,] - c(-2, 1)
dat1[2,] - c(-1.7, 0.9)
dat1[3,] - c(0.1, 0.6)
dat1[4,] - c(0.5, 0.5)
theplot - xyplot(V2 ~ V1, as.data.frame(dat1), pch=c(4,1,5,4))
plot(theplot, prefix=theplot) # for a predictable name
grid.edit(theplot.xyplot.points.panel.1.1, gp=gpar(lwd=c(2,2,2,2),
cex=c(2,3,3,2),
  col=1, fill=c(transparent, grey, grey, transparent)))


I would like to plot 4 points, and have the circle and diamond shapes
filledwith grey. What am I missing ?

Thanks by advance for your help,
Pierrick Bruneau
Research Fellow
CRP Gabriel Lippmann

[[alternative HTML version deleted]]

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


[R] Summary using by() returns character arrays in a list

2012-10-10 Thread Alex van der Spek
I use by() to generate a summary statistics like so:

Lbys - by(dat[Nidx], dat$LipTest, summary)

where Nidx is an index vector with names picking out the columns in the
data frame dat.

This returns a list of character arrays (see below for str() output) where
the columns are named correctly but the rownames are empty strings and the
values are strings prepended with the summary statistic's name (e.g.
Min., Median ).

I am reading the code of summary.data.frame() but can't figure out how I
can change the action of that function to return list of numeric matrices
with as rownames the summary statistic's name (Min., Max. etc) and as
values the numeric values of the calculated summary statistic.

Any help much appreciated!
Regards,
Alex van der Spek


 str(Lbys)
List of 2
 $: 'table' chr [1:6, 1:19] Min.   :-0.190   1st Qu.: 9.297  
Median :10.373   Mean   :10.100   ...
  ..- attr(*, dimnames)=List of 2
  .. ..$ : chr [1:6] ...
  .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
 $ T38: 'table' chr [1:6, 1:19] Min.   :8.648   1st Qu.:8.920  
Median :9.018   Mean   :9.027   ...
  ..- attr(*, dimnames)=List of 2
  .. ..$ : chr [1:6] ...
  .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
 - attr(*, dim)= int 2
 - attr(*, dimnames)=List of 1
  ..$ dat$LipTest: chr [1:2]  T38
 - attr(*, call)= language by.data.frame(data = dat[Nidx], INDICES =
dat$LipTest, FUN = summary)
 - attr(*, class)= chr by

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


Re: [R] R stickers

2012-10-10 Thread Michael Friendly

On 10/9/2012 12:27 PM, Virgilio Gómez-Rubio wrote:

Dear all,

Perhaps this is not the place but... we are going to print some stickers
to take them to a conference for a sticker exchange with other free
software organisations. Last year I printed very simple stickers and
this year I would like to take better stuff to the meeting. Does anyone
have a nice design with the R logo that we could use? If you do and are
willing to share it please contact me off-list. We may also print some
of the for the useR! 2013 conference. :)



How about something along the lines of

http://www.ilovegenerator.com/i-love-r-1842509

I think something similar was produced for a previous useR! conference

-Michael


--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

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


Re: [R] R stickers

2012-10-10 Thread peter dalgaard

On Oct 10, 2012, at 14:53 , Michael Friendly wrote:

 
 How about something along the lines of
 
 http://www.ilovegenerator.com/i-love-r-1842509
 
 I think something similar was produced for a previous useR! conference
 
 -Michael

...as a promo for Revolution R. Been there, done that, got the t-shirt...

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


[R] omega vs. alpha explanation

2012-10-10 Thread codec cat
Dear all

I wonder if someone can explain what is the main difference between omega
and alpha reliabilities?

I understand an omega reliability is based on hierarchical factor model as
shown in this 
graphhttp://rgm2.lab.nig.ac.jp/RGM_results/psych:omega.graph/omega.graph_002_big.png,
 and
alpha uses average inter-item correlations.

1. What I don't understand is, in what condition, omega reliability
coefficient would be higher than alpha coefficient,  and vice versa?

2. Can I assume if the correlations between the subfactors and the
variables are higher, the omega coefficient would also be higher  (as shown
in the omega 
graphhttp://rgm2.lab.nig.ac.jp/RGM_results/psych:omega.graph/omega.graph_002_big.png
)?

Any advice is appreciated!

Thanks.

[[alternative HTML version deleted]]

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


Re: [R] Summary using by() returns character arrays in a list

2012-10-10 Thread PIKAL Petr
Hi

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Alex van der Spek
 Sent: Wednesday, October 10, 2012 2:48 PM
 To: r-help@r-project.org
 Subject: [R] Summary using by() returns character arrays in a list
 
 I use by() to generate a summary statistics like so:
 
 Lbys - by(dat[Nidx], dat$LipTest, summary)
 
 where Nidx is an index vector with names picking out the columns in the
 data frame dat.
 
 This returns a list of character arrays (see below for str() output)
 where the columns are named correctly but the rownames are empty
 strings and the values are strings prepended with the summary
 statistic's name (e.g.
 Min., Median ).

Without knowledge of your data it is difficult to understand what is wrong.

If I use iris data set as input everything goes as expected
data(iris)
 summary(iris)
  Sepal.LengthSepal.Width Petal.LengthPetal.Width   
 Min.   :4.300   Min.   :2.000   Min.   :1.000   Min.   :0.100  
 1st Qu.:5.100   1st Qu.:2.800   1st Qu.:1.600   1st Qu.:0.300  
 Median :5.800   Median :3.000   Median :4.350   Median :1.300  
 Mean   :5.843   Mean   :3.057   Mean   :3.758   Mean   :1.199  
 3rd Qu.:6.400   3rd Qu.:3.300   3rd Qu.:5.100   3rd Qu.:1.800  
 Max.   :7.900   Max.   :4.400   Max.   :6.900   Max.   :2.500  
   Species  
 setosa:50  
 versicolor:50  
 virginica :50  



 by(iris, iris$Species, summary)
iris$Species: setosa
  Sepal.LengthSepal.Width Petal.LengthPetal.Width   
 Min.   :4.300   Min.   :2.300   Min.   :1.000   Min.   :0.100  
 1st Qu.:4.800   1st Qu.:3.200   1st Qu.:1.400   1st Qu.:0.200  
 Median :5.000   Median :3.400   Median :1.500   Median :0.200  
 Mean   :5.006   Mean   :3.428   Mean   :1.462   Mean   :0.246  
 3rd Qu.:5.200   3rd Qu.:3.675   3rd Qu.:1.575   3rd Qu.:0.300  
 Max.   :5.800   Max.   :4.400   Max.   :1.900   Max.   :0.600  
   Species  
 setosa:50  
 versicolor: 0  
 virginica : 0  

 
 
 I am reading the code of summary.data.frame() but can't figure out how
 I can change the action of that function to return list of numeric
 matrices with as rownames the summary statistic's name (Min., Max.
 etc) and as values the numeric values of the calculated summary
 statistic.

Just what do you not like on such output and how do you want the output 
structured?
Maybe you want aggregate, but without simple data it is hard to say.

aggregate(iris[1:2], list(iris$Species), summary)

Regards
Petr

 
 Any help much appreciated!
 Regards,
 Alex van der Spek
 
 
  str(Lbys)
 List of 2
  $: 'table' chr [1:6, 1:19] Min.   :-0.190   1st Qu.: 9.297  
 Median :10.373   Mean   :10.100   ...
   ..- attr(*, dimnames)=List of 2
   .. ..$ : chr [1:6] ...
   .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
 Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
  $ T38: 'table' chr [1:6, 1:19] Min.   :8.648   1st Qu.:8.920  
 Median :9.018   Mean   :9.027   ...
   ..- attr(*, dimnames)=List of 2
   .. ..$ : chr [1:6] ...
   .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
 Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
  - attr(*, dim)= int 2
  - attr(*, dimnames)=List of 1
   ..$ dat$LipTest: chr [1:2]  T38
  - attr(*, call)= language by.data.frame(data = dat[Nidx], INDICES =
 dat$LipTest, FUN = summary)
  - attr(*, class)= chr by
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] pattern matching

2012-10-10 Thread Gurubaramurugeshan, Arun

This looks like a conceptual question rather than a R question. PLEASE do read 
the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Arun Prasad Gurubaramurugeshan,
Senior Research Analyst


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of arunkumar
Sent: Wednesday, October 10, 2012 6:46 AM
To: r-help@r-project.org
Subject: [R] pattern matching

hi

My string contain 


string = The sales is good when my num1 between 1 to 5 . else the sales is 
poor.

i want to find the patten between 1 to 5 . between and to will be constant but 
the numbers would be changing. How to search for that pattern.

Please help



-
Thanks in Advance
Arun
--
View this message in context: 
http://r.789695.n4.nabble.com/pattern-matching-tp4645688.html
Sent from the R help mailing list archive at Nabble.com.

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

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


Re: [R] omega vs. alpha explanation

2012-10-10 Thread Bert Gunter
Advice:

Do not post here. This does not appear to be an R question. Post to a
statistics list like stats.stackexchange.com instead.

-- Bert

On Wed, Oct 10, 2012 at 6:42 AM, codec cat v.code...@gmail.com wrote:
 Dear all

 I wonder if someone can explain what is the main difference between omega
 and alpha reliabilities?

 I understand an omega reliability is based on hierarchical factor model as
 shown in this 
 graphhttp://rgm2.lab.nig.ac.jp/RGM_results/psych:omega.graph/omega.graph_002_big.png,
  and
 alpha uses average inter-item correlations.

 1. What I don't understand is, in what condition, omega reliability
 coefficient would be higher than alpha coefficient,  and vice versa?

 2. Can I assume if the correlations between the subfactors and the
 variables are higher, the omega coefficient would also be higher  (as shown
 in the omega 
 graphhttp://rgm2.lab.nig.ac.jp/RGM_results/psych:omega.graph/omega.graph_002_big.png
 )?

 Any advice is appreciated!

 Thanks.

 [[alternative HTML version deleted]]

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



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [R] Summary using by() returns character arrays in a list

2012-10-10 Thread Alex van der Spek
Thank you Petr,

Try this

str(by(iris, iris$Species, summary))

and you will see what is actually returned is a list of 3, each element
containing a character table, not a numeric table. The rownames of these
tables are empty but should contain the names of the summary stats.

I have a workaround now. Modified the summary.data.frame method to output
numeric values and not the character strings. The rownames I set
afterwards in a for loop. Still would like to know how to do this internal
to summary.data.frame though.

Regards,
Alex van der Spek

 Hi

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Alex van der Spek
 Sent: Wednesday, October 10, 2012 2:48 PM
 To: r-help@r-project.org
 Subject: [R] Summary using by() returns character arrays in a list

 I use by() to generate a summary statistics like so:

 Lbys - by(dat[Nidx], dat$LipTest, summary)

 where Nidx is an index vector with names picking out the columns in the
 data frame dat.

 This returns a list of character arrays (see below for str() output)
 where the columns are named correctly but the rownames are empty
 strings and the values are strings prepended with the summary
 statistic's name (e.g.
 Min., Median ).

 Without knowledge of your data it is difficult to understand what is
 wrong.

 If I use iris data set as input everything goes as expected
 data(iris)
 summary(iris)
   Sepal.LengthSepal.Width Petal.LengthPetal.Width
  Min.   :4.300   Min.   :2.000   Min.   :1.000   Min.   :0.100
  1st Qu.:5.100   1st Qu.:2.800   1st Qu.:1.600   1st Qu.:0.300
  Median :5.800   Median :3.000   Median :4.350   Median :1.300
  Mean   :5.843   Mean   :3.057   Mean   :3.758   Mean   :1.199
  3rd Qu.:6.400   3rd Qu.:3.300   3rd Qu.:5.100   3rd Qu.:1.800
  Max.   :7.900   Max.   :4.400   Max.   :6.900   Max.   :2.500
Species
  setosa:50
  versicolor:50
  virginica :50



 by(iris, iris$Species, summary)
 iris$Species: setosa
   Sepal.LengthSepal.Width Petal.LengthPetal.Width
  Min.   :4.300   Min.   :2.300   Min.   :1.000   Min.   :0.100
  1st Qu.:4.800   1st Qu.:3.200   1st Qu.:1.400   1st Qu.:0.200
  Median :5.000   Median :3.400   Median :1.500   Median :0.200
  Mean   :5.006   Mean   :3.428   Mean   :1.462   Mean   :0.246
  3rd Qu.:5.200   3rd Qu.:3.675   3rd Qu.:1.575   3rd Qu.:0.300
  Max.   :5.800   Max.   :4.400   Max.   :1.900   Max.   :0.600
Species
  setosa:50
  versicolor: 0
  virginica : 0



 I am reading the code of summary.data.frame() but can't figure out how
 I can change the action of that function to return list of numeric
 matrices with as rownames the summary statistic's name (Min., Max.
 etc) and as values the numeric values of the calculated summary
 statistic.

 Just what do you not like on such output and how do you want the output
 structured?
 Maybe you want aggregate, but without simple data it is hard to say.

 aggregate(iris[1:2], list(iris$Species), summary)

 Regards
 Petr


 Any help much appreciated!
 Regards,
 Alex van der Spek


  str(Lbys)
 List of 2
  $: 'table' chr [1:6, 1:19] Min.   :-0.190   1st Qu.: 9.297  
 Median :10.373   Mean   :10.100   ...
   ..- attr(*, dimnames)=List of 2
   .. ..$ : chr [1:6] ...
   .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
 Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
  $ T38: 'table' chr [1:6, 1:19] Min.   :8.648   1st Qu.:8.920  
 Median :9.018   Mean   :9.027   ...
   ..- attr(*, dimnames)=List of 2
   .. ..$ : chr [1:6] ...
   .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
 Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
  - attr(*, dim)= int 2
  - attr(*, dimnames)=List of 1
   ..$ dat$LipTest: chr [1:2]  T38
  - attr(*, call)= language by.data.frame(data = dat[Nidx], INDICES =
 dat$LipTest, FUN = summary)
  - attr(*, class)= chr by

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


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


Re: [R] pattern matching

2012-10-10 Thread Rui Barradas

Hello,

Try the following.

pattern - between [[:digit:]]+ to [[:digit:]]+

re - regexpr(pattern, string)
regmatches(string, re)

Hope this helps,

Rui Barradas
Em 10-10-2012 12:45, arunkumar escreveu:

hi

My string contain


string = The sales is good when my num1 between 1 to 5 . else the sales is
poor.

i want to find the patten between 1 to 5 . between and to will be constant
but the numbers would be changing. How to search for that pattern.

Please help



-
Thanks in Advance
 Arun
--
View this message in context: 
http://r.789695.n4.nabble.com/pattern-matching-tp4645688.html
Sent from the R help mailing list archive at Nabble.com.

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


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


[R] Generating random geographical coordinates

2012-10-10 Thread Poizot Emmanuel

Dear all,

I have two coordinates vectors, say X and Y of length n.
I want to generate for each couple of coordinates X1,Y1 X2,Y2 
X3,Y3Xn,Yn a random coordinate which is located in a square define 
as X +/- dx and Y +/- dy.
I saw the runif function which can generate for just one value at a time 
what I want  : runif(1, X - dx, X + dx) for X and runif(1, Y - dy, Y + 
dy) for Y.
I would like to know if there is not a more powerfull way in R to 
generate directly the set of random coordinates.

Regards

--
Emmanuel Poizot

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


Re: [R] impossible to fill point glyphs in a lattice plot

2012-10-10 Thread pbruneau
I don't understand why my questions never get posted on the mailing list...
The one above is still unresolved.



--
View this message in context: 
http://r.789695.n4.nabble.com/impossible-to-fill-point-glyphs-in-a-lattice-plot-tp4645695p4645699.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] se's and CI's for fitted lines in multivariate regression analysis

2012-10-10 Thread Sigrid
I’m entirely stumped on this particular issue and really hoping someone has
some advice for me.
 
I am running a covariant model in lm I would like to give the standard
errors or the confidence intervals for the fitted lines. I’ve been using the
dataset OrangeSprays where I want lines for each level of treatment over the
covariant ‘colpos’. I’ve been able to calculate intercepts and slopes for
each lines by adding up the parameters, but this does not make sense when
the comes to the se’s.  I’ve run the summary (model) function, but only get
the differences in standard error between lines. Also by running
confint(model), I have the same problem.

How can I get standard error per or the CI-interval for each fitted line?
I’ve attached the coding underneath.

Thank you,
Sigrid

 data(OrchardSprays)
 model-lm(decrease~rowpos+colpos+treatment+treatment:colpos)
 summary(model)




--
View this message in context: 
http://r.789695.n4.nabble.com/se-s-and-CI-s-for-fitted-lines-in-multivariate-regression-analysis-tp4645703.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] lm on matrix data

2012-10-10 Thread Baoqiang Cao
Hi,

I have a question about using lm on matrix, have to admit it is very
trivial but I just couldn't find the answer after searched the mailing
list and other online tutorial. It would be great if you could help.

I have a matrix trainx of 492(rows) by 220(columns) that is my x,
and trainy is 492 by 1. Also, I have the newdata testx which is 240
(rows) by 220 (columns). Here is what I got:

py - predict(lm(trainy ~ trainx ), data.frame(testx))
Warning message:
'newdata' had 240 rows but variable(s) found have 492 rows

The fitting formula I intended is: trainy ~ trainx[,1] + trainx[,2] +
.. +trainx[,220].

Any help, please?

Best,
Baoqiang

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


Re: [R] se's and CI's for fitted lines in multivariate regression analysis

2012-10-10 Thread Bert Gunter
?predict

Have you read An Inrtroduction  to R?

-- Bert

On Wed, Oct 10, 2012 at 6:49 AM, Sigrid s.stene...@gmail.com wrote:
 I’m entirely stumped on this particular issue and really hoping someone has
 some advice for me.

 I am running a covariant model in lm I would like to give the standard
 errors or the confidence intervals for the fitted lines. I’ve been using the
 dataset OrangeSprays where I want lines for each level of treatment over the
 covariant ‘colpos’. I’ve been able to calculate intercepts and slopes for
 each lines by adding up the parameters, but this does not make sense when
 the comes to the se’s.  I’ve run the summary (model) function, but only get
 the differences in standard error between lines. Also by running
 confint(model), I have the same problem.

 How can I get standard error per or the CI-interval for each fitted line?
 I’ve attached the coding underneath.

 Thank you,
 Sigrid

 data(OrchardSprays)
 model-lm(decrease~rowpos+colpos+treatment+treatment:colpos)
 summary(model)




 --
 View this message in context: 
 http://r.789695.n4.nabble.com/se-s-and-CI-s-for-fitted-lines-in-multivariate-regression-analysis-tp4645703.html
 Sent from the R help mailing list archive at Nabble.com.

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



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [R] Filling points in a trellis object

2012-10-10 Thread ilai
On Wed, Oct 10, 2012 at 4:56 AM, Pierrick Bruneau pbrun...@gmail.comwrote:

 With the following code :

 dat1 - matrix(nrow=4, ncol=2)
 dat1[1,] - c(-2, 1)
 dat1[2,] - c(-1.7, 0.9)
 dat1[3,] - c(0.1, 0.6)
 dat1[4,] - c(0.5, 0.5)
 theplot - xyplot(V2 ~ V1, as.data.frame(dat1), pch=c(4,1,5,4))
 plot(theplot, prefix=theplot) # for a predictable name
 grid.edit(theplot.xyplot.points.panel.1.1, gp=gpar(lwd=c(2,2,2,2),
 cex=c(2,3,3,2),
   col=1, fill=c(transparent, grey, grey, transparent)))


 I would like to plot 4 points, and have the circle and diamond shapes
 filledwith grey. What am I missing ?

 The correct pch+col (fill is for polygons) specification. Try

theplot - xyplot(V2 ~ V1, as.data.frame(dat1), pch = c(4,19,18,4) , col =
c(1,'grey35','grey65',1) )
plot(theplot, prefix=theplot) # for a predictable name
grid.edit(theplot.xyplot.points.panel.1.1, gp = gpar( lwd = c(2,2,2,2) ,
cex = c(2,3,3,2) ) )

BTW in R you don't need to declare objects, i.e.

dat1 - matrix(c(-2,-1.7,0.1,0.5,1,.9,.6,.5), nrow=4, ncol=2)

works just as well (or IMHO better).
Similarly, your plot can be generated in one go, no need to plot = edit,
just put in the right args to begin with.

HTH




Thanks by advance for your help,
 Pierrick Bruneau
 Research Fellow
 CRP Gabriel Lippmann

 [[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


[R] write.csv with append = TRUE

2012-10-10 Thread Alex van der Spek
Is there a way to make any of the write functions (.table or .csv) append
to the same file?

I get this warning message and do not know how to enable the appending.

Warning messages:
1: In write.csv(names(Lbys)[c], fo, append = TRUE) :
  attempt to set 'append' ignored
2: In write.csv(Lbys[[c]], fo, append = TRUE) :
  attempt to set 'append' ignored


Regards,
Alex van der Spek

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


Re: [R] Filling points in a trellis object

2012-10-10 Thread ilai
On Wed, Oct 10, 2012 at 4:56 AM, Pierrick Bruneau pbrun...@gmail.comwrote:

 With the following code :

 dat1 - matrix(nrow=4, ncol=2)
 dat1[1,] - c(-2, 1)
 dat1[2,] - c(-1.7, 0.9)
 dat1[3,] - c(0.1, 0.6)
 dat1[4,] - c(0.5, 0.5)
 theplot - xyplot(V2 ~ V1, as.data.frame(dat1), pch=c(4,1,5,4))
 plot(theplot, prefix=theplot) # for a predictable name
 grid.edit(theplot.xyplot.points.panel.1.1, gp=gpar(lwd=c(2,2,2,2),
 cex=c(2,3,3,2),
   col=1, fill=c(transparent, grey, grey, transparent)))


 I would like to plot 4 points, and have the circle and diamond shapes
 filledwith grey. What am I missing ?

 The correct pch+col (fill is for polygons) specification. Try

theplot - xyplot(V2 ~ V1, as.data.frame(dat1), pch = c(4,19,18,4) , col =
c(1,'grey35','grey65',1) )
plot(theplot, prefix=theplot) # for a predictable name
grid.edit(theplot.xyplot.points.panel.1.1, gp = gpar( lwd = c(2,2,2,2) ,
cex = c(2,3,3,2) ) )

BTW in R you don't need to declare objects, i.e.

dat1 - matrix(c(-2,-1.7,0.1,0.5,1,.9,.6,.5), nrow=4, ncol=2)

works just as well (or IMHO better).
Similarly, your plot can be generated in one go, no need to plot = edit,
just put in the right args to begin with.

HTH




Thanks by advance for your help,
 Pierrick Bruneau
 Research Fellow
 CRP Gabriel Lippmann

 [[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


Re: [R] omega vs. alpha explanation

2012-10-10 Thread R. Michael Weylandt
Your subject line also suggests you might consult with your local priest. ;-)

Cheers,
RMW

On Wed, Oct 10, 2012 at 2:51 PM, Bert Gunter gunter.ber...@gene.com wrote:
 Advice:

 Do not post here. This does not appear to be an R question. Post to a
 statistics list like stats.stackexchange.com instead.

 -- Bert

 On Wed, Oct 10, 2012 at 6:42 AM, codec cat v.code...@gmail.com wrote:
 Dear all

 I wonder if someone can explain what is the main difference between omega
 and alpha reliabilities?

 I understand an omega reliability is based on hierarchical factor model as
 shown in this 
 graphhttp://rgm2.lab.nig.ac.jp/RGM_results/psych:omega.graph/omega.graph_002_big.png,
  and
 alpha uses average inter-item correlations.

 1. What I don't understand is, in what condition, omega reliability
 coefficient would be higher than alpha coefficient,  and vice versa?

 2. Can I assume if the correlations between the subfactors and the
 variables are higher, the omega coefficient would also be higher  (as shown
 in the omega 
 graphhttp://rgm2.lab.nig.ac.jp/RGM_results/psych:omega.graph/omega.graph_002_big.png
 )?

 Any advice is appreciated!

 Thanks.

 [[alternative HTML version deleted]]

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



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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

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


Re: [R] impossible to fill point glyphs in a lattice plot

2012-10-10 Thread R. Michael Weylandt
On Wed, Oct 10, 2012 at 2:07 PM, pbruneau pbrun...@gmail.com wrote:
 I don't understand why my questions never get posted on the mailing list...
 The one above is still unresolved.


Probably because you post through Nabble which requires manual
intervention to allow posts rather than subscribing to the list
directly at the link below so you can post unfiltered. I did see a
version of this which looks non-Nabble-ish, however, but it was only
about 20-30 minutes ago: give it some time.

Cheers,
Michael

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


Re: [R] write.csv with append = TRUE

2012-10-10 Thread R. Michael Weylandt
write.table() should append just fine. write.csv() doesn't append I'm
told because there's no guarantee it matches the column headings of
the original file. That said, write.table(..., append = TRUE, sep =
,) is a pretty good approximation.

Cheers,
Michael

On Wed, Oct 10, 2012 at 3:44 PM, Alex van der Spek do...@xs4all.nl wrote:
 Is there a way to make any of the write functions (.table or .csv) append
 to the same file?

 I get this warning message and do not know how to enable the appending.

 Warning messages:
 1: In write.csv(names(Lbys)[c], fo, append = TRUE) :
   attempt to set 'append' ignored
 2: In write.csv(Lbys[[c]], fo, append = TRUE) :
   attempt to set 'append' ignored


 Regards,
 Alex van der Spek

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

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


Re: [R] Generating random geographical coordinates

2012-10-10 Thread R. Michael Weylandt
Change 1 to some other number to get more points from runif()

More generally, take a look at An Introduction to R and read most
everything you can find on the topic of vectorization. If you don't
know how to get An Introduction to R, try typing help.start() at
your prompt and it should happen automatically.

Cheers,
Michael

On Wed, Oct 10, 2012 at 3:15 PM, Poizot Emmanuel
emmanuel.poi...@cnam.fr wrote:
 Dear all,

 I have two coordinates vectors, say X and Y of length n.
 I want to generate for each couple of coordinates X1,Y1 X2,Y2 X3,Y3Xn,Yn
 a random coordinate which is located in a square define as X +/- dx and Y
 +/- dy.
 I saw the runif function which can generate for just one value at a time
 what I want  : runif(1, X - dx, X + dx) for X and runif(1, Y - dy, Y + dy)
 for Y.
 I would like to know if there is not a more powerfull way in R to generate
 directly the set of random coordinates.
 Regards

 --
 Emmanuel Poizot


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


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


Re: [R] Generating random geographical coordinates

2012-10-10 Thread Berend Hasselman

On 10-10-2012, at 16:15, Poizot Emmanuel emmanuel.poi...@cnam.fr wrote:

 Dear all,
 
 I have two coordinates vectors, say X and Y of length n.
 I want to generate for each couple of coordinates X1,Y1 X2,Y2 X3,Y3Xn,Yn 
 a random coordinate which is located in a square define as X +/- dx and Y +/- 
 dy.
 I saw the runif function which can generate for just one value at a time what 
 I want  : runif(1, X - dx, X + dx) for X and runif(1, Y - dy, Y + dy) for Y.
 I would like to know if there is not a more powerfull way in R to generate 
 directly the set of random coordinates.

Yes there is. Just do

?runif

to get help on runif.

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


Re: [R] Generating random geographical coordinates

2012-10-10 Thread R. Michael Weylandt
On Wed, Oct 10, 2012 at 4:09 PM, Poizot Emmanuel
emmanuel.poi...@cnam.fr wrote:
 Le 10/10/2012 17:02, R. Michael Weylandt a écrit :

 Change 1 to some other number to get more points from runif()

 More generally, take a look at An Introduction to R and read most
 everything you can find on the topic of vectorization. If you don't
 know how to get An Introduction to R, try typing help.start() at
 your prompt and it should happen automatically.

 Cheers,
 Michael

 On Wed, Oct 10, 2012 at 3:15 PM, Poizot Emmanuel
 emmanuel.poi...@cnam.fr wrote:

 Dear all,

 I have two coordinates vectors, say X and Y of length n.
 I want to generate for each couple of coordinates X1,Y1 X2,Y2
 X3,Y3Xn,Yn
 a random coordinate which is located in a square define as X +/- dx and Y
 +/- dy.
 I saw the runif function which can generate for just one value at a time
 what I want  : runif(1, X - dx, X + dx) for X and runif(1, Y - dy, Y +
 dy)
 for Y.
 I would like to know if there is not a more powerfull way in R to
 generate
 directly the set of random coordinates.
 Regards

 --
 Emmanuel Poizot


 If I put say 10 as first argument of runif, I will have 10 random values in
 a square of size X - dx, X + dx and Y - dy, Y + dy for example. That not
 want I'm looking for. I would like to have just one random coordinate in
 this square but for each couple of coordinates X1,Y1 X2,Y2 X3,Y3Xn,Yn.
 Hope it's more clear.


Yes,

In that case, just stick your X1, X2, etc. in a vector; same with Y1,
Y2. and pass those to runif() as well. E.g.,

X - c(1,2,3,4,5)
Y - c(5,4,3,2,1)

x_points - runif(5, X-1, X+1)
y_points - runif(5, Y-1, Y+1)

and it will work. You can even wrap this in a function

points_maker - function(X, Y, dx = 0.1, dy = dx, n = max(length(X), length(Y)){
   cbind(x = runif(n, X - dx, X + dx), y = runif(n, Y - dy, Y + dy))
}

but it might take you a few hours all of what's going on there.
Reading the tutorial I pushed will certainly help with that as well.

Cheers,
Michael

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


Re: [R] se's and CI's for fitted lines in multivariate regression analysis

2012-10-10 Thread Sigrid
Hi Bert,

I just looked at An Introduction to R - and I do apologize if my questions
are trivial. I see that they use predict as a function in lm, but I'm not
sure how to incorporate it into a command.


Thank you,
S



--
View this message in context: 
http://r.789695.n4.nabble.com/se-s-and-CI-s-for-fitted-lines-in-multivariate-regression-analysis-tp4645703p4645715.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] write.csv with append = TRUE

2012-10-10 Thread Duncan Murdoch

On 10/10/2012 10:56 AM, R. Michael Weylandt wrote:

write.table() should append just fine. write.csv() doesn't append I'm
told because there's no guarantee it matches the column headings of
the original file. That said, write.table(..., append = TRUE, sep =
,) is a pretty good approximation.


You may also want dec=. and qmethod=double.  I forget if the row 
name defaults are equal...


Duncan Murdoch



Cheers,
Michael

On Wed, Oct 10, 2012 at 3:44 PM, Alex van der Spek do...@xs4all.nl wrote:
 Is there a way to make any of the write functions (.table or .csv) append
 to the same file?

 I get this warning message and do not know how to enable the appending.

 Warning messages:
 1: In write.csv(names(Lbys)[c], fo, append = TRUE) :
   attempt to set 'append' ignored
 2: In write.csv(Lbys[[c]], fo, append = TRUE) :
   attempt to set 'append' ignored


 Regards,
 Alex van der Spek

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

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


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


Re: [R] Summary using by() returns character arrays in a list

2012-10-10 Thread Rui Barradas

Hello,

If 'by' is giving you trouble, why not 'aggregate'?

agg.df - aggregate(iris, list(iris$Species), FUN = summary)
str(agg.df)

Hope this helps,

Rui Barradas
Em 10-10-2012 15:02, Alex van der Spek escreveu:

Thank you Petr,

Try this

str(by(iris, iris$Species, summary))

and you will see what is actually returned is a list of 3, each element
containing a character table, not a numeric table. The rownames of these
tables are empty but should contain the names of the summary stats.

I have a workaround now. Modified the summary.data.frame method to output
numeric values and not the character strings. The rownames I set
afterwards in a for loop. Still would like to know how to do this internal
to summary.data.frame though.

Regards,
Alex van der Spek


Hi


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Alex van der Spek
Sent: Wednesday, October 10, 2012 2:48 PM
To: r-help@r-project.org
Subject: [R] Summary using by() returns character arrays in a list

I use by() to generate a summary statistics like so:

Lbys - by(dat[Nidx], dat$LipTest, summary)

where Nidx is an index vector with names picking out the columns in the
data frame dat.

This returns a list of character arrays (see below for str() output)
where the columns are named correctly but the rownames are empty
strings and the values are strings prepended with the summary
statistic's name (e.g.
Min., Median ).

Without knowledge of your data it is difficult to understand what is
wrong.

If I use iris data set as input everything goes as expected
data(iris)

summary(iris)

   Sepal.LengthSepal.Width Petal.LengthPetal.Width
  Min.   :4.300   Min.   :2.000   Min.   :1.000   Min.   :0.100
  1st Qu.:5.100   1st Qu.:2.800   1st Qu.:1.600   1st Qu.:0.300
  Median :5.800   Median :3.000   Median :4.350   Median :1.300
  Mean   :5.843   Mean   :3.057   Mean   :3.758   Mean   :1.199
  3rd Qu.:6.400   3rd Qu.:3.300   3rd Qu.:5.100   3rd Qu.:1.800
  Max.   :7.900   Max.   :4.400   Max.   :6.900   Max.   :2.500
Species
  setosa:50
  versicolor:50
  virginica :50




by(iris, iris$Species, summary)

iris$Species: setosa
   Sepal.LengthSepal.Width Petal.LengthPetal.Width
  Min.   :4.300   Min.   :2.300   Min.   :1.000   Min.   :0.100
  1st Qu.:4.800   1st Qu.:3.200   1st Qu.:1.400   1st Qu.:0.200
  Median :5.000   Median :3.400   Median :1.500   Median :0.200
  Mean   :5.006   Mean   :3.428   Mean   :1.462   Mean   :0.246
  3rd Qu.:5.200   3rd Qu.:3.675   3rd Qu.:1.575   3rd Qu.:0.300
  Max.   :5.800   Max.   :4.400   Max.   :1.900   Max.   :0.600
Species
  setosa:50
  versicolor: 0
  virginica : 0



I am reading the code of summary.data.frame() but can't figure out how
I can change the action of that function to return list of numeric
matrices with as rownames the summary statistic's name (Min., Max.
etc) and as values the numeric values of the calculated summary
statistic.

Just what do you not like on such output and how do you want the output
structured?
Maybe you want aggregate, but without simple data it is hard to say.

aggregate(iris[1:2], list(iris$Species), summary)

Regards
Petr


Any help much appreciated!
Regards,
Alex van der Spek



str(Lbys)

List of 2
  $: 'table' chr [1:6, 1:19] Min.   :-0.190   1st Qu.: 9.297  
Median :10.373   Mean   :10.100   ...
   ..- attr(*, dimnames)=List of 2
   .. ..$ : chr [1:6] ...
   .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
  $ T38: 'table' chr [1:6, 1:19] Min.   :8.648   1st Qu.:8.920  
Median :9.018   Mean   :9.027   ...
   ..- attr(*, dimnames)=List of 2
   .. ..$ : chr [1:6] ...
   .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
  - attr(*, dim)= int 2
  - attr(*, dimnames)=List of 1
   ..$ dat$LipTest: chr [1:2]  T38
  - attr(*, call)= language by.data.frame(data = dat[Nidx], INDICES =
dat$LipTest, FUN = summary)
  - attr(*, class)= chr by

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

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


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


Re: [R] se's and CI's for fitted lines in multivariate regression analysis

2012-10-10 Thread Rui Barradas

Hello,

Your model is equivalent to the model below. As for standard errors, try 
predict.lm with the appropriate argument.


?predict.lm
model - lm(decrease ~ rowpos + colpos*treatment, data = OrchardSprays)
predict(model, se.fit = TRUE, interval = confidence)

Hope this helps,

Rui Barradas
Em 10-10-2012 14:49, Sigrid escreveu:

I’m entirely stumped on this particular issue and really hoping someone has
some advice for me.
  
I am running a covariant model in lm I would like to give the standard

errors or the confidence intervals for the fitted lines. I’ve been using the
dataset OrangeSprays where I want lines for each level of treatment over the
covariant ‘colpos’. I’ve been able to calculate intercepts and slopes for
each lines by adding up the parameters, but this does not make sense when
the comes to the se’s.  I’ve run the summary (model) function, but only get
the differences in standard error between lines. Also by running
confint(model), I have the same problem.

How can I get standard error per or the CI-interval for each fitted line?
I’ve attached the coding underneath.

Thank you,
Sigrid


data(OrchardSprays)
model-lm(decrease~rowpos+colpos+treatment+treatment:colpos)
summary(model)




--
View this message in context: 
http://r.789695.n4.nabble.com/se-s-and-CI-s-for-fitted-lines-in-multivariate-regression-analysis-tp4645703.html
Sent from the R help mailing list archive at Nabble.com.

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


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


[R] histogram corelation plots

2012-10-10 Thread sagarnikam123
i want to show histogram in innovative way (good if interactive) in html
report..is threre any tutorials/hint
also there is any package to show correalation plot



--
View this message in context: 
http://r.789695.n4.nabble.com/histogram-corelation-plots-tp4645726.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] plot separate groups with plotmeans()

2012-10-10 Thread Bart Toonen
Hi,

This answer may be a bit overdue, but I had a similar problem and it took 
me quite some time to find a good solution. When searching with google, 
your post kept showing up, so I post this to help others.
The command that worked for me was interaction.plot. 
Example:
x - data.frame(Score=rnorm(100), Time=rep(1:5, 
20),Group=factor(rep(c(A,B),50)))
interaction.plot(x$Group,x$Time,x$Score)

Note, I used 5 Time groups; with 10 groups, no lines showed up.


Bart.

Op woensdag 9 november 2011 01:19:54 UTC+1 schreef Jon Zadra het volgende:

 Hi,

 I often use plotmeans() from the gplots package to quickly visualize a 
 pattern of change.  I would like to be able to plot separate lines for 
 different groups, but the function gives an error when a grouping 
 variable is included in the formula argument.

 For instance,
   require(gplots)
   x - data.frame(Score=rnorm(100), Time=rep(1:10, 10), 
 Group=factor(rep(c(A,B),50)))
   plotmeans(Score ~ Time, x) #works fine
   plotmeans(Score ~ Time * Group, x)
 Error in .subset2(x, i, exact = exact) :
attempt to select more than one element
   plotmeans(Score ~ Time | Group, x)
 Error in ns - 1 : non-numeric argument to binary operator
 In addition: Warning message:
 In Ops.factor(Time, Group) : | not meaningful for factors

 The help for plotmeans() states that it accepts a formula object 
 including a grouping variable.  There is no other grouping argument 
 listed.  Any help is appreciated, including pointing to a more robust 
 function for plotting means.

 Thanks,

 Jon
 -- 
 Jon Zadra
 Department of Psychology
 University of Virginia
 P.O. Box 400400
 Charlottesville VA 22904
 (434) 982-4744
 email: za...@virginia.edu javascript:
 http://www.google.com/calendar/embed?src=jzadra%40gmail.com
 __
 r-h...@r-project.org javascript: mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] history() does not work?

2012-10-10 Thread Christian Hoffmann

Hi,

 history()

gives Error in savehistory(file) : no history available to save

although I can scroll throu history with C^uparrow an C^downarrow.

How can I make history() work and/or show the current history in a file, 
so that I can choose from previous commands?


The web did not throw up anything useful.

TIA  --Christian

--
Christian W. Hoffmann,
CH - 8915 Hausen am Albis, Switzerland
Rigiblickstrasse 15 b, Tel.+41-44-7640853
c-w.hoffm...@sunrise.ch,
christ...@echoffmann.ch,
www.echoffmann.ch

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


Re: [R] history() does not work?

2012-10-10 Thread Steve Lianoglou
Hi,

On Wed, Oct 10, 2012 at 12:03 PM, Christian Hoffmann
c-w.hoffm...@sunrise.ch wrote:
 Hi,

 history()

 gives Error in savehistory(file) : no history available to save

 although I can scroll throu history with C^uparrow an C^downarrow.

 How can I make history() work and/or show the current history in a file, so
 that I can choose from previous commands?

 The web did not throw up anything useful.

Out of curiosity, when you call:

R capabilities()['cledit']

Do you get `FALSE`?

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

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


Re: [R] synthetic distribution built upon set of discrete values

2012-10-10 Thread Greg Snow
In addition to Bert's answer.  If the 0 and/or 100 are hard boundaries
(you know that values cannot be outside those values) and you have
data points near one or both of the bounds, then the functions in the
logspline package may be of use.

On Tue, Oct 9, 2012 at 2:38 PM, Bert Gunter gunter.ber...@gene.com wrote:
 ??
 Perhaps:

 ?density
 ?plot.density

 -- Bert

 On Tue, Oct 9, 2012 at 1:06 PM, Thomas Carrié tho...@free.fr wrote:
 Hello,

 I have a vector of double values between 0 and 100

 I would like to draw a synthetic distribution of this vector to see
 graphically how the values are distributed between 0 and 100.

 How can I do that ?

 Thomas

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



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

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


Re: [R] Connect R and Lyx in UBUNTU

2012-10-10 Thread Yihui Xie
What do you mean by connect? And how did you succeed under Windows?
i.e. what is your expectation?

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Wed, Oct 10, 2012 at 4:57 AM, ATANU ata.s...@gmail.com wrote:
 Recently I have been using R in UBUNTU 11.10.
 Can anyone please tell me how to connect R and Lyx in UBUNTU? I have been
 successful in doing that under Windows but I got stuck for Ubuntu.

 Thanks in advance

 -Atanu


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


Re: [R] a merge() problem

2012-10-10 Thread Sam Steingold
 * Prof Brian Ripley evc...@fgngf.bk.np.hx [2012-10-08 06:37:07 +0100]:

 On 08/10/2012 02:57, Peter Ehlers wrote:
 On 2012-10-07 14:44, Sam Steingold wrote:
 * Peter Ehlers ruy...@hpnytnel.pn [2012-10-07 10:03:42 -0700]:

 On 2012-10-07 08:34, Sam Steingold wrote:
 I know it does not look very good - using the same column names to mean
 different things in different data frames, but here you go:
 --8---cut here---start-8---
 x - data.frame(a=c(1,2,3),b=c(4,5,6))
 y - data.frame(b=c(1,2),a=c(a,b))
 merge(x,y,by.x=a,by.y=b,all.x=TRUE,suffixes=c(,y))
 a ba
 1 1 4a
 2 2 5b
 3 3 6 NA
 Warning message:
 In merge.data.frame(x, y, by.x = a, by.y = b, all.x = TRUE) :
 column name 'a' is duplicated in the result
 --8---cut here---end---8---
 why is the suffixes argument ignored?
 I mean, I expected that the second a to be a.y.

 The 'suffixes' argument refers to _non-by_ names only (as per ?merge).

 yes, but a in y is _not_ a by-name.

 Yes, it is.
 The set of by-names is the union of names specified by by.x and by.y,
 in your case: c(a, b).
 I suppose that a case could be made that ?merge does not spell that
 out sufficiently explicitly.

 It does in 'Details' (and where else would there be such a detail?)
 E.g. in R 2.15.1:

  If the remaining columns in the data frames have any common names,
  these have ‘suffixes’ (‘.x’ and ‘.y’ by default) appended to
  try to make the names of the result unique.  If this is not
  possible, an error is thrown.

 Note *remaining*, and read what comes before that.

I read the docs and re-read them after seeing your message and, with all
due respect, I fail to interpret them the way you do:
The doc speaks about columns to merge on, not column names.
I specify both by.x and by.y, thus I do not specify the column y$b.

Note, however, that I do not want the doc fixed, I want the behavior modified.
I see no advantage in the current behavior (a warning + duplicate column
names) as opposed to the behavior I expected (renaming the column in the
result to b.y).

Thanks a lot for your kind replies and insight!

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://americancensorship.org http://iris.org.il
http://jihadwatch.org http://ffii.org http://truepeace.org
Never argue with the person who is preparing your parachute.

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


Re: [R] own function: computing time

2012-10-10 Thread William Dunlap
Are the points you are looking for (those data points with no other data
points above or to the right of them) a subset of the convex hull of the
data points?  If so, chull(x,y) can quickly give you the points on the convex
hull (typically a fairly small number) and you can look through them for
the ones you want.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of tonja.krue...@web.de
 Sent: Wednesday, October 10, 2012 3:16 AM
 To: r-help@r-project.org
 Subject: [R] own function: computing time
 
 Hi all,
 
 I wrote a function that actually does what I want it to do, but it tends to 
 be very slow for
 large amount of data. On my computer it takes 5.37 seconds for 16000 data 
 points and
 21.95 seconds for 32000 data points. As my real data consists of 1800 
 data points it
 would take ages to use the function as it is now.
 Could someone help me to speed up the calculation?
 
 Thank you, Tonja
 
 system.time({
 x - runif(32000)
 y - runif(32000)
 
 xy - cbind(x,y)
 
 outer - function(z){
 !any(x  z[1]  y  z[2])}
 j - apply(xy,1, outer)
 
 plot(x,y)
 points(x[j],y[j],col=green)
 
 })
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] own function: computing time

2012-10-10 Thread William Dunlap
No, the desired points are not a subset of the convex hull.
E.g., x=c(0,1:5), y=c(0,1/(1:5)).

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: William Dunlap
 Sent: Wednesday, October 10, 2012 9:46 AM
 To: 'tonja.krue...@web.de'; r-help@r-project.org
 Subject: RE: [R] own function: computing time
 
 Are the points you are looking for (those data points with no other data
 points above or to the right of them) a subset of the convex hull of the
 data points?  If so, chull(x,y) can quickly give you the points on the convex
 hull (typically a fairly small number) and you can look through them for
 the ones you want.
 
 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com
 
 
  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
  Behalf
  Of tonja.krue...@web.de
  Sent: Wednesday, October 10, 2012 3:16 AM
  To: r-help@r-project.org
  Subject: [R] own function: computing time
 
  Hi all,
 
  I wrote a function that actually does what I want it to do, but it tends to 
  be very slow
 for
  large amount of data. On my computer it takes 5.37 seconds for 16000 data 
  points and
  21.95 seconds for 32000 data points. As my real data consists of 1800 
  data points
 it
  would take ages to use the function as it is now.
  Could someone help me to speed up the calculation?
 
  Thank you, Tonja
 
  system.time({
  x - runif(32000)
  y - runif(32000)
 
  xy - cbind(x,y)
 
  outer - function(z){
  !any(x  z[1]  y  z[2])}
  j - apply(xy,1, outer)
 
  plot(x,y)
  points(x[j],y[j],col=green)
 
  })
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

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


[R] Contacting Delphi ??

2012-10-10 Thread Christian Hoffmann
What does the sudden appearance of Contacting Delphi ..the oracle 
is unavailable.

We apologize for any inconvenience. mean? A bug? It appears at plotting.

Thanks

Christian

--
Christian W. Hoffmann,
CH - 8915 Hausen am Albis, Switzerland
Rigiblickstrasse 15 b, Tel.+41-44-7640853
c-w.hoffm...@sunrise.ch,
christ...@echoffmann.ch,
www.echoffmann.ch

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


[R] glmmPQL and spatial correlation

2012-10-10 Thread Luis Huckstadt
Hi all,

I'm running into some computer issues when trying to run a binomial model
for spatially correlated data using glmmPQL and was wondering if anyone
could help me out.
My whole dataset consists of about 300,000 points for which I have a suite
of environmental variables (I'm trying to come up with a habitat model for
a species of seal, using real (presence) and simulated dives (absence) as
my response variable).
Since my dataset is so large, I split it into thirds and ran the model
without spatial correlation. However, when checking my results, I did get a
spatial correlation in the residuals, which I'm trying to incorporate using
a variogram (spherical). The problem is that  when I run it  for my 1/3 of
my data (about 70k points), the calculatations go on forever. I was running
the first model for over a week and was still not getting past the first
iteration.

This is the model I used

M1.f.Spa - glmmPQL(presence ~ sst + tmax100 + tbot + sss + ssu + tmax100d
+ sbot, random = ~1|fPTT, family = binomial, correlation =
corSpher(c(91323.53,0.4279603), form =~ x+y, nugget = TRUE), data =
sample.df1)

This week, I tried a different approach and split the 70k subset into
smaller datasets of 10,000 points, and now the model runs much faster (just
a couple of hours tops), Yet the output of these models changes with
regards to the significance of one variable, which makes me think that I
need a larger dataset than 10,000 points.

Does someone have a suggestion on how to improve/run this code with the
spatial correlation for a larger dataset than 10,000 which wouldn't take
weeks to run?

I'm working with an Intel Core i7, 12 Gb RAM (plus a couple of 100 Gbs in
virtual memory), in Windows  7 64-bit.

Thanks for your help,

Luis A. Huckstadt, Ph.D.
Department of Ecology and Evolutionary Biology
University of California Santa Cruz
Long Marine Lab
100 Shaffer Road
Santa Cruz, CA  95060

[[alternative HTML version deleted]]

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


Re: [R] history() does not work?

2012-10-10 Thread Steve Lianoglou
On Wed, Oct 10, 2012 at 12:52 PM, Christian Hoffmann
c-w.hoffm...@sunrise.ch wrote:

 Am 10.10.12 18:17, schrieb Steve Lianoglou:

 Hi,

 On Wed, Oct 10, 2012 at 12:03 PM, Christian Hoffmann
 c-w.hoffm...@sunrise.ch wrote:

 Hi,

 history()

 gives Error in savehistory(file) : no history available to save

 although I can scroll throu history with C^uparrow an C^downarrow.

 How can I make history() work and/or show the current history in a file,
 so
 that I can choose from previous commands?

 The web did not throw up anything useful.

 Out of curiosity, when you call:

 R capabilities()['cledit']

 Do you get `FALSE`?

 Yes, I do. So what do you suggest?

This suggests that R is running w/o readline support enabled -- which
is necessary for `history()` to work.

I don't really know much about R running on windows, so I'm not sure
if what you are seeing is normal or strange.

I don't see any mention of no `history()` support in in the R for Window FAQ:
http://cran.r-project.org/bin/windows/base/rw-FAQ.html

So my *guess* is that you should be able to get this to work rather easily.

How are you running R? I mean, is it some R GUI? Rstudio? Emacs/ESS
(in which case, it is run w/o readline)? Rcmdr?

I'm just stabbing at the dark right now -- I'm sure a windows useR
will swoop in soon w/ the right stuff if we don't sort it out this
way.

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

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


[R] history() does not work? 2

2012-10-10 Thread Christian Hoffmann

Hi,


history()


gives Error in savehistory(file) : no history available to save

although I can scroll throu history with C^uparrow an C^downarrow.

How can I make history() work

and/or show the current history in a *file*, so that I can choose from 
previous commands?


The notion of having readline enabled: How can I do that on mac osx? I 
work with


R version 2.15.1 (2012-06-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

TIA  --Christian

--
Christian W. Hoffmann,
CH - 8915 Hausen am Albis, Switzerland
Rigiblickstrasse 15 b, Tel.+41-44-7640853
c-w.hoffm...@sunrise.ch,
christ...@echoffmann.ch,
www.echoffmann.ch

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


[R] Exporting summary plm results to latex

2012-10-10 Thread Sebastian Barfort
Dear all, 

I am trying to export my fixed effect results to Latex. I am using the plm 
package with the summary function. However, it does not look like apsrtable, 
stargazer, or any other package can accompany using the plm package. 

I am interested in a classic table with the coefficient in one row followed by 
the standard error in paranthesis in the next row and stars by the coefficient 
to show relevant coefficient level. 

coefficient 1   xxx**
(xxx)

Here is a reproducible example:

library(plm)

#generating some data
x - rnorm(270)
y - rnorm(270)
t - rep(1:3,30)
i - rep(1:90, each=3) 

data - data.frame(i,t,x,y)

fe - plm(y~x,data=data,model=within) 
summary(fe)

If there is an alternative to using the plm package that works with any of the 
export to latex packages, I would be very interested to know. Otherwise, any 
ideas of how to solve this problem are very welcome. I almost exclusively use 
fixed effect panel models, and the problem of exporting results to Latex is one 
of the things preventing me from switching entirely from Stata to R. 


Kind regards, 
Sebastian


[[alternative HTML version deleted]]

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


Re: [R] Summary using by() returns character arrays in a list

2012-10-10 Thread arun
HI,

May be this helps you:

Using the dataset iris:

by.list-by(iris, iris$Species, summary)
dat1-do.call(rbind,lapply(by.list,function(x) gsub(.*\\:,,x)))
row.names(dat1)-paste(rep(unlist(dimnames(by.list),use.names=F),each=6),unlist(lapply(lapply(by.list,`[`,1:6),function(x)
 gsub(\\:.*,,x)),use.names=F),sep=:)
 dat2-data.frame(dat1)
colnames(dat2)-colnames(dat1)
dat2[]-sapply(dat2,function(x) as.numeric(as.character(x)))
 head(dat2,8)
#    Sepal.Length  Sepal.Width  Petal.Length  Petal.Width
#setosa:Min.    4.300    2.300 1.000    0.100
#setosa:1st Qu. 4.800    3.200 1.400    0.200
#setosa:Median  5.000    3.400 1.500    0.200
#setosa:Mean    5.006    3.428 1.462    0.246
#setosa:3rd Qu. 5.200    3.675 1.575    0.300
#setosa:Max.    5.800    4.400 1.900    0.600
#versicolor:Min.    4.900    2.000 3.000    1.000
#versicolor:1st Qu. 5.600    2.525 4.000    1.200
 Species
#setosa:Min.   50
#setosa:1st Qu. 0
#setosa:Median  0
#setosa:Mean   NA
#setosa:3rd Qu.    NA
#setosa:Max.   NA
#versicolor:Min.    0
#versicolor:1st Qu.    50

 str(dat2)
#'data.frame':    18 obs. of  5 variables:
# $  Sepal.Length: num  4.3 4.8 5 5.01 5.2 ...
# $  Sepal.Width : num  2.3 3.2 3.4 3.43 3.67 ...
# $  Petal.Length: num  1 1.4 1.5 1.46 1.57 ...
# $  Petal.Width : num  0.1 0.2 0.2 0.246 0.3 ...
 #$   Species: num  50 0 0 NA NA NA 0 50 0 NA ...

Not sure, if you need the last column.
I agree that aggregate() or ddply() will be easier.
A.K.


- Original Message -
From: Alex van der Spek do...@xs4all.nl
To: r-help@r-project.org
Cc: 
Sent: Wednesday, October 10, 2012 8:47 AM
Subject: [R] Summary using by() returns character arrays in a list

I use by() to generate a summary statistics like so:

Lbys - by(dat[Nidx], dat$LipTest, summary)

where Nidx is an index vector with names picking out the columns in the
data frame dat.

This returns a list of character arrays (see below for str() output) where
the columns are named correctly but the rownames are empty strings and the
values are strings prepended with the summary statistic's name (e.g.
Min., Median ).

I am reading the code of summary.data.frame() but can't figure out how I
can change the action of that function to return list of numeric matrices
with as rownames the summary statistic's name (Min., Max. etc) and as
values the numeric values of the calculated summary statistic.

Any help much appreciated!
Regards,
Alex van der Spek


 str(Lbys)
List of 2
$    : 'table' chr [1:6, 1:19] Min.   :-0.190   1st Qu.: 9.297  
Median :10.373   Mean   :10.100   ...
  ..- attr(*, dimnames)=List of 2
  .. ..$ : chr [1:6] ...
  .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
$ T38: 'table' chr [1:6, 1:19] Min.   :8.648   1st Qu.:8.920  
Median :9.018   Mean   :9.027   ...
  ..- attr(*, dimnames)=List of 2
  .. ..$ : chr [1:6] ...
  .. ..$ : chr [1:19] Cell_3_SOSGVF. Cell_3_SOSq..ms.ms.
Cell_3_Airflow..cfm. Cell_3_Float..in.. ...
- attr(*, dim)= int 2
- attr(*, dimnames)=List of 1
  ..$ dat$LipTest: chr [1:2]  T38
- attr(*, call)= language by.data.frame(data = dat[Nidx], INDICES =
dat$LipTest, FUN = summary)
- attr(*, class)= chr by

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


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


Re: [R] contour plot help

2012-10-10 Thread David Winsemius

On Oct 10, 2012, at 7:58 AM, namrata mohapatra wrote:

 Hello 
 
 I am interested to plot a contour plot using the colour : rainbow , however I 
 want to reverse the order of the colour ( such that red represents max value 
 and blue min value) and also remove the lines in white in the plot .

Generally wrapping `rev` around a color vector will reverse the order. More 
specific advice would require code and data as is requested in the Posting 
Guide.

-- 

David Winsemius, MD
Alameda, CA, USA

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


Re: [R] Contacting Delphi ??

2012-10-10 Thread David Winsemius

On Oct 10, 2012, at 9:59 AM, Christian Hoffmann wrote:

 What does the sudden appearance of Contacting Delphi ..the oracle is 
 unavailable.
 We apologize for any inconvenience. mean? A bug? It appears at plotting.

In this instance an unsuccessful attempt at humor:

http://markmail.org/search/?q=list%3Aorg.r-project.r-help+oracle+unavailable

-- 

David Winsemius, MD
Alameda, CA, USA

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


[R] reading in a (very simple) list from a file

2012-10-10 Thread VA Smith
Apologies - I feel this is a very simple thing to do yet I am failing
massively. I keep finding information about how to do much more complicated
things (usually on this mailing list!), which then fail when I try to apply
it to my simple task.

Anyway, all I want to do is read in a series of key-value pairs from a file. 
I thought a list would be a good way to keep these, such that I could access
them like: listname$key

I was imagining a file like this:
key1 value1
key2 value2
key3 value3
...

(the keys will always be character strings, the values might be other types,
but they will always be single items)

I won't bore you with all the things I've tried. I'm sure I'm overlooking
something basic and simple, but I would greatly appreciate it if someone
could help me out here.

Thank you.

Best wishes,
Anne





--
View this message in context: 
http://r.789695.n4.nabble.com/reading-in-a-very-simple-list-from-a-file-tp4645741.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Contacting Delphi ??

2012-10-10 Thread Rui Barradas

Hello,

It's in the source code for `?`, file src/library/utils/R/question.R, 
lines 32 to 35.



32cat(Contacting Delphi...)
33  flush.console()
34Sys.sleep(2+rpois(1,2))
35cat(the oracle is unavailable.\nWe apologize for any 
inconvenience.\n)

36return(invisible())

It means the call to `?` is messed up. Maybe someone with more knowledge 
of the sources can give a more meaningfull answer.


Hope this helps,

Rui Barradas

Em 10-10-2012 17:59, Christian Hoffmann escreveu:
What does the sudden appearance of Contacting Delphi ..the oracle 
is unavailable.

We apologize for any inconvenience. mean? A bug? It appears at plotting.

Thanks

Christian



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


Re: [R] reading in a (very simple) list from a file

2012-10-10 Thread arun
Hi,
May be this:
set.seed(1)
 dat1-data.frame(keys=paste0(key,1:5),value=sample(1:15,5,replace=TRUE))
list1-lapply(split(dat1,dat1$keys),`[`,2)
list1$key2
#  value
#2 6

A.K.



- Original Message -
From: VA Smith v...@st-andrews.ac.uk
To: r-help@r-project.org
Cc: 
Sent: Wednesday, October 10, 2012 1:29 PM
Subject: [R] reading in a (very simple) list from a file

Apologies - I feel this is a very simple thing to do yet I am failing
massively. I keep finding information about how to do much more complicated
things (usually on this mailing list!), which then fail when I try to apply
it to my simple task.

Anyway, all I want to do is read in a series of key-value pairs from a file. 
I thought a list would be a good way to keep these, such that I could access
them like: listname$key

I was imagining a file like this:
key1 value1
key2 value2
key3 value3
...

(the keys will always be character strings, the values might be other types,
but they will always be single items)

I won't bore you with all the things I've tried. I'm sure I'm overlooking
something basic and simple, but I would greatly appreciate it if someone
could help me out here.

Thank you.

Best wishes,
Anne





--
View this message in context: 
http://r.789695.n4.nabble.com/reading-in-a-very-simple-list-from-a-file-tp4645741.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] append for .Rdata?

2012-10-10 Thread J Toll
On Tue, Oct 9, 2012 at 10:35 AM, Jessica Streicher
j.streic...@micromata.de wrote:
 Can i somehow append objects to an .Rdata file?

 I didn't see an option for it in the save() method.

 dump() won't work since i have s4 objects in there.


I'm not sure I completely understand the issues you're trying to work
around, but I have two ideas for you.  One is a simple pseudo-append
function that loads the entire contents, adds the object, and saves
the result.  There are obviously memory issues with this strategy.

appendRData - function(robj, filename) {

  tmpEnv - new.env()

  savedObjects - load(filename, envir = tmpEnv)

  # quick check for name collisions
  stopifnot(!(deparse(substitute(robj)) %in% savedObjects))

  save(list = c(savedObjects, deparse(substitute(robj))),
  file = filename,
  envir = tmpEnv)
}

A second possibility is to convert your RData files to a lazy-load
database as described by Simon Urbanek here:

http://stackoverflow.com/questions/8700619/get-specific-object-from-rdata-file
http://stackoverflow.com/questions/6550510/examining-contents-of-rdata-file-by-attaching-into-a-new-environment-possible

HTH


James

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


Re: [R] reading in a (very simple) list from a file

2012-10-10 Thread arun
HI,

By modifying the earlier solution using sapply()

set.seed(1)
 dat1-data.frame(keys=paste0(key,1:5),value=sample(1:15,5,replace=TRUE))
list2-sapply(split(dat1,dat1$keys),`[`,2)
 names(list2)-dat1[,1]
list2$key2
#[1] 6
A.K.

- Original Message -
From: VA Smith v...@st-andrews.ac.uk
To: r-help@r-project.org
Cc: 
Sent: Wednesday, October 10, 2012 1:29 PM
Subject: [R] reading in a (very simple) list from a file

Apologies - I feel this is a very simple thing to do yet I am failing
massively. I keep finding information about how to do much more complicated
things (usually on this mailing list!), which then fail when I try to apply
it to my simple task.

Anyway, all I want to do is read in a series of key-value pairs from a file. 
I thought a list would be a good way to keep these, such that I could access
them like: listname$key

I was imagining a file like this:
key1 value1
key2 value2
key3 value3
...

(the keys will always be character strings, the values might be other types,
but they will always be single items)

I won't bore you with all the things I've tried. I'm sure I'm overlooking
something basic and simple, but I would greatly appreciate it if someone
could help me out here.

Thank you.

Best wishes,
Anne





--
View this message in context: 
http://r.789695.n4.nabble.com/reading-in-a-very-simple-list-from-a-file-tp4645741.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] Contacting Delphi ??

2012-10-10 Thread Jeff Newmiller
Its suddenness is only as sudden as your input that triggered it. Its oblique 
nature is a reflection of the nature of your input.

http://lmgtfy.com/?q=R+contacting+Delphi+oracle+is+unavailable
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Christian Hoffmann c-w.hoffm...@sunrise.ch wrote:

What does the sudden appearance of Contacting Delphi ..the oracle 
is unavailable.
We apologize for any inconvenience. mean? A bug? It appears at
plotting.

Thanks

Christian

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


Re: [R] RMySQL install on windows

2012-10-10 Thread Greg Snow
I finally was able to compile/load it under windows 7.  I had similar
problems to what you show below.

I set the MYSQL_HOME environmental variable through windows (start
button  control panel  System and Security  system  Advanced
System Settings  Environmental variables).  I had to set it to the
version of the path without spaces, in my case it was:
c:\PROGRA~1\MySQL\MYSQLS~1.5

Then I opened a command prompt window, changed to the directory where
I  had downloaded the tar.gz file from cran and entered the command:
c:\Program Files\R\R-2.15.1\bin\x64\R CMD INSTALL RMySQL_0.9-3.tar.gz

and everything worked (it did not work if I used i386 or just the
regular bin folder, possibly due to the version of MySQL I
downloaded).

Then I started a new instance of R and did library(MySQL) and
everything loaded and I was able to connect to a local MySQL database.

Hope this helps you as well.

On Tue, Oct 9, 2012 at 3:08 PM, Robert Baer rb...@atsu.edu wrote:
 I have been trying to install RMySQL on Windows 7 following the procedure
 at:
 http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

 I think I have properly installed RTools and created a proper Renviron.site
 file saying:
 MYSQL_HOME=C:/Program Files/MySQL/MySQL Server 5.5

 When I try to install the packages from source, I get warnings that suggest
 I'm still not quite with the program yet. There are comments about POSIX
 paths that I don't quite grasp. Can anyone give me additional hints?

 There seems to be a libmysql.dll in the /lib subdirectory although the
 install seems to be looking in the /bin directory for a file of similar
 name. Is this something that has changed with recent versions of MySQL that
 should be fixed in the RMySQL package or is it something I can work around
 by hand or by properly setting some environmental variable?

 Thanks,

 Rob

 The errors ...

 install.packages('RMySQL',type='source')
 trying URL 'http://cran.wustl.edu/src/contrib/RMySQL_0.9-3.tar.gz'
 Content type 'application/x-gzip' length 165363 bytes (161 Kb)
 opened URL
 downloaded 161 Kb

 * installing *source* package 'RMySQL' ...
 ** package 'RMySQL' successfully unpacked and MD5 sums checked
 checking for $MYSQL_HOME... C:/Program Files/MySQL/MySQL Server 5.5
 cygwin warning:
 MS-DOS style path detected: C:/Program
 Preferred POSIX equivalent is: /cygdrive/c/Program
 CYGWIN environment variable option nodosfilewarning turns off this
 warning.
 Consult the user's guide for more details about POSIX paths:
 http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
 test: Files/MySQL/MySQL: unknown operand
 ** libs
 Warning: this package has a non-empty 'configure.win' file,
 so building only the main architecture

 cygwin warning:
 MS-DOS style path detected: C:/PROGRA~1/R/R-215~1.1/etc/x64/Makeconf
 Preferred POSIX equivalent is:
 /cygdrive/c/PROGRA~1/R/R-215~1.1/etc/x64/Makeconf
 CYGWIN environment variable option nodosfilewarning turns off this
 warning.
 Consult the user's guide for more details about POSIX paths:
 http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
 gcc -m64 -IC:/PROGRA~1/R/R-215~1.1/include -DNDEBUG -IC:/Program
 Files/MySQL/MySQL Server 5.5/include
 -Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall -std=gnu99
 -mtune=core2 -c RS-DBI.c -o RS-DBI.o
 RS-DBI.c: In function 'RS_na_set':
 RS-DBI.c:1219:11: warning: variable 'c' set but not used
 [-Wunused-but-set-variable]
 gcc -m64 -IC:/PROGRA~1/R/R-215~1.1/include -DNDEBUG -IC:/Program
 Files/MySQL/MySQL Server 5.5/include
 -Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall -std=gnu99
 -mtune=core2 -c RS-MySQL.c -o RS-MySQL.o
 RS-MySQL.c: In function 'RS_MySQL_fetch':
 RS-MySQL.c:657:13: warning: variable 'fld_nullOk' set but not used
 [-Wunused-but-set-variable]
 RS-MySQL.c: In function 'RS_DBI_invokeBeginGroup':
 RS-MySQL.c:1137:30: warning: variable 'val' set but not used
 [-Wunused-but-set-variable]
 RS-MySQL.c: In function 'RS_DBI_invokeNewRecord':
 RS-MySQL.c:1158:20: warning: variable 'val' set but not used
 [-Wunused-but-set-variable]
 RS-MySQL.c: In function 'RS_MySQL_dbApply':
 RS-MySQL.c:1219:38: warning: variable 'fld_nullOk' set but not used
 [-Wunused-but-set-variable]
 gcc -m64 -shared -s -static-libgcc -o RMySQL.dll tmp.def RS-DBI.o RS-MySQL.o
 C:/Program Files/MySQL/MySQL Server 5.5/bin/libmySQL.dll
 -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64
 -Ld:/RCompile/CRANpkg/extralibs64/local/lib
 -LC:/PROGRA~1/R/R-215~1.1/bin/x64 -lR
 gcc.exe: error: C:/Program Files/MySQL/MySQL Server 5.5/bin/libmySQL.dll: No
 such file or directory
 ERROR: compilation failed for package 'RMySQL'
 * removing 'C:/Program Files/R/R-2.15.1/library/RMySQL'

 The downloaded source packages are in
 ‘C:\Users\rbaer\AppData\Local\Temp\Rtmps9adPQ\downloaded_packages’
 Warning messages:
 1: running command 'C:/PROGRA~1/R/R-215~1.1/bin/x64/R CMD INSTALL -l
 C:/Program Files/R/R-2.15.1/library
 C:\Users\rbaer\AppData\Local\Temp\Rtmps9adPQ/downloaded_packages/RMySQL_0.9-3.tar.gz'
 had status 1

[R] interaction testing in GAM

2012-10-10 Thread anna freni sterrantino
Hello!
I'd like to know if it is correct to
test with anova two models specified like this:

m1=y~x1+s(x2,by=x3),family=poisson
m0=y~x1+s(x2),family=poisson

anova(m1,m0)

Cheers

Anna

 
Anna Freni Sterrantino
Department of Statistics
University of Bologna, Italy
via Belle Arti 41, 40124 BO.
[[alternative HTML version deleted]]

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


Re: [R] Contacting Delphi ??

2012-10-10 Thread Rui Barradas
Unsuccessfull? Why unsuccessfull? Have you noticed the call to rpois? It 
beats runif by potential infinity.


Rui Barradas
Em 10-10-2012 18:30, David Winsemius escreveu:

On Oct 10, 2012, at 9:59 AM, Christian Hoffmann wrote:


What does the sudden appearance of Contacting Delphi ..the oracle is 
unavailable.
We apologize for any inconvenience. mean? A bug? It appears at plotting.

In this instance an unsuccessful attempt at humor:

http://markmail.org/search/?q=list%3Aorg.r-project.r-help+oracle+unavailable



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


Re: [R] reading in a (very simple) list from a file

2012-10-10 Thread David L Carlson
It might help if you would bore us with at least one or two of the things
you have tried. It seems logical to read the file into a data frame using
read.table(). Then you can change it into any format you want:

 Listname - read.table(text=key value
Key1 1
Key2 2
Key3 3, header=TRUE)
 Listname
   key value
1 Key1 1
2 Key2 2
3 Key3 3

Just change text=. . .  to file=yourfilename. This will change the key
field into a factor. If you don't want to do that use

 Listname - read.table(text=key value
Key1 1
Key2 2
Key3 3, header=TRUE, stringsAsFactors=FALSE)

If you want to change the data.frame into a list, just use:

 Listname - as.list(Listname)

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of arun
 Sent: Wednesday, October 10, 2012 12:49 PM
 To: VA Smith
 Cc: R help
 Subject: Re: [R] reading in a (very simple) list from a file
 
 HI,
 
 By modifying the earlier solution using sapply()
 
 set.seed(1)
  dat1-
 data.frame(keys=paste0(key,1:5),value=sample(1:15,5,replace=TRUE))
 list2-sapply(split(dat1,dat1$keys),`[`,2)
  names(list2)-dat1[,1]
 list2$key2
 #[1] 6
 A.K.
 
 - Original Message -
 From: VA Smith v...@st-andrews.ac.uk
 To: r-help@r-project.org
 Cc:
 Sent: Wednesday, October 10, 2012 1:29 PM
 Subject: [R] reading in a (very simple) list from a file
 
 Apologies - I feel this is a very simple thing to do yet I am failing
 massively. I keep finding information about how to do much more
 complicated
 things (usually on this mailing list!), which then fail when I try to
 apply
 it to my simple task.
 
 Anyway, all I want to do is read in a series of key-value pairs from a
 file.
 I thought a list would be a good way to keep these, such that I could
 access
 them like: listname$key
 
 I was imagining a file like this:
 key1 value1
 key2 value2
 key3 value3
 ...
 
 (the keys will always be character strings, the values might be other
 types,
 but they will always be single items)
 
 I won't bore you with all the things I've tried. I'm sure I'm
 overlooking
 something basic and simple, but I would greatly appreciate it if
 someone
 could help me out here.
 
 Thank you.
 
 Best wishes,
 Anne
 
 
 
 
 
 --
 View this message in context: http://r.789695.n4.nabble.com/reading-in-
 a-very-simple-list-from-a-file-tp4645741.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] Numeric Label of Factor value?

2012-10-10 Thread Brigid Mooney
Sorry, I'm sure I'm not using the appropriate vocab here, which is
undoubtedly why I can't seem to find a fix to this (hopefully very
easy) problem.

Suppose you have a factor

abc - factor(c(2,2,3,4,7,7))

And you want to know what the number in the nth spot in that would be

abc[1]
[1] 2
Levels: 2 3 4 7

shows the correct label of the first element - but if I want to pull
out the numeric value of that label, I thought...

as.numeric(abc[1])

but that gives
[1] 1

which is the position of the label in the levels vector of the factor.

Ideas?

Thanks!

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


Re: [R] Numeric Label of Factor value?

2012-10-10 Thread Sarah Goslee
Hi Brigid,

as.numeric() extracts the index of the factor level, which is the way
R handles the likelihood that a factor is not actually numeric. Try:

 as.numeric(as.character(abc[1]))
[1] 2

and see also ?factor particularly the section on the interpretation of a factor.

Sarah

On Wed, Oct 10, 2012 at 2:39 PM, Brigid Mooney bkmoo...@gmail.com wrote:
 Sorry, I'm sure I'm not using the appropriate vocab here, which is
 undoubtedly why I can't seem to find a fix to this (hopefully very
 easy) problem.

 Suppose you have a factor

 abc - factor(c(2,2,3,4,7,7))

 And you want to know what the number in the nth spot in that would be

 abc[1]
 [1] 2
 Levels: 2 3 4 7

 shows the correct label of the first element - but if I want to pull
 out the numeric value of that label, I thought...

 as.numeric(abc[1])

 but that gives
 [1] 1

 which is the position of the label in the levels vector of the factor.

 Ideas?

 Thanks!

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



-- 
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

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


Re: [R] Numeric Label of Factor value?

2012-10-10 Thread Rui Barradas

Hello,

Try instead

?levels
abc - factor(c(2,2,3,4,7,7))
as.numeric(levels(abc)[1])

Hope this helps,

Rui Barradas
Em 10-10-2012 19:39, Brigid Mooney escreveu:

Sorry, I'm sure I'm not using the appropriate vocab here, which is
undoubtedly why I can't seem to find a fix to this (hopefully very
easy) problem.

Suppose you have a factor

abc - factor(c(2,2,3,4,7,7))

And you want to know what the number in the nth spot in that would be

abc[1]
[1] 2
Levels: 2 3 4 7

shows the correct label of the first element - but if I want to pull
out the numeric value of that label, I thought...

as.numeric(abc[1])

but that gives
[1] 1

which is the position of the label in the levels vector of the factor.

Ideas?

Thanks!

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


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


Re: [R] Numeric Label of Factor value?

2012-10-10 Thread Sarah Goslee
Rui, that doesn't answer the question as I understood it:

Your suggestion returns the numeric value of the second value of the levels:
 as.numeric(levels(abc)[2])
[1] 3

But I read the question as wanting the numeric value of the second
element of abc:
 as.numeric(as.character(abc[2]))
[1] 2


On Wed, Oct 10, 2012 at 2:52 PM, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 Try instead

 ?levels
 abc - factor(c(2,2,3,4,7,7))
 as.numeric(levels(abc)[1])

 Hope this helps,

 Rui Barradas
 Em 10-10-2012 19:39, Brigid Mooney escreveu:

 Sorry, I'm sure I'm not using the appropriate vocab here, which is
 undoubtedly why I can't seem to find a fix to this (hopefully very
 easy) problem.

 Suppose you have a factor

 abc - factor(c(2,2,3,4,7,7))

 And you want to know what the number in the nth spot in that would be

 abc[1]
 [1] 2
 Levels: 2 3 4 7

 shows the correct label of the first element - but if I want to pull
 out the numeric value of that label, I thought...

 as.numeric(abc[1])

 but that gives
 [1] 1

 which is the position of the label in the levels vector of the factor.

 Ideas?

 Thanks!


-- 
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] Exporting summary plm results to latex

2012-10-10 Thread arun
HI,

May be you can use library(texreg):

library(plm)

#generating some data
x - rnorm(270)
y - rnorm(270)
t - rep(1:3,30)
i - rep(1:90, each=3)

data - data.frame(i,t,x,y)

fe - plm(y~x,data=data,model=within)
summary(fe)
library(texreg)
fe1-extract.plm(fe) #extract the plm object

library(xtable)

xtable(do.call(rbind,lapply(fe1,function(x) data.frame(x
% latex table generated in R 2.15.0 by xtable 1.7-0 package
% Wed Oct 10 14:59:10 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{rr}
  \hline
  x \\ 
  \hline
Estimate  -0.03 \\ 
  Std. Error  0.08 \\ 
  Pr($$$|$t$|$)  0.68 \\ 
  R\$\verb|^|2\$  0.00 \\ 
  Adj. R\$\verb|^|2\$  0.00 \\ 
  Num. obs.  270.00 \\ 
   \hline
\end{tabular}
\end{center}
\end{table}
#Another example.  In this case, you can create two tables from the zz1 list
data(Produc, package = plm)
    zz - plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc, 
index = c(state,year))
zz1-extract.plm(zz)
    

 lapply(lapply(zz1,function(x) data.frame(x)),xtable)
[[1]]
% latex table generated in R 2.15.0 by xtable 1.7-0 package
% Wed Oct 10 15:08:02 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{}
  \hline
  Estimate  Std..Error  Pr...t.. \\ 
  \hline
log(pcap)  -0.03  0.03  0.37 \\ 
  log(pc)  0.29  0.03  0.00 \\ 
  log(emp)  0.77  0.03  0.00 \\ 
  unemp  -0.01  0.00  0.00 \\ 
   \hline
\end{tabular}
\end{center}
\end{table}

[[2]]
% latex table generated in R 2.15.0 by xtable 1.7-0 package
% Wed Oct 10 15:08:02 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{rr}
  \hline
  x \\ 
  \hline
R\$\verb|^|2\$  0.94 \\ 
  Adj. R\$\verb|^|2\$  0.88 \\ 
  Num. obs.  816.00 \\ 
   \hline
\end{tabular}
\end{center}
\end{table}


Hope it helps.

A.K.







- Original Message -
From: Sebastian Barfort sb3...@nyu.edu
To: r-help@r-project.org
Cc: 
Sent: Wednesday, October 10, 2012 1:07 PM
Subject: [R] Exporting summary plm results to latex

Dear all, 

I am trying to export my fixed effect results to Latex. I am using the plm 
package with the summary function. However, it does not look like apsrtable, 
stargazer, or any other package can accompany using the plm package. 

I am interested in a classic table with the coefficient in one row followed by 
the standard error in paranthesis in the next row and stars by the coefficient 
to show relevant coefficient level. 

coefficient 1     xxx**
            (xxx)

Here is a reproducible example:

library(plm)

#generating some data
x - rnorm(270)
y - rnorm(270)
t - rep(1:3,30)
i - rep(1:90, each=3) 

data - data.frame(i,t,x,y)

fe - plm(y~x,data=data,model=within) 
summary(fe)

If there is an alternative to using the plm package that works with any of the 
export to latex packages, I would be very interested to know. Otherwise, any 
ideas of how to solve this problem are very welcome. I almost exclusively use 
fixed effect panel models, and the problem of exporting results to Latex is one 
of the things preventing me from switching entirely from Stata to R. 


Kind regards, 
Sebastian


    [[alternative HTML version deleted]]

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


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


Re: [R] Contacting Delphi ??

2012-10-10 Thread R. Michael Weylandt
I think David was saying the humor was unsuccessful (i.e., Christian
didn't get the joke), not that the code was.

Cheers,
RMW

On Wed, Oct 10, 2012 at 7:16 PM, Rui Barradas ruipbarra...@sapo.pt wrote:
 Unsuccessfull? Why unsuccessfull? Have you noticed the call to rpois? It
 beats runif by potential infinity.

 Rui Barradas
 Em 10-10-2012 18:30, David Winsemius escreveu:

 On Oct 10, 2012, at 9:59 AM, Christian Hoffmann wrote:

 What does the sudden appearance of Contacting Delphi ..the oracle is
 unavailable.
 We apologize for any inconvenience. mean? A bug? It appears at plotting.

 In this instance an unsuccessful attempt at humor:


 http://markmail.org/search/?q=list%3Aorg.r-project.r-help+oracle+unavailable


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

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


Re: [R] Numeric Label of Factor value?

2012-10-10 Thread Rui Barradas

Sorry, not one of my days. Forgot to Cc the list.

Rui barradas
Em 10-10-2012 20:28, Sarah Goslee escreveu:

Sent just to me?

On Wed, Oct 10, 2012 at 3:26 PM, Rui Barradas ruipbarra...@sapo.pt wrote:

You're right, apologies to the op and the list. I was thinking of the more
complicated

as.numeric(levels(abc)[abc[1]])

Rui Barradas
Em 10-10-2012 19:58, Sarah Goslee escreveu:

Rui, that doesn't answer the question as I understood it:

Your suggestion returns the numeric value of the second value of the
levels:

as.numeric(levels(abc)[2])

[1] 3

But I read the question as wanting the numeric value of the second
element of abc:

as.numeric(as.character(abc[2]))

[1] 2


On Wed, Oct 10, 2012 at 2:52 PM, Rui Barradas ruipbarra...@sapo.pt
wrote:

Hello,

Try instead

?levels
abc - factor(c(2,2,3,4,7,7))
as.numeric(levels(abc)[1])

Hope this helps,

Rui Barradas
Em 10-10-2012 19:39, Brigid Mooney escreveu:


Sorry, I'm sure I'm not using the appropriate vocab here, which is
undoubtedly why I can't seem to find a fix to this (hopefully very
easy) problem.

Suppose you have a factor

abc - factor(c(2,2,3,4,7,7))

And you want to know what the number in the nth spot in that would be

abc[1]
[1] 2
Levels: 2 3 4 7

shows the correct label of the first element - but if I want to pull
out the numeric value of that label, I thought...

as.numeric(abc[1])

but that gives
[1] 1

which is the position of the label in the levels vector of the factor.

Ideas?

Thanks!



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


Re: [R] own function: computing time

2012-10-10 Thread Jan van der Laan


Did not see a simple way to make it faster. However, this is a piece of 
code which can be made to run much faster in C. See below.


I don't know if you are familiar with running c-code from R. If not, the 
official documentation is in the R Extensions manual. However, this is 
not the most easy documentation for a first read. If you want to use the 
c-code and have problems getting it running, let me/us know your 
operating system and I/we will try to walk you through it.


HTH,
Jan


=== c-code ===
void foo(double* m, int* pn, int* r) {
  int n = *pn;
  double* pm1 = m;
  double* pm2 = m + n;
  int* pr = r;
  for (int i = 0; i  n; ++i, ++pm1, ++pm2, ++pr) {
*pr = 1;
double* qm1 = m;
double* qm2 = m + n;
for (int j = 0; j  n; ++j, ++qm1, ++qm2) {
  if ((*qm1  *pm1)  (*qm2  *pm2)) {
*pr = 0;
break;
  }
}
  }
}

=== r-code ===
dyn.load(rtest.so)

foo - function(m) {
  n - dim(m)[1]
  .C(foo,
  as.double(m),
  as.integer(n),
  r = logical(n))$r
}

x - runif(32000)
y - runif(32000)
xy - cbind(x,y)

t1 - system.time({
outer - function(z){
!any(x  z[1]  y  z[2])
}
j - apply(xy,1, outer)
})

t2 - system.time({
j2 - foo(xy)
})

=== results ===
 all(j == j2)
[1] TRUE
 t1
   user  system elapsed
 35.462   0.028  35.549
 t2
   user  system elapsed
  0.008   0.000   0.008





On 10/10/2012 12:15 PM, tonja.krue...@web.de wrote:

Hi all,

I wrote a function that actually does what I want it to do, but it tends to be 
very slow for large amount of data. On my computer it takes 5.37 seconds for 
16000 data points and 21.95 seconds for 32000 data points. As my real data 
consists of 1800 data points it would take ages to use the function as it 
is now.
Could someone help me to speed up the calculation?

Thank you, Tonja

system.time({
x - runif(32000)
y - runif(32000)

xy - cbind(x,y)

outer - function(z){
!any(x  z[1]  y  z[2])}
j - apply(xy,1, outer)

plot(x,y)
points(x[j],y[j],col=green)

})

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



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


Re: [R] package request

2012-10-10 Thread Greg Snow
There are packages for big data analysis, which is best depends on
what you want to do.  The High Performance Computing task view on CRAN
has a section on packages that deal with big data which gives some
more detail and may help you choose which package(s) to use.

On Wed, Oct 10, 2012 at 12:36 AM, sagarnikam123 sagarnikam...@gmail.com wrote:
 which package from CRAN used for Big-Data analysis ?
 is there any separate package for Big-Data analysis?
 or for making reports  Business intelligence



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/package-request-tp4645661.html
 Sent from the R help mailing list archive at Nabble.com.

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



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

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


Re: [R] own function: computing time

2012-10-10 Thread William Dunlap
Your original method would be the following function
f - function (x, y) 
{
xy - cbind(x, y)
outside - function(z) {
!any(x  z[1]  y  z[2])
}
j - apply(xy, 1, outside)
which(j)
}

and the following one quickly computes the same thing as the above
as long as there are no repeated points (if there are repeated
points it chooses one of them).

f1 - function (x, y) 
{
o - order(x, decreasing = TRUE)
yo - y[o]
j - logical(length(y))
j[o] - yo == cummax(yo)
which(j)
}

Think of the problem as finding the ladder points (Feller's term)
of a sequence of points, the places where the sequence reaches
a new high point.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of William Dunlap
 Sent: Wednesday, October 10, 2012 9:52 AM
 To: tonja.krue...@web.de; r-help@r-project.org
 Subject: Re: [R] own function: computing time
 
 No, the desired points are not a subset of the convex hull.
 E.g., x=c(0,1:5), y=c(0,1/(1:5)).
 
 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com
 
 
  -Original Message-
  From: William Dunlap
  Sent: Wednesday, October 10, 2012 9:46 AM
  To: 'tonja.krue...@web.de'; r-help@r-project.org
  Subject: RE: [R] own function: computing time
 
  Are the points you are looking for (those data points with no other data
  points above or to the right of them) a subset of the convex hull of the
  data points?  If so, chull(x,y) can quickly give you the points on the 
  convex
  hull (typically a fairly small number) and you can look through them for
  the ones you want.
 
  Bill Dunlap
  Spotfire, TIBCO Software
  wdunlap tibco.com
 
 
   -Original Message-
   From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] 
   On
 Behalf
   Of tonja.krue...@web.de
   Sent: Wednesday, October 10, 2012 3:16 AM
   To: r-help@r-project.org
   Subject: [R] own function: computing time
  
   Hi all,
  
   I wrote a function that actually does what I want it to do, but it tends 
   to be very slow
  for
   large amount of data. On my computer it takes 5.37 seconds for 16000 data 
   points
 and
   21.95 seconds for 32000 data points. As my real data consists of 1800 
   data
 points
  it
   would take ages to use the function as it is now.
   Could someone help me to speed up the calculation?
  
   Thank you, Tonja
  
   system.time({
   x - runif(32000)
   y - runif(32000)
  
   xy - cbind(x,y)
  
   outer - function(z){
   !any(x  z[1]  y  z[2])}
   j - apply(xy,1, outer)
  
   plot(x,y)
   points(x[j],y[j],col=green)
  
   })
  
   __
   R-help@r-project.org mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide 
   http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] histogram corelation plots

2012-10-10 Thread R. Michael Weylandt
On Wed, Oct 10, 2012 at 4:47 PM, sagarnikam123 sagarnikam...@gmail.com wrote:
 i want to show histogram in innovative way (good if interactive) in html
 report..is threre any tutorials/hint
 also there is any package to show correalation plot

The histogram is well defined, so I'm not really sure how much
innovation you should do there. However, check

Acinonyx::ihist()

from Rforge (not R-forge) for interactive.

library(corrgram)

for correlation plots.

Cheers,
Michael

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


Re: [R] get: problem with environments

2012-10-10 Thread R. Michael Weylandt
Can someone more capable than I help Martin out with this? I'm feeling
out of my league (that or I've missed something obvious)

Shot in the dark: you aren't running this in some sort of debug mode, are you?

RMW

On Sun, Oct 7, 2012 at 5:10 PM, Martin Ivanov tra...@abv.bg wrote:
  Thank You very much for Your replies.
 Dear Michael,

 Does this persist after a new session (perhaps running as R --vanilla) 
 and/or reinstall?
 Yes, it does. After running R --vanilla, still there are 4 contexts more on 
 the call stack.

 You didn't show us how you tried to use parent.frame()
 I did it like this:
 testfun1 - function (x1) {
  a1 - 1;
  sapply(X=a1, FUN=get, envir=parent.frame(x1));
 }

 testfun1(x1=1);

 The above code never succeeds no matter what a number I give to x1.

  3. Why does the number of contexts in the call stack differ in R and in 
 rkward?
  It shouldn't. This is an issue that needs further sorting out.

 Here is some more info on my setup:
 sessionInfo()
 R version 2.15.1 (2012-06-22)
 Platform: x86_64-slackware-linux-gnu (64-bit)

 locale:
  [1] LC_CTYPE=en_US   LC_NUMERIC=C LC_TIME=en_US
  [4] LC_COLLATE=C LC_MONETARY=en_USLC_MESSAGES=en_US
  [7] LC_PAPER=C   LC_NAME=CLC_ADDRESS=C
 [10] LC_TELEPHONE=C   LC_MEASUREMENT=en_US LC_IDENTIFICATION=C

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

 loaded via a namespace (and not attached):
 [1] tools_2.15.1


 Best regards,

 Martin

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


[R] combine unadjusted and adjusted forest plots

2012-10-10 Thread Romita Mukerjee, M.D.
Hello,

I am learning to use the metafor package to conduct meta-regression analyses 
for a systematic review on multidisciplinary care interventions in chronic 
kidney disease.  For the forest plots, I can't figure out how to plot 
unadjusted and adjusted models on the same plot.  From top to bottom, I would 
like to be able have the unadjusted plot, the multivariate adjusted plot, then 
each univariate adjusted plot.  Below each plot I would like to also include a 
polygon with the respective summary estimate and confidence interval.  I would 
also like to have only one x-axis at the bottom of the whole plot.  The 
moderators for the meta-regression include both continuous and categorical 
variables.  Any thoughts?

Thanks,
Romi Mukerjee



Romita Mukerjee, M.D.
Nephrology Fellow, PGY-6
Duke University Medical Center


[[alternative HTML version deleted]]

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


[R] How to replicate SAS by group processing in R

2012-10-10 Thread ramoss
Hello,

I am trying to re-code all my programs from SAS into R.

In SAS I use the following code:

proc sort data=upper;
by tdate stock_symbol expire  strike;
run;
data upper1;
  set upper;
  by tdate stock_symbol expire  strike;
  if first.expire then output;
  rename strike=astrike;
run;

on the following data set:

tdate   stock_symbolexpiration  strike
9/11/2012   C  9/16/201211
9/11/2012   C  9/16/201212
9/11/2012   C  9/16/201213
9/12/2012   C  9/16/201214
9/12/2012   C  9/16/201215
9/12/2012   C  9/16/201216
9/12/2012   C   9/16/2012   17

to get the following results:
tdate   stock_symbolexpiration  strike
9/11/2012   C  9/16/201211
9/12/2012   C  9/16/201214

How would I replicate this kind of logic in R?
I have seen PLY  data.table packages mentioned but don't see how they would
do the job.

Thanks ahead for your help



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-replicate-SAS-by-group-processing-in-R-tp4645753.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] practical to loop over 2million rows?

2012-10-10 Thread Jay Rice
New to R and having issues with loops. I am aware that I should use
vectorization whenever possible and use the apply functions, however,
sometimes a loop seems necessary.

I have a data set of 2 million rows and have tried run a couple of loops of
varying complexity to test efficiency. If I do a very simple loop such as
add every item in a column I get an answer quickly.

If I use a nested ifelse statement in a loop it takes me 13 minutes to get
an answer on just 50,000 rows. I am aware of a few methods to speed up
loops. Preallocating memory space and compute as much outside of the loop
as possible (or use create functions and just loop over the function) but
it seems that even with these speed ups I might have too much data to run
loops.  Here is the loop I ran that took 13 minutes. I realize I can
accomplish the same goal using vectorization (and in fact did so).

y-numeric(length(x))

for(i in 1:length(x))

ifelse(!is.na(x[i]), y[i]-x[i],

ifelse(strataID[i+1]==strataID[i], y-x[i+1], y-x[i-1]))

Presumably, complicated loops would be more intensive than the nested if
statement above. If I write more efficient loops time will come down but I
wonder if I will ever be able to write efficient enough code to perform a
complicated loop over 2 million rows in a reasonable time.

Is it useless for me to try to do any complicated loops on 2 million rows,
or if I get much better at programming in R will it be manageable even for
complicated situations?


Jay

[[alternative HTML version deleted]]

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


[R] nlmnib Package + Hessian Output

2012-10-10 Thread nserdar

I need a Hessian matrix in nlmnib package to discuss whether parameters
are significant or not. 

Please let me know how to obtain hessian matrix and how to evaluate the
significancy of parameters.

Regards
Serdar



--
View this message in context: 
http://r.789695.n4.nabble.com/nlmnib-Package-Hessian-Output-tp4645768.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] optim and nlminb

2012-10-10 Thread nserdar

#optim package
estimate-optim(init.par,Linn,hessian=TRUE, method=c(L-BFGS-B),control =
list(trace=1,abstol=0.001),lower=c(0,0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf))

#nlminb package
estimate-nlminb(init.par,Linn,gr=NULL,hessian=TRUE,control =
list(trace=1,factr=1),lower=c(0,0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf))

I did not get same results from above equations. Log-likelihood values are
close but parameter estimation completely different. 

My expectation is very close to nlminb packages.

Do you have any idea and suggestion between packages?

Regards,
Serdar 




--
View this message in context: 
http://r.789695.n4.nabble.com/optim-and-nlminb-tp4645772.html
Sent from the R help mailing list archive at Nabble.com.

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


  1   2   >