Re: [R] Problem with sas.get function in Hmisc
Hello Hong, Thanks a lot for the solution you sent. It works fine now. 2006/12/14, Hong Ooi [EMAIL PROTECTED]: ___ Note: This e-mail is subject to the disclaimer contained at the bottom of this message. ___ After digging around in the sas.get code, I found a change that seems to be causing the problem: old version: ... status - sys(paste(sasprog, sasin, -log, log.file), output = FALSE) ... new version: ... status - sys(paste(shQuote(sasprog), shQuote(sasin), -log, shQuote(log.file)), output = FALSE) ... For some reason, sys() bombs when given a command string with quotes in it. The string works fine when pasted into a command line window, so maybe it's a problem with the WinXP commmand interpreter? In any case, changing the sys() call to system() seems to fix the problem. ... status - system(paste(shQuote(sasprog), shQuote(sasin), -log, shQuote(log.file))) ... -- Hong Ooi Senior Research Analyst, IAG Limited 388 George St, Sydney NSW 2000 +61 (2) 9292 1566 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean Vidal Sent: Wednesday, 13 December 2006 8:02 PM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Problem with sas.get function in Hmisc The workaround you point seems to be the solution for the moment. I not sure I will have time (and courage) to try to figure out where the bug comes from. Hope a more literate R programmer than me is willing to dive in... Thank you for your answer. 2006/12/12, Agustin Calatroni [EMAIL PROTECTED]: Jean, I saw your email to the R-help mailing list. I also notice the problem a few months back and email the maintainer (Charles Dupont) but never got a response. Since I used the function a lot and in order to avoid the error I use version 3.0-12 instead of updating the a newer version. To download the earlier version use the following site: http://cran.r-project.org/bin/windows/contrib/2.2/ If you figure out another way around the problem I will be interested in knowing the solution. Sincerely, -- Agustin Calatroni Agustin Calatroni wrote: I been having the following problem when I updated the Hmisc package from version 3.0-12 to version 3.1-1. Create dataset under SAS: data a; do i = 1 to 100; x = rannor(0); output; end; run; Hmisc version 3.0-12: library(Hmisc) sas.get('C:\\Documents and Settings\\novell\\My Documents\\SAS Temp\\_TD3428','a') NO PROBLEM Hmisc version 3.1-1: library(Hmisc) sas.get('C:\\Documents and Settings\\novell\\My Documents\\SAS Temp\\_TD3428','a') The filename, directory name, or volume label syntax is incorrect. Error in sas.get(C:\\Documents and Settings\\novell\\My Documents\\SAS Temp\\_TD3428, : SAS job failed with status 1 In addition: Warning message: 'cmd' execution failed with error code 1 in: shell(cmd, wait = TRUE, intern = output) R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 3.1 $year [1] 2006 $month [1] 06 $day [1] 01 $`svn rev` [1] 38247 $language [1] R $version.string [1] Version 2.3.1 (2006-06-01) Thanks for Hmisc and Design packages, they are an invaluable resource. Sorry if this is a stupid question and I missed something obvious. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ___ The information transmitted in this message and its attach...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ks.test greater and less
Hello r-group I have a question to the ks.test. I would expect different values for less and greater between data1 and data2. Does anybody could explain my point of misunderstanding the function? data1-c(8,12,43,70) data2- c(70,43,12,8) ks.test(data1,pnorm) ks.test(data1,pnorm,alternative =less)#expected 0.001 ks.test(data1,pnorm,alternative =greater) #expected =1 ks.test(data2,pnorm) ks.test(data2,pnorm,alternative =less) #expected =1 ks.test(data2,pnorm,alternative =greater) #expected 0.001 With regards Carmen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Function to fit a STARIMA model
On Thu, 14 Dec 2006, Rajesh Krishnan wrote: Hi all, I was wondering if there is a function available in any of the R add-on packages that could be used to fit a STARIMA (Phillip E. Pfeifer and Stuart Jay Deutsch. (1980). A STARIMA Model-Building Procedure with Application to Description and Regional Forecasting, Transactions of the Institute of British Geographers 5(3), 330-349.) model? I'm afraid there is no such function. The approach has been used very little since it was proposed, and probably more work has been done on spatial panel models (not yet in R) and in the hierarchical model framework (again not yet in R, although the spBayes package may offer some possibilities). Thanks, Rajesh. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Installing rgl package under Ubuntu
Dear Rexperts, lately I'm having troubles installing the rgl package via install.packages(rgl, dependencies=T) in the R 2.4.0 backport running under Ubuntu 6.06 LTS. I get the following error messages, despite having installed libx11-dev (as recommended in a similar post about SUSE 10.1): trying URL 'http://cran.xedio.de/src/contrib/rgl_0.68.tar.gz' Content type 'application/x-gzip' length 701566 bytes opened URL == downloaded 685Kb * Installing *source* package 'rgl' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/local/lib/R/site-library/rgl' The downloaded packages are in /tmp/Rtmpni68vG/downloaded_packages Warning message: installation of package 'rgl' had non-zero exit status in: install.packages(rgl, dependencies = T) +---+ Has anyone experienced a similar problem, and what would be the resolution of the X11 not found message? Thank you in advance! Greets, Ivailo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Model formula question
Not sure why you feel the need to use gnm here - are you working with non-normal data? From your description it would seem that nls is more appropriate, Heather Dr H Turner Research Fellow Dept. of Statistics The University of Warwick Coventry CV4 7AL Tel: 024 76575870 Fax: 024 76524532 Url: www.warwick.ac.uk/go/heatherturner From: Ronaldo Prati [mailto:[EMAIL PROTECTED] Sent: Thu 14/12/2006 13:41 To: r-help@stat.math.ethz.ch Subject: [R] Model formula question Hi all, I'm not familiar with R programming and I'm trying to reproduce a result from a paper. Basically, I have a dataset which I would like to model in terms of successive increments, i.e. (y denote empirical values of y) y_1 = y1, y_2 = y1 + delta1, y_3 = y1 + delta1 + delta2. .. y_m = y1 + sum_2^m delta j where delta_j donote successive increments in the y-values, i.e. delta j = y_j - y_(j-1). In order to estimate y-values, I'm assuming that delta j is approximately equal to kj**u, such that my regression model should be something like this: ^y_1 = a1 ^y_2 = a1 + k2**u ^y_3 = a1 + k2**u + k3**u .. ^y_m = a1 + k2**u + k3**u + ... + km**u or, generically ^yi = a1 + k * sum_j=2^i j**u and I need to fit a non-linear least-squares regression model to find the tripplet a1,k,u. I had a look to the gnm package, but I don't have the lesser idea how to formulate this problem to use this package. Can someone help me with that? cheers, Ronaldo [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Query regarding linking R with Matlab
Thank you sir for your prompt reply. Currently i am stuck at point where I need to call an available Matlab program from an R 2.4.0 interface. How can I do this? I have downloaded the R.matlab file and also the manual in pdf. But still i am not able to get through the problem. I will be grateful to you if you can elaborate me on this. Awaiting your reply, regards, Bhanu Kalyan K Bhanu Kalyan K BTech CSE Final Year [EMAIL PROTECTED] Tel :+91-9885238228 __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Model formula question
[resend - hopefully HTML switched off this time] Not sure why you feel the need to use gnm here - are you working with non-normal data? From your description it would seem that nls is more appropriate, Heather Dr H Turner Research Fellow Dept. of Statistics The University of Warwick Coventry CV4 7AL Tel: 024 76575870 Fax: 024 76524532 Url: www.warwick.ac.uk/go/heatherturner -Original Message- From: Ronaldo Prati [mailto:[EMAIL PROTECTED] Sent: Thu 14/12/2006 13:41 To: r-help@stat.math.ethz.ch Subject: [R] Model formula question Hi all, I'm not familiar with R programming and I'm trying to reproduce a result from a paper. Basically, I have a dataset which I would like to model in terms of successive increments, i.e. (y denote empirical values of y) y_1 = y1, y_2 = y1 + delta1, y_3 = y1 + delta1 + delta2. .. y_m = y1 + sum_2^m delta j where delta_j donote successive increments in the y-values, i.e. delta j = y_j - y_(j-1). In order to estimate y-values, I'm assuming that delta j is approximately equal to kj**u, such that my regression model should be something like this: ^y_1 = a1 ^y_2 = a1 + k2**u ^y_3 = a1 + k2**u + k3**u .. ^y_m = a1 + k2**u + k3**u + ... + km**u or, generically ^yi = a1 + k * sum_j=2^i j**u and I need to fit a non-linear least-squares regression model to find the tripplet a1,k,u. I had a look to the gnm package, but I don't have the lesser idea how to formulate this problem to use this package. Can someone help me with that? cheers, Ronaldo [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
Dear Rexperts, lately I'm having troubles installing the rgl package via install.packages(rgl, dependencies=T) in the R 2.4.0 backport running under Ubuntu 6.06 LTS. I get the following error messages, despite having installed libx11-dev (as recommended in a similar post about SUSE 10.1): trying URL 'http://cran.xedio.de/src/contrib/rgl_0.68.tar.gz' Content type 'application/x-gzip' length 701566 bytes opened URL == downloaded 685Kb * Installing *source* package 'rgl' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/local/lib/R/site-library/rgl' The downloaded packages are in /tmp/Rtmpni68vG/downloaded_packages Warning message: installation of package 'rgl' had non-zero exit status in: install.packages(rgl, dependencies = T) +---+ Has anyone experienced a similar problem, and what would be the resolution of the X11 not found message? On my ubuntu 6.06 LTS, I pass the test (tho I do get errors later during compilation). When checking for X, it says: ... Checking for X... Libraries /usr/X11R6/lib, headers ... I compiled R 2.4.0 from source, which also gave me some trouble when checking for X. I think I solved it by installing xserver-xorg-dev. Hope this gives you some pointers Bjorn Thank you in advance! Greets, Ivailo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
On Fri, 2006-12-15 at 13:44 +0100, Van Campenhout Bjorn wrote: [snip] On my ubuntu 6.06 LTS, I pass the test (tho I do get errors later during compilation). When checking for X, it says: ... Checking for X... Libraries /usr/X11R6/lib, headers ... I compiled R 2.4.0 from source, which also gave me some trouble when checking for X. I think I solved it by installing xserver-xorg-dev. Hope this gives you some pointers Bjorn I installed xserver-xorg-dev, but the problem persists :( Any other hints? Ivailo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
Ivailo Stoyanov wrote: On Fri, 2006-12-15 at 13:44 +0100, Van Campenhout Bjorn wrote: [snip] On my ubuntu 6.06 LTS, I pass the test (tho I do get errors later during compilation). When checking for X, it says: ... Checking for X... Libraries /usr/X11R6/lib, headers ... I compiled R 2.4.0 from source, which also gave me some trouble when checking for X. I think I solved it by installing xserver-xorg-dev. Hope this gives you some pointers Bjorn I installed xserver-xorg-dev, but the problem persists :( Any other hints? I don't think that is the right package (xserver...dev sounds like something for developing X11 servers). Look for something like xorg-x11-devel or thereabouts. You likely also need some packages with GL or Mesa in the name plus their dev versions. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
On Fri, 2006-12-15 at 14:14 +0100, Peter Dalgaard wrote: I don't think that is the right package (xserver...dev sounds like something for developing X11 servers). Look for something like xorg-x11-devel or thereabouts. You likely also need some packages with GL or Mesa in the name plus their dev versions. I have located x11-proto-gl-dev and libgl-mesa-dev via synaptic as containing gl mesa and dev, but installing them doesn't get the problem resoved... Ivailo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plotting multiple smooth lines on the same graph
Hi Say we have the following data sets: d1=cbind(rnorm(100,1,1), rnorm(100,10,50)) d2=cbind(rnorm(100,5,1), rnorm(100,1,5)) I want to plot them both on the same graph with a curve fitted for each. I could call scatter.smooth to plot the first curve, but how do I add the second? scatter.smooth(d1) Many thanks Eleni Rapsomaniki __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Resolved] Installing rgl package under Ubuntu
On Fri, 2006-12-15 at 14:14 +0100, Peter Dalgaard wrote: I don't think that is the right package (xserver...dev sounds like something for developing X11 servers). Look for something like xorg-x11-devel or thereabouts. You likely also need some packages with GL or Mesa in the name plus their dev versions. Installing libxt-dev (mentioned in the R-admin manual) helped somewhat further, but the I've got: trying URL 'http://cran.xedio.de/src/contrib/rgl_0.68.tar.gz' Content type 'application/x-gzip' length 701566 bytes opened URL == downloaded 685Kb * Installing *source* package 'rgl' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for X... libraries /usr/X11R6/lib, headers checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage configure: creating ./config.status config.status: creating src/Makevars ** libs g++ -I/usr/share/R/include -I/usr/share/R/include -I -DHAVE_PNG_H -I/usr/include/libpng12 -Iext -fpic -g -O2 -c api.cpp -o api.o In file included from glgui.hpp:9, from gui.hpp:11, from rglview.h:10, from Device.hpp:11, from DeviceManager.hpp:9, from api.cpp:14: opengl.hpp:24:20: error: GL/glu.h: No such file or directory api.cpp: In function ‘void rgl_user2window(int*, int*, double*, double*, double*, double*, int*)’: api.cpp:761: error: ‘gluProject’ was not declared in this scope api.cpp: In function ‘void rgl_window2user(int*, int*, double*, double*, double*, double*, int*)’: api.cpp:789: error: ‘gluUnProject’ was not declared in this scope make: *** [api.o] Error 1 chmod: cannot access `/usr/local/lib/R/site-library/rgl/libs/*': No such file or directory ERROR: compilation failed for package 'rgl' ** Removing '/usr/local/lib/R/site-library/rgl' +-+ Now, knowing the missing file (i.e. glu.h, from the more informative feedback) I searched http://packages.ubuntu.com for the package containing glu.h. This turned out to be libglu1-mesa-dev -- installing it resolved the problem, but now I have to clear up the mess with the unnecessarily installed *dev packages;) Thanks for the helpful pointers! Ivailo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
On 12/15/2006 8:35 AM, Ivailo Stoyanov wrote: On Fri, 2006-12-15 at 14:14 +0100, Peter Dalgaard wrote: I don't think that is the right package (xserver...dev sounds like something for developing X11 servers). Look for something like xorg-x11-devel or thereabouts. You likely also need some packages with GL or Mesa in the name plus their dev versions. I have located x11-proto-gl-dev and libgl-mesa-dev via synaptic as containing gl mesa and dev, but installing them doesn't get the problem resoved... rgl needs to know where the X11 headers and libs are, and it appears that the configure script (which was written by autoconfig) isn't finding them. You probably need to specify them manually, when you run configure: --x-includes=DIRX include files are in DIR --x-libraries=DIR X library files are in DIR If you built R, you can find where R found these by looking at the config.log: search for X_CFLAGS and X_LIBS, and you'll see something like X_CFLAGS=' -I/usr/X11R6/include' X_LIBS=' -L/usr/X11R6/lib -lX11 -lXt -lXmu' which should mean that this would install rgl on this system: R CMD INSTALL rgl --configure-args=--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib (In fact, the configure script found them in those locations by itself.) Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
On Fri, 2006-12-15 at 08:55 -0500, Duncan Murdoch wrote: [snip] rgl needs to know where the X11 headers and libs are, and it appears that the configure script (which was written by autoconfig) isn't finding them. You probably need to specify them manually, when you run configure: --x-includes=DIRX include files are in DIR --x-libraries=DIR X library files are in DIR If you built R, you can find where R found these by looking at the config.log: search for X_CFLAGS and X_LIBS, and you'll see something like X_CFLAGS=' -I/usr/X11R6/include' X_LIBS=' -L/usr/X11R6/lib -lX11 -lXt -lXmu' which should mean that this would install rgl on this system: R CMD INSTALL rgl --configure-args=--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib (In fact, the configure script found them in those locations by itself.) Duncan Murdoch Thanks for the response, but meanwhile I figured the solution and have just posted it to the list! It seems that the r-base-dev package from the Ubuntu R backport doesn't provide *all* the packages necessary to build add-on libraries. Greets, Ivailo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
On 12/15/2006 9:01 AM, Ivailo Stoyanov wrote: On Fri, 2006-12-15 at 08:55 -0500, Duncan Murdoch wrote: [snip] rgl needs to know where the X11 headers and libs are, and it appears that the configure script (which was written by autoconfig) isn't finding them. You probably need to specify them manually, when you run configure: --x-includes=DIRX include files are in DIR --x-libraries=DIR X library files are in DIR If you built R, you can find where R found these by looking at the config.log: search for X_CFLAGS and X_LIBS, and you'll see something like X_CFLAGS=' -I/usr/X11R6/include' X_LIBS=' -L/usr/X11R6/lib -lX11 -lXt -lXmu' which should mean that this would install rgl on this system: R CMD INSTALL rgl --configure-args=--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib (In fact, the configure script found them in those locations by itself.) Duncan Murdoch Thanks for the response, but meanwhile I figured the solution and have just posted it to the list! It seems that the r-base-dev package from the Ubuntu R backport doesn't provide *all* the packages necessary to build add-on libraries. I don't think it could: package writers are free to require anything they like. rgl may be the only package requiring the OpenGL headers/libs, for instance. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to load Rcmd without Commander() ?
Dear Ronggui, The Commander() function is called in the Rcmdr .onAttach() function, so library(Rcmdr) automatically starts up the GUI. You could use Rcmdr:::reliability(S), where S is the covariance matrix among the items, without libraryI(Rcmdr). Perhaps somewhat better would be to make a copy of the function in the global environment via reliability - Rcmdr:::reliability. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ronggui Sent: Friday, December 15, 2006 2:54 AM To: R-Help Subject: [R] How to load Rcmd without Commander() ? I would like to use the reliability() function in Rcmdr package, but not the GUI, so I would to load Rcmd without Commander() running automatically. Is there any easy way to get it? Thanks. -- Ronggui Huang Department of Sociology Fudan University, Shanghai, China 黄荣贵 复旦大学社会学系 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plotting multiple smooth lines on the same graph
Eleni Rapsomaniki wrote: Hi Say we have the following data sets: d1=cbind(rnorm(100,1,1), rnorm(100,10,50)) d2=cbind(rnorm(100,5,1), rnorm(100,1,5)) I want to plot them both on the same graph with a curve fitted for each. I could call scatter.smooth to plot the first curve, but how do I add the second? I would probably restructure the data and use xyplot() in the lattice package, but you also could do something along these lines: d1 - cbind(rnorm(100), rnorm(100,3,1)) d2 - cbind(rnorm(100), rnorm(100,1,1)) plot(d1[,1], d1[,2], xlim=range(c(d1[,1], d2[,1])), ylim=range(c(d1[,2], d2[,2])), col=blue, xlab=X, ylab=Y) points(d2[,1], d2[,2], col=red) points(loess.smooth(d1[,1], d1[,2]), type=l, col=blue) points(loess.smooth(d2[,1], d2[,2]), type=l, col=red) scatter.smooth(d1) Many thanks Eleni Rapsomaniki __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
On Fri, 2006-12-15 at 09:03 -0500, Duncan Murdoch wrote: [snip] I don't think it could: package writers are free to require anything they like. rgl may be the only package requiring the OpenGL headers/libs, for instance. Duncan Murdoch You're right, but until I had libxt-dev on my system I couldn't find out what else I need to build rgl successfully. Ivailo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
On 15 December 2006 at 16:01, Ivailo Stoyanov wrote: | It seems that the r-base-dev package from the Ubuntu R backport doesn't | provide *all* the packages necessary to build add-on libraries. Re-read and re-think what you wrote there: you expect the r-base-dev package to provide _all_ possible dependencies for _all_ possible packages. The Oracle of Delphi in a few lines of a meta file? That obviously can't work. r-base-dev tries to give you all you need to compile the _most common_ packages by providing essentially what R itself needs. Specialised packages that use other, more arcane libraries and headers such as OpenGL are obviously not included. Lastly, I can only urge users of Debian and Ubuntu to remember that because we have _native_ packages on Debian and Ubuntu, we also have _native_ Build-Depends information. Had you tried $ sudo apt-get build-dep r-cran-rgl you might have gotten to the finish line much quicker. Regards, Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] persistant: Matlab-R
To the extent that 'persistent' means 'global', global in R is: -, so r - 1 is local scope and r - 1 is global scope. HTH, Roger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles C. Berry Sent: Thursday, December 14, 2006 3:34 PM To: Bernard Gregory Cc: r-help@stat.math.ethz.ch Subject: Re: [R] persistant: Matlab-R It is just my guess that the 'open.account' example in 10.7 Scope of Introduciton to R is what you are after. If I understand what 'presistent' means, the 'total' in the example is approximately equal to a persistent variable. On Thu, 14 Dec 2006, Bernard Gregory wrote: Dear list members, Could anyone tell me if there is an equivalent of the Matlab declaration 'persistant' in R? Thank you very much, Bernard Gregorry. (Matlaber converted to R). - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ** * This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by any error in transmission. If you have received this message in error, please immediately notify the sender by e-mail, delete the message and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] series de tiempo diarias
Existe algún paquete en donde puedo modelizar específicamente series diarias univariadas siguiendo la metodología de Box-Jenkins? Cómo modelizar mas de una estacionalidad en dichas series por ejemplo una estacionalidad semanal y anual? GRacias Santiago Cilintano [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] sapply problem
Sundar Dorai-Raj wrote: Joerg van den Hoff said the following on 12/14/2006 7:30 AM: I have encountered the following problem: I need to extract from a list of lists equally named compenents who happen to be 'one row' data frames. a trivial example would be: a - list(list( df = data.frame(A = 1, B = 2, C = 3)), list(df = data.frame(A = 4,B = 5,C = 6))) I want the extracted compenents to fill up a matrix or data frame row by row. the obvious thing to do seems: b - sapply(a, [[, df) b - t(b) now `b' looks all right: b class(b) but it turns out that all elements in this matrix are one element lists: class(b[1,1]) which prevents any further standard processing of `b' (like `colMeans', e.g.) question 1: is their a straightforward way to enforce that `b' contains simple numbers as elements right from the start (instead of something like apply(b, 1:2, class-, numeric) afterwards)? Try this: a - list(list(df = data.frame(A = 1, B = 2, C = 3)), list(df = data.frame(A = 4, B = 5, C = 6))) b - do.call(rbind, sapply(a, [, df)) b question 2: should not sapply do this further 'simplification' anyway in a situation like this (matrix elements turn out to be one-element lists)? I think it does as it much as it knows how. I think you might believe that matrix elements can only contain numeric values. This is not a valid assumption. Take this example: a - list(1) b - list(2) (m - matrix(c(a, b), 2, 1)) [,1] [1,] 1 [2,] 2 class(m[1, 1]) [1] list class(m[2, 1]) [1] list HTH, --sundar regards joerg thanks for the help to everybody. the proposal of sundar seems the most concise one (if it is also efficient I'll see with larger data sets ..). with regards to my question no. 2: sure I realize that I _can_ have a sensible matrix consisting of elements that are lists. with regards to `sapply' and the intention (as I understand it) to simplify as much as is sensible possible (`sapply' unlists usually everything it can), I think it would be desirable if `sapply' would detect this admittedly very special case: a matrix of one-element lists whose sole list elements are atomic of length 1 (which was my case and is exactly your example above). of course, I don't know whether such a special treatment (probably meaning further recursive tests in `sapply') would slow down `sapply' significantly in general (which would be an argument against such a change of `sapply') or maybe it is against the actual purpose of sapply -- I'm not sure. anyway, thanks again, joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] daily time series
Is there some package in R to model daily univariate time series? We want to model more than one seasonality using the Box-Jenkins' method. That is, we want to model a series with both a yearly and weekly seasonal component. thanks , Santiago Cilintano [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing rgl package under Ubuntu
On 15 December 2006 at 16:01, Ivailo Stoyanov wrote: | It seems that the r-base-dev package from the Ubuntu R backport doesn't | provide *all* the packages necessary to build add-on libraries. Re-read and re-think what you wrote there: you expect the r-base-dev package to provide _all_ possible dependencies for _all_ possible packages. The Oracle of Delphi in a few lines of a meta file? That obviously can't work. r-base-dev tries to give you all you need to compile the _most common_ packages by providing essentially what R itself needs. Specialised packages that use other, more arcane libraries and headers such as OpenGL are obviously not included. Dirk, I'm obviously not that deep into the Debian/Ubuntu package management, and these considerations of mine should be taken just as what they are -- considerations of a puzzled R user that has some problems with building some package;) Lastly, I can only urge users of Debian and Ubuntu to remember that because we have _native_ packages on Debian and Ubuntu, we also have _native_ Build-Depends information. Had you tried $ sudo apt-get build-dep r-cran-rgl you might have gotten to the finish line much quicker. Thanks a lot for this hint! It is very useful and I would definitely hit the target much easier if I knew about that. The source for the problem at hand have to be sought back in times when I relied too much on the native cran-r-* packages, until I found that not everything is available natively, so I started to install only the *-base packages and to rely on the *-dev one to provide the dependencies I need to build needed ad-on libraries manually. Actually, until now everything went just fine this way, and I still appreciate much such cases that fill my (still numerous) knowledge gaps. Regards, Dirk Greets, Ivailo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] daily time series
I think you can fit them using arima() whch I think is part of the base. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Santiago Cilintano Sent: Friday, December 15, 2006 10:41 AM To: r-help@stat.math.ethz.ch Subject: [R] daily time series Is there some package in R to model daily univariate time series? We want to model more than one seasonality using the Box-Jenkins' method. That is, we want to model a series with both a yearly and weekly seasonal component. thanks , Santiago Cilintano [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plotting multiple smooth lines on the same graph
Hi you can either use supsmu smoother plot(d1) # make sure limits for axes are OK (which is not in this case and you need to set xlim and ylim accordingly lines(supsmu(d1[,1], d1[,2])) points(d2, pch=2) lines(supsmu(d2[,1], d2[,2])) or you can use loess smoother which is used in scatter.smooth and do some ordering before plotting and similar plot lines points lines construction. HTH Petr On 15 Dec 2006 at 13:42, Eleni Rapsomaniki wrote: Date sent: Fri, 15 Dec 2006 13:42:25 + From: Eleni Rapsomaniki [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] Plotting multiple smooth lines on the same graph Hi Say we have the following data sets: d1=cbind(rnorm(100,1,1), rnorm(100,10,50)) d2=cbind(rnorm(100,5,1), rnorm(100,1,5)) I want to plot them both on the same graph with a curve fitted for each. I could call scatter.smooth to plot the first curve, but how do I add the second? scatter.smooth(d1) Many thanks Eleni Rapsomaniki __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] series de tiempo diarias
2006/12/15, Santiago Cilintano [EMAIL PROTECTED]: Existe algún paquete en donde puedo modelizar específicamente series diarias univariadas siguiendo la metodología de Box-Jenkins? Cómo modelizar mas de una estacionalidad en dichas series por ejemplo una estacionalidad semanal y anual? GRacias Santiago Cilintano [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Classical time series modelling tools are contained in the stats package and include arima() for ARIMA modelling and Box-Jenkins-type analysis. Please read the posting-guide, http://www.r-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Switching labels on a factor
Hi All, I'm perplexed by the way the unclass function displays a factor whose labels have been swapped with the relevel function. I realize it won't affect any results and that the relevel did nothing useful in this particular case. I'm just doing it to learn ways to manipulate factors. The display of unclass leaves me feeling that the relevel had failed. I've checked three books searched R-help, but found no mention of this particular issue. The program below demonstrates the problem. Is this a bug, or is there a reason for it to work this way? Thanks, Bob mystring- (id,workshop,gender,q1,q2,q3,q4 1,1,f,1,1,5,1 2,2,f,2,1,4,1 3,1,f,2,2,4,3 4,2,f,3,1, ,3 5,1,m,4,5,2,4 6,2,m,5,4,5,5 7,1,m,5,3,4,4 8,2,m,4,5,5,9) mydata-read.table(textConnection(mystring), header=TRUE,sep=,,row.names=id,na.strings=9) mydata # Create a gender Releveled variable, gR. # Now 1=m, 2=f mydata$gR - relevel(mydata$gender, m) # Print the data to show that the labels of gR match those of gender. mydata # Show that the underlying codes have indeed reversed. as.numeric(mydata$gender) as.numeric(mydata$gR) # Unclass the two variables to see that print order # implies that both the codes and labels have # flipped, cancelling each other out. For gR, # m appears to be associated with 2, and f with 1 unclass(mydata$gender) unclass(mydata$gR) = Bob Muenchen (pronounced Min'-chen), Manager Statistical Consulting Center U of TN Office of Information Technology 200 Stokely Management Center, Knoxville, TN 37996-0520 Voice: (865) 974-5230 FAX: (865) 974-4810 Email: [EMAIL PROTECTED] Web: http://oit.utk.edu/scc, News: http://listserv.utk.edu/archives/statnews.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] xyplot: legend title + legend on 1 line
Does anybody know how in xyplot to put the legend title on one line with the legend? I can get the legend on one line with columns=... but the title is always on top. I tried a custom key with key=... and text=... but I can't put the title text in front of the plotting symbol. I am looking for the following layout of the legend, on one line: Legend Title: + plot symbol1 + legend text1 + plot symbol2 + legend text2 + ... Thanks. Rene -- View this message in context: http://www.nabble.com/xyplot%3A-legend-title-%2B-legend-on-1-line-tf2829327.html#a7898800 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: legend title + legend on 1 line
On 12/15/06, RMan54 [EMAIL PROTECTED] wrote: Does anybody know how in xyplot to put the legend title on one line with the legend? I can get the legend on one line with columns=... but the title is always on top. I tried a custom key with key=... and text=... but I can't put the title text in front of the plotting symbol. I am looking for the following layout of the legend, on one line: Legend Title: + plot symbol1 + legend text1 + plot symbol2 + legend text2 + ... You can create a grob (grid object) representing this legend, or a function that produces such a grob, and pass it to xyplot through the 'legend' argument (see ?xyplot). The 'key' argument essentially controls one such built-in function, namely 'draw.key', which does not support such legends. Note however, that column types can be repeated in key, so you might be able to fake such a legend. E.g.: xyplot(1 ~ 1, key = list(text = list(title: , font = 2), points = list(pch = 1), text = list(1), points = list(pch = 2), text = list(2))) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] xyplot: logarithmic y-axis
This should be simple but I am struggling. I like to easily switch in xyplot between a linear or logarithmic y-axis by setting a logical flag logY to False or True. This switch changes the scales argument of xyplot. I found out that the original two-dimentional data (Conc vs Time in my case) are converted to log10(Conc) if log=TRUE in scales, but it appears that functions like panel.curve need to provide the y values in log10 form (if there is an automatic method, I would like to know). I therefore like to pass on the value logY to my custom panel.curve function. How do I do that? I think that the value of logY should go into xyplot that should pass it on to the panel function and then to the panel.curve function. Thanks, -Rene logY=TRUE # Custom panel.curve function myCurve -function(x, log) { f - ... # calculate curve here if (log==TRUE) f - log10(f) return(f) } xyplot(Conc ~ Time | Subj, groups=Dose, data = mydata, as.table=TRUE, scales=list(y=list(log=logY)), panel = function(...) { panel.abline(h=c(0, 50, 100, 150, 200, 250) , v=c(0,24,48,72,96), col.line=gray) panel.xyplot(...) panel.curve(myCurve, from=0, to=96, n=300)) } ) -- View this message in context: http://www.nabble.com/xyplot%3A-logarithmic-y-axis-tf2829755.html#a7900202 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: logarithmic y-axis
On 12/15/06, RMan54 [EMAIL PROTECTED] wrote: This should be simple but I am struggling. I like to easily switch in xyplot between a linear or logarithmic y-axis by setting a logical flag logY to False or True. This switch changes the scales argument of xyplot. I found out that the original two-dimentional data (Conc vs Time in my case) are converted to log10(Conc) if log=TRUE in scales, but it appears that functions like panel.curve need to provide the y values in log10 form (if there is an automatic method, I would like to know). I therefore like to pass on the value logY to my custom panel.curve function. How do I do that? I think that the value of logY should go into xyplot that should pass it on to the panel function and then to the panel.curve function. It probably should, but doesn't. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] DF for GAM function (mgcv package)
For summary(GAM) in the mgcv package smooth the degrees of freedom for the F value for test of smooth terms are the rank of covariance matrix of \hat{beta} and the residuals df. I've noticed that in a lot of GAMs I've fit the rank of the covariance turns out to be 9. In Simon Wood's book, the rank of covariance matrix is usually either 9 or 99 (pages 239-230 and 259). Can anyone comment on why so many smooth terms have a denominator degree of freedom involving 9. Simon Wood writes r is usually determinted numerically, while forming the pseudoinverse of the covariance matrix, or with reference to the effective degrees of freedom of the term which doesn't really clarify the issue for me at least. Thanks. Brendan Klick Johns Hopkins University School of Medicine. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: logarithmic y-axis
Please take no offence since none was intended. What I meant is that it should be simple for me to know how to do this but it isn't because of my inexperience. I think that the lattice package is great. However, how can I pass on my own varaibles through xyplot? Thanks, -Rene Deepayan Sarkar wrote: On 12/15/06, RMan54 [EMAIL PROTECTED] wrote: This should be simple but I am struggling. I like to easily switch in xyplot between a linear or logarithmic y-axis by setting a logical flag logY to False or True. This switch changes the scales argument of xyplot. I found out that the original two-dimentional data (Conc vs Time in my case) are converted to log10(Conc) if log=TRUE in scales, but it appears that functions like panel.curve need to provide the y values in log10 form (if there is an automatic method, I would like to know). I therefore like to pass on the value logY to my custom panel.curve function. How do I do that? I think that the value of logY should go into xyplot that should pass it on to the panel function and then to the panel.curve function. It probably should, but doesn't. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/xyplot%3A-logarithmic-y-axis-tf2829755.html#a7900634 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: logarithmic y-axis
On 12/15/06, RMan54 [EMAIL PROTECTED] wrote: Please take no offence since none was intended. What I meant is that it should be simple for me to know how to do this but it isn't because of my inexperience. I think that the lattice package is great. I didn't mean to suggest that I was offended. I only agreed with you that it would be nice if there were a way of knowing inside the panel function whether a log scale is being used, and informing you that there isn't. However, how can I pass on my own varaibles through xyplot? Any arguments not recognized by xyplot will be passed to the panel function. -Deepayan Thanks, -Rene Deepayan Sarkar wrote: On 12/15/06, RMan54 [EMAIL PROTECTED] wrote: This should be simple but I am struggling. I like to easily switch in xyplot between a linear or logarithmic y-axis by setting a logical flag logY to False or True. This switch changes the scales argument of xyplot. I found out that the original two-dimentional data (Conc vs Time in my case) are converted to log10(Conc) if log=TRUE in scales, but it appears that functions like panel.curve need to provide the y values in log10 form (if there is an automatic method, I would like to know). I therefore like to pass on the value logY to my custom panel.curve function. How do I do that? I think that the value of logY should go into xyplot that should pass it on to the panel function and then to the panel.curve function. It probably should, but doesn't. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: logarithmic y-axis
I added logY as the last argument to xyplot and in my curve function. I got the following error message: Error in myCurve(x) : argument log is missing, with no default myCurve -function(x, log) { f - ... # calculate curve here if (log==T) f - log10(f) return(f) } logY=T xyplot(Conc ~ Time | Subj, groups=Dose, data = mydata, scales=list(x=list(at=seq(0,96,24)), y=list(log=logY)), panel = function(...) { panel.abline(h=c(0, 50, 100, 150, 200, 250) , v=c(0,24,48,72,96), col.line=gray) panel.xyplot(...) panel.curve(myCurve, from=0, to=96, n=300, ..., log=logY) }, logY ) Deepayan Sarkar wrote: On 12/15/06, RMan54 [EMAIL PROTECTED] wrote: Please take no offence since none was intended. What I meant is that it should be simple for me to know how to do this but it isn't because of my inexperience. I think that the lattice package is great. I didn't mean to suggest that I was offended. I only agreed with you that it would be nice if there were a way of knowing inside the panel function whether a log scale is being used, and informing you that there isn't. However, how can I pass on my own varaibles through xyplot? Any arguments not recognized by xyplot will be passed to the panel function. -Deepayan Thanks, -Rene Deepayan Sarkar wrote: On 12/15/06, RMan54 [EMAIL PROTECTED] wrote: This should be simple but I am struggling. I like to easily switch in xyplot between a linear or logarithmic y-axis by setting a logical flag logY to False or True. This switch changes the scales argument of xyplot. I found out that the original two-dimentional data (Conc vs Time in my case) are converted to log10(Conc) if log=TRUE in scales, but it appears that functions like panel.curve need to provide the y values in log10 form (if there is an automatic method, I would like to know). I therefore like to pass on the value logY to my custom panel.curve function. How do I do that? I think that the value of logY should go into xyplot that should pass it on to the panel function and then to the panel.curve function. It probably should, but doesn't. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/xyplot%3A-logarithmic-y-axis-tf2829755.html#a7901073 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ks.test greater and less
2006/12/15, Carmen Meier [EMAIL PROTECTED]: Hello r-group I have a question to the ks.test. I would expect different values for less and greater between data1 and data2. Does anybody could explain my point of misunderstanding the function? data1-c(8,12,43,70) data2- c(70,43,12,8) ks.test(data1,pnorm) ks.test(data1,pnorm,alternative =less)#expected 0.001 ks.test(data1,pnorm,alternative =greater) #expected =1 ks.test(data2,pnorm) ks.test(data2,pnorm,alternative =less) #expected =1 ks.test(data2,pnorm,alternative =greater) #expected 0.001 With regards Carmen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Possible you are unable to use the Kolmogorov–Smirnov test given that the sample size is small. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: logarithmic y-axis
On 12/15/06, RMan54 [EMAIL PROTECTED] wrote: I added logY as the last argument to xyplot and in my curve function. I got the following error message: Error in myCurve(x) : argument log is missing, with no default myCurve -function(x, log) { f - ... # calculate curve here if (log==T) f - log10(f) return(f) } logY=T xyplot(Conc ~ Time | Subj, groups=Dose, data = mydata, scales=list(x=list(at=seq(0,96,24)), y=list(log=logY)), panel = function(...) { panel.abline(h=c(0, 50, 100, 150, 200, 250) , v=c(0,24,48,72,96), col.line=gray) panel.xyplot(...) panel.curve(myCurve, from=0, to=96, n=300, ..., log=logY) }, logY ) You need to learn more about (1) R functions and (2) R's scoping rules. Your last argument (logY) is not doing what you think it's doing (which doesn't really matter because of the scoping rules). Your error is caused because in panel.curve(myCurve, from=0, to=96, n=300, ..., log=logY) the 'log' argument is not being passed to myCurve (nor is it supposed to). However, you should be able to replace it by panel.curve(myCurve(x, log = logY), from=0, to=96, n=300, ...) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better way to change the name of a column in a dataframe?
And there is the rename.vars() function in the gdata package. -Don At 11:39 AM -0600 12/14/06, Ben Fairbank wrote: Hello R users -- If I have a dataframe such as the following, named frame with the columns intended to be named col1 through col6, frame col1 col2 cmlo3 col4 col5 col6 [1,]3 10 2657 [2,]68 4 1071 [3,]75 1318 [4,] 106 5492 and I want to correct or otherwise change the name of one of the columns, I can do so with dimnames(frame)[[2]][which(dimnames(frame)[[2]]==cmlo3)] - col3 which renames the offending column: frame col1 col2 col3 col4 col5 col6 [1,]3 102657 [2,]684 1071 [3,]751318 [4,] 1065492 This seems cumbersome and not very intuitive. How can one accomplish this more simply? With thanks for any suggestions, Ben Fairbank [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to adjust link function in logistic regression to predict the proportion of correct responses in 2AFC task?
I have would like to use logistic regression to analyze the percentage of correct responses in a 2 alternative forced choice task. The question is whether one needs to take into account the fact expected probabilities for the percentage of correct responses ranges between 0.5 and 1 in this case and how to adjust the link function accordingly in R (see details below). Gabriel Subjects were asked to match a tactile stimulus (shape A or B) with a visual template (response a or b). The exact stimulus properties depended on the experimental factors ecc (3 levels: 0.4, 0.7 and 1.0) and kappa (also 3 levels: 0.75, 1, 1.25), which yielded nine experimental conditions. Five subjects participated to the experiment and each stimulus was presented 10 times in each experimental condition. The following table reports the pooled responses of the 5 subjects. | | kappa | | | 0.75 1.0 1.25 | ecc | shape ++++ | | resp | resp | resp | | | a b | a b | a b | +---++++ 0.4 | A | 41 9 | 38 12 | 35 15 | | B | 3 47 | 7 43 | 11 39 | +---++++ 0.7 | A | 22 28 | 33 17 | 39 11 | | B | 10 40 | 21 29 | 24 26 | +---++++ 1.0 |A | 26 24 | 26 24 | 28 22 | | B | 20 30 | 18 32 | 25 25 | +---++++ For this analysis, I define correct response as the resp=a for shape=A and resp=b for shape=B. The proportions of correct responses are therefore: | | kappa | ecc | shape | 0.75 1.0 1.25 | +---++++ 0.4 | A | 0.82 | 0.76 | 0.70 | | B | 0.94 | 0.86 | 0.78 | +---++++ 0.7 | A | 0.44 | 0.66 | 0.78 | | B | 0.80 | 0.58 | 0.52 | +---++++ 1.0 |A | 0.52 | 0.52 | 0.56 | | B | 0.60 | 0.62 | 0.50 | +---++++ The proportion of correct response is the largest for ecc=0.4 and, in general, smallest for ecc=1 as expected. It was expected that proportions of correct response would be close to 0.5 when ecc=1 because shapes A and B were the same in this condition. I would like to use the logistic regression to assess the effect of the shape, ecc and kappa on the proportion of correct responses. For example, glm(resp~shape*ecc*kappa,data=data,link=binomial) or, better, gee(resp~shape*ecc*kappa,id=subject,data=data,family=binomial, corstr = exchangeable) given the fact that data that are correlated because the 50 responses come from five subjects. My first question is rather statistical: do I need to take into account the fact that the values of these proportions are expected to range in the interval [0.5-1] (0.5 corresponding to a random response) ? It seems to me that some sort of correction is needed as it is the case when one fits a psychometric function to this type of data (e.g. probit is rescaled to fit inside the [0.5-1] interval and the absolute threshold is defined as the point where the probit reaches the 0.75 probability level). Second, how can one implement a link function of the type f(x) = (1+exp(x)/(1+exp(x)))/2 in R? Third, can it be also done with gee and/or glmm? - Gabriel Baud-Bovy tel.: (+39) 02 2643 4839 (office) UHSR University (+39) 02 2643 3429 (laboratory) via Olgettina, 58 (+39) 02 2643 4891 (secretary) 20132 Milan, Italy fax: (+39) 02 2643 4892 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Seeking advice on lattice package in R2.4.0 concerning stripplot
Dear all, I am using the R 2.4.0 environment on Windows XP SP2 machine and trying to use the lattice package version 0.14-9 which you have kindly written to share with the R community. I have a question concerning the stripplot which I'd be very grateful if you can kindly advise me on: I used the dataset called trydata to plot a graph using stripplot (dataset attached), and the scripts used to procude the plot is as follows: trydata-dget(trydata) stripplot(Position~Count|y*Grouping,jitter=T,group=subtype, data=trydata,xlab=Count rate (%), pch=c(0,3,6,5), key=list(text=list(c(GS in front, GS at the back, MS in front,MS at the back)), points = Rows(trellis.par.get(superpose.symbol),1:4), columns=2)) When I plotted the graph and viewed it on R, the legend and the datapoint shapes are correct. However, when I export it into .pdf form using the pulldown menu in R, the legend for GS in front is incorrect. Instead if being a prism, it became a circle. How can I get around this? I've attached the figure thus generated in pdf form for your kind consideration. Specifically, how can I modify the specifications in the command to produce the correct pch type in the legend as in the chart itself? Thank you very much in advance for your kind advice. Best Lin trydatafigure.pdf Description: Adobe PDF document __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to adjust link function in logistic regression to predict the proportion of correct responses in 2AFC task?
On Sat, 16 Dec 2006, [EMAIL PROTECTED] wrote: I have would like to use logistic regression to analyze the percentage of correct responses in a 2 alternative forced choice task. The question is whether one needs to take into account the fact expected probabilities for the percentage of correct responses ranges between 0.5 and 1 in this case. Yes. Second, how can one implement a link function of the type f(x) = (1+exp(x)/(1+exp(x)))/2 in R? Looking at make.link() should give you enough to go on. Third, can it be also done with gee and/or glmm? For gee, you need to change the C-level internals. (I've done this in the far past for S-PLUS but not for R.) It would be easier to use yags (but I think you still need to dive into the internals). What 'glmm' did you have in mind? Looks like e.g. glmmML and glmmPQL will work with the new link. [...] Someone may have been here already: e.g. http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1434755 -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Seeking advice on lattice package in R2.4.0 concerning stripplot
The problem looks to be that you are specifying the types of symbols in two ways: pch=c(0,3,6,5), points = Rows(trellis.par.get(superpose.symbol),1:4), The simplest thing to do is to run your code directly on the pdf() device, but you could experiment with other ways of setting the key. (We don't have the data, so cannot test these ideas.) On Sat, 16 Dec 2006, Dr L. Y Hin wrote: Dear all, I am using the R 2.4.0 environment on Windows XP SP2 machine and trying to use the lattice package version 0.14-9 which you have kindly written to share with the R community. I have a question concerning the stripplot which I'd be very grateful if you can kindly advise me on: I used the dataset called trydata to plot a graph using stripplot (dataset attached), and the scripts used to procude the plot is as follows: trydata-dget(trydata) stripplot(Position~Count|y*Grouping,jitter=T,group=subtype, data=trydata,xlab=Count rate (%), pch=c(0,3,6,5), key=list(text=list(c(GS in front, GS at the back, MS in front,MS at the back)), points = Rows(trellis.par.get(superpose.symbol),1:4), columns=2)) When I plotted the graph and viewed it on R, the legend and the datapoint shapes are correct. However, when I export it into .pdf form using the pulldown menu in R, the legend for GS in front is incorrect. Instead if being a prism, it became a circle. How can I get around this? I've attached the figure thus generated in pdf form for your kind consideration. Specifically, how can I modify the specifications in the command to produce the correct pch type in the legend as in the chart itself? Thank you very much in advance for your kind advice. Best Lin -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to adjust link function in logistic regression to predict the proportion of correct responses in 2AFC task?
In theory, the probability of correct responses ranges between 0.5 and 1 here, but in practice it is frequent to find cases where the observed proportion of correct responses is a little less. The number of trials is limited, after all. The inverse of this link function generates a Nan when this occurs. Is that a problem? and if so, how can it be dealt with here? Thank you. I have used the gnlr function in Lindsey's gnlm package for this problem in the past, but glm would be simpler, it seems to me. @Article{pmid16817511, Author=Yssaad-Fesselier, Rosa and Knoblauch, Kenneth, Title={{M}odeling psychometric functions in {R}}, Journal=Behav Res Methods, Year=2006, Volume=38, Number=1, Pages=28--41, Month=Feb } On Sat, 16 Dec 2006, baud-bovy.gabriel at hsr.it wrote: I have would like to use logistic regression to analyze the percentage of correct responses in a 2 alternative forced choice task. The question is whether one needs to take into account the fact expected probabilities for the percentage of correct responses ranges between 0.5 and 1 in this case. Yes. Second, how can one implement a link function of the type f(x) = (1+exp(x)/(1+exp(x)))/2 in R? Looking at make.link() should give you enough to go on. Third, can it be also done with gee and/or glmm? For gee, you need to change the C-level internals. (I've done this in the far past for S-PLUS but not for R.) It would be easier to use yags (but I think you still need to dive into the internals). What 'glmm' did you have in mind? Looks like e.g. glmmML and glmmPQL will work with the new link. [...] Someone may have been here already: e.g. http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1434755 -- Brian D. Ripley, ripley at 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 -- Ken Knoblauch Inserm U371 Institut Cellule Souche et Cerveau Département Neurosciences Intégratives 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.lyon.inserm.fr/371/ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to adjust link function in logistic regression to predict the proportion of correct responses in 2AFC task?
On Sat, 16 Dec 2006, Ken Knoblauch wrote: In theory, the probability of correct responses ranges between 0.5 and 1 here, but in practice it is frequent to find cases where the observed proportion of correct responses is a little less. The number of trials is limited, after all. The inverse of this link function generates a Nan when this occurs. Is that a problem? and if so, how can it be dealt with here? No. Links apply to fitted values, not observed proportions, and R link functions have a validity function to ensure they are used correctly. Thank you. I have used the gnlr function in Lindsey's gnlm package for this problem in the past, but glm would be simpler, it seems to me. @Article{pmid16817511, Author=Yssaad-Fesselier, Rosa and Knoblauch, Kenneth, Title={{M}odeling psychometric functions in {R}}, Journal=Behav Res Methods, Year=2006, Volume=38, Number=1, Pages=28--41, Month=Feb } On Sat, 16 Dec 2006, baud-bovy.gabriel at hsr.it wrote: I have would like to use logistic regression to analyze the percentage of correct responses in a 2 alternative forced choice task. The question is whether one needs to take into account the fact expected probabilities for the percentage of correct responses ranges between 0.5 and 1 in this case. Yes. Second, how can one implement a link function of the type f(x) = (1+exp(x)/(1+exp(x)))/2 in R? Looking at make.link() should give you enough to go on. Third, can it be also done with gee and/or glmm? For gee, you need to change the C-level internals. (I've done this in the far past for S-PLUS but not for R.) It would be easier to use yags (but I think you still need to dive into the internals). What 'glmm' did you have in mind? Looks like e.g. glmmML and glmmPQL will work with the new link. [...] Someone may have been here already: e.g. http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1434755 -- Brian D. Ripley, ripley at 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 -- Ken Knoblauch Inserm U371 Institut Cellule Souche et Cerveau Département Neurosciences Intégratives 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.lyon.inserm.fr/371/ -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.