Re: [R] gamma distribution
Hi I am a little bit confused. You create two sample (from a gamma distribution) and you do a wilcoxon test with this two samples. Then you use the same monotone transformation (log) for both samples and redo the wilcoxon test. But since the transformations keeps the order of your samples the second wilcoxon test is identical to the first one: x-rgamma(10, 2.5, scale = 10) y-rgamma(10, 2.5, scale = 10) wilcox.test(x, y, var.equal = FALSE) x1-log(x) y1-log(y) wilcox.test(x1, y1, var.equal = FALSE) Maybe you can give some more details about the hypothesis you'd like to test. Regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- [EMAIL PROTECTED] writes: Hi R Users This is a code I wrote and just want to confirm if the first 1000 values are raw gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get 2000 rows once I import into excel, the p - values beyond 1000 dont look that good, they are very high. -- sink(a1.txt); for (i in 1:1000) { x-rgamma(10, 2.5, scale = 10) y-rgamma(10, 2.5, scale = 10) z-wilcox.test(x, y, var.equal = FALSE) print(z) x1-log(x) y1-log(y) k-wilcox.test(x1, y1, var.equal = FALSE) print(k) } --- any suggestions are welcome thanks -devarshi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] gamma distribution
[EMAIL PROTECTED] wrote: Hi R Users This is a code I wrote and just want to confirm if the first 1000 values are raw gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get 2000 rows once I import into excel, the p - values beyond 1000 dont look that good, they are very high. He? - log() transforming the data does not change the Wilcoxon statistics (based on ranks!)! - Why is this related to Excel? - What are you going to show? I get erg - replicate(1000, { x-rgamma(10, 2.5, scale = 10) y-rgamma(10, 2.5, scale = 10) wilcox.test(x, y, var.equal = FALSE)$p.value }) sum(erg 0.05) # 45 which seems plausible to me. Uwe Ligges -- sink(a1.txt); for (i in 1:1000) { x-rgamma(10, 2.5, scale = 10) y-rgamma(10, 2.5, scale = 10) z-wilcox.test(x, y, var.equal = FALSE) print(z) x1-log(x) y1-log(y) k-wilcox.test(x1, y1, var.equal = FALSE) print(k) } --- any suggestions are welcome thanks -devarshi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How learn a probabilities matrix from a large fasta file in R?
Hi everybody, I have a large fasta file(15M) which contains a lot of DNA sequence in fasta format.And i want to get probabilities matrix for 2nd order markov china from this background.Here is a web tool, http://tandem.bu.edu/markov.html.But i can not upload a large file. I wonder if there is a R packages can do this ,Thanks in advance . Jiantao Shi ** http://tandem.bu.edu/markov.html** http://tandem.bu.edu/markov.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A question about par.plot in gamlss
As the posting guide says, please ask the package maintainer -- I believe he does not read R-help regularly. Your layout is hard to read (please do use spaces and indentation in posted code), but probably there is a scoping problem with par.plot used inside a function. On Wed, 27 Jul 2005, hari iyer wrote: Hello I am using the following code to plot a data matrix into a form that seems suitable for the use of par.plot. library(gamlss) a-matrix(c(1,2,3,4,5,6,7,8,9,8,7,6),nrow=3) rownames(a)-c(trt1,trt2,trt3) colnames(a)-c(col1,col2,col3,col4) hpar.plot-function(ZZ){ ZZvar-c(t(ZZ)) ZZtrt-c(matrix(rep(1:ncol(ZZ),nrow(ZZ ZZcov-as.factor(c(t(matrix(rep(rownames(ZZ),ncol(ZZ)),nrow=nrow(ZZ) par.plot(ZZvar ~ ZZtrt,sub=ZZcov) } hpar.plot(a) I keep getting the following error message: Error in eval(expr, envir, enclos) : Object ZZvar not found I am unable to figure out my error. Can someone help please? Thanks in advance. Hari __ 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 -- 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
Re: [R] trellis graphics/ trellis.par.set()
McClatchie, Sam (PIRSA-SARDI) wrote: Background: OS: Linux Mandrake 10.1 release: R 2.0.0 editor: GNU Emacs 21.3.2 front-end: ESS 5.2.3 - Colleagues I want to increase the size of the axis markings and labels on some trellis graphs, and I am having some trouble with trellis.par.set() trellis.par.set(par.xlab.text.cex = list(cex=1.5)) You mean: trellis.par.set(par.xlab.text = list(cex=1.5)) Uwe Ligges is not quite right, and having read the documentation, I wonder if anyone help me get the graphical parameter right? print(trellis.par.get()) returns $par.xlab.text.cex Best fishes Sam Sam McClatchie, Biological oceanography South Australian Aquatic Sciences Centre PO Box 120, Henley Beach 5022 Adelaide, South Australia email [EMAIL PROTECTED] Telephone: (61-8) 8207 5448 FAX: (61-8) 8207 5481 Research home page http://www.members.iinet.net.au/~s.mcclatchie/ /\ ...xX(° °)Xx / \\ (((° (((° ...xX(°O°)Xx __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] rpart.permutation, snow, rsprng binary files
Dear R-users, Does anyone of you have binary files for the packages rpart.permutation, snow and rsprng. I would like to use them in my classification tree. I know they are still at the 0.x development stage, though. Where can I get information on how to compile tar.gz files? I'm using windows XP with R 2.1.0. Thanks, Jan Jan Wijffels Universitair Centrum voor Statistiek W. de Croylaan 54 3001 Heverlee tel: 016/322784 fax: 016/322831 e-mail: [[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
[R] Asymmetric colors for heatmap
Dear expeRts, Currently, my colors are as follows: mycol - c(blue1,blue2,blue3,blue4,black,yellow4,yellow3,yellow2,y ellow1) heatmap(snp, Rowv=NA, Colv=NA, col=mycol) However, I would like to have the following colors: bright blue - dark blue: for intensity range from 0 to 2 in steps of 0.5 (i.e. 4 grades of blue) black: for intensity 2 dark yellow - bright yellow: for intensity range from 2 to 8 in steps of 0.5 (i.e. 8 grades of yellow) You may realize that I want to display copy number data from SNP-chips as heatmap. Since copynumber = 2, is the default value, I want to display it in black, LOH in increasing blue, and amplifications in increasing yellow. Even though there may be higher amplification rates, a value of CN=8 should already display the brightest yellow. In Spotfire it is easy to achieve this, especially that CN=2 is always displayed as black, however, I do not know how to do it in R. Can you tell me how I have to create the colors to achieve this? (P.S.: Of course, I could do: snp[snp8] - 8, but this will not solve my problem with asymmetric colors) Thank you in advance Christian Stratowa __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Anybody have a binary version of SJava for rw2001 (Windows)?
On the omegahat site, you can read: There is currently no binary available for Windows. I hope to release one wihtin a few weeks (i.e. near the end of September, 2004). You can ask to developers an unofficial binary version for you. Maybe they have, or maybe they're esperiencing problems in building it, in which case I fear you have to stand by a little more... Antonio, Fabio Di Narzo. Il giorno mar, 26/07/2005 alle 23.39 +0100, Quin Wills ha scritto: I am not a techie and have been struggling 2 days solid to try and install SJava (the source from http://www.omegahat.org/RSJava/). Does anybody have a binary file for me (I am Windows XP and rw2001)? I have tried installing Perl, mingwin and the cygwin tools but still no luck. When I try R CMD INSTALL c:\SJava_0.78-0.tar.gz I get the following (and havent a clue what it could mean): -Making package SJava-- Building JNI header files... Extracting the classes from Environment.jar /jdk1.3/bin/jar: not found RForeignReference /jdk1.3/bin/javah: not found ROmegahat Interpreter /jdkl.3/bin/javah: not found REvaluator /jdkl.3/bin/Javah: not found RManualFunctionActionListener /jdk1.3/bin/javah: not found /jdkl.3/bin/javah: not found adding build stamp to DESCRIPTION running src/Makefile.win (cd .. ; ./configure.win c:/PROGRW1/R/rw200l) /configure.win: not found make[3]: *** [conf ig] Error 127 make[2]: *** [srcDynLib] Error 2 make[1]: *** [all] Error 2 make: *** [pkgSJava] Error 2 *** Installation of SJava failed *** --- [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rpart.permutation, snow, rsprng binary files
They rely on multiprocessing infrastructure not normally available on Windows. If you have this (and I don't know if it can be compiled on Windows but dome at least of the options cannot) you should be able to compile the source packages against the versions you have. On Wed, 27 Jul 2005, Jan Wijffels wrote: Does anyone of you have binary files for the packages rpart.permutation, snow and rsprng. I would like to use them in my classification tree. I know they are still at the 0.x development stage, though. Where can I get information on how to compile tar.gz files? I'm using windows XP with R 2.1.0. -- 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
[R] how to overlook the zero in the denominator
Dear R users: I have two set of data, as follow: x-c(0,0,0.28,0.55,1.2,2,1.95,1.85, 1.6,0.86,0.78,0.6,0.21,0.18) y-c(0,0,0,0.53,1.34,1.79,2.07,1.88, 1.52,0.92,0.71,0.55,0.32,0.19) i-1:length(x) I want to sum each (x[i]-y[i])^2/x[i] together, like: Sum -sum((x[i]-y[i])^2/x[i]) Sum [1] NaN Because the denominator shoud not be zero. So I want to overlook those when x[i]=0, and just to sum those x[i] not equal to 0. What should I do? Any suggestion. Thanks in advance !! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] spss.read factor reversal
Adaikalavan Ramasamy [EMAIL PROTECTED] writes: I think it is doing what is supposed to do but I never used read.spss, so take this with a pinch of salt. In R when you use as.integer on a factor, the one with the lowest level gets a value of 1 and so on. The lowest level of the factor can determined from levels() function. f - factor( c(Green, Green, Red, Blue), levels=c(Red, Blue, Green) ) levels(f) [1] Red Blue Green as.integer(f) [1] 3 3 1 2 But the levels of a factor can be changed as.integer( factor( f, levels=c(Green, Blue, Red ) ) ) [1] 1 1 3 2 Doesn't explain why 1 2 3 in the input file comes out as Green Blue Red, does it? You can also try setting use.value.labels=FALSE in read.spss function and then creating a factor out of it. Would be interesting to see this. I would suspect that the damage is already done at that point though. I notice that the value labels are in reverse order. Shouldn't matter to read.spss which has rval[[nm]] - factor(rval[[nm]], levels = vl[[v]], labels = trim(names(vl[[v]]))) i.e. levels and labels should be in the correct order. But something is odd, you'd expect the following effect: x - 1:3 factor(x,levels=3:1,labels=c(G,B,R)) [1] R B G Levels: G B R as.integer(factor(x,levels=3:1,labels=c(G,B,R))) [1] 3 2 1 but Joel's output has the levels in the order R B G, which contradicts the attr(,label.table)$COLOR BTW, this is R 2.1.1, I hope Joel isn't wasting our time by using an older version... -p Regards, Adai On Tue, 2005-07-26 at 17:04 -0700, Joel Bremson wrote: Hi, I'm having a problem with spss.read reversing my factor input. Here is the input copied from the spss data editor: color cost 1 2.30 2 2.40 3 3.00 1 2.10 1 1.00 1 2.00 2 4.00 2 3.20 2 2.33 3 2.44 3 2.55 For color, red=1, blue=2, and green = 3. It's type is 'String' and out=read.spss(file) out $COLOR [1] green blue red green green green blue blue blue red red Levels: red blue green $COST [1] 2.30 2.40 3.00 2.10 1.00 2.00 4.00 3.20 2.33 2.44 2.55 attr(,label.table) attr(,label.table)$COLOR green blue red 3 2 1 attr(,label.table)$COST NULL attr(,variable.labels) COLOR COST color cost =EOF=== Notice that the $COLOR factor data are inverted, looking at the integer output we see: as.integer(out$COLOR) [1] 3 2 1 3 3 3 2 2 2 1 1 The spss original data looks like this: 1 2 3 1 1 1 2 2 2 3 3 I can easily invert the output mathematically with: q = sapply(m,function(x){ x + 2*(median(unique(m))-x)}) (m is composed of sequential integers starting at one) ,but it seems as though something wrong is happening with read.spss. Any ideas? Joel Bremson Graduate Student UC Davis [[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 __ 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 -- 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
Re: [R] how to overlook the zero in the denominator
look at ?sum() and use the `na.rm' argument, i.e., sum((x - y)^2 / x, na.rm = TRUE) I hope it helps. Best, Dimitris p.s., R is vectorized, you don't have to use `x[i]' in your example. Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Chun-Ying Lee [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Wednesday, July 27, 2005 10:51 AM Subject: [R] how to overlook the zero in the denominator Dear R users: I have two set of data, as follow: x-c(0,0,0.28,0.55,1.2,2,1.95,1.85, 1.6,0.86,0.78,0.6,0.21,0.18) y-c(0,0,0,0.53,1.34,1.79,2.07,1.88, 1.52,0.92,0.71,0.55,0.32,0.19) i-1:length(x) I want to sum each (x[i]-y[i])^2/x[i] together, like: Sum -sum((x[i]-y[i])^2/x[i]) Sum [1] NaN Because the denominator shoud not be zero. So I want to overlook those when x[i]=0, and just to sum those x[i] not equal to 0. What should I do? Any suggestion. Thanks in advance !! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to overlook the zero in the denominator
What about x-c(0,0,0.28,0.55,1.2,2,1.95,1.85, 1.6,0.86,0.78,0.6,0.21,0.18) y-c(0,0,0,0.53,1.34,1.79,2.07,1.88, 1.52,0.92,0.71,0.55,0.32,0.19) sum(((x-y)^2/x)[x!=0]) Regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- Chun-Ying Lee writes: Dear R users: I have two set of data, as follow: x-c(0,0,0.28,0.55,1.2,2,1.95,1.85, 1.6,0.86,0.78,0.6,0.21,0.18) y-c(0,0,0,0.53,1.34,1.79,2.07,1.88, 1.52,0.92,0.71,0.55,0.32,0.19) i-1:length(x) I want to sum each (x[i]-y[i])^2/x[i] together, like: Sum -sum((x[i]-y[i])^2/x[i]) Sum [1] NaN Because the denominator shoud not be zero. So I want to overlook those when x[i]=0, and just to sum those x[i] not equal to 0. What should I do? Any suggestion. Thanks in advance !! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to overlook the zero in the denominator
The simplest way would be to ignore them in the sum sum( ( x - y )/x, na.rm=T ) and notice that I have utilised the vectorised operation. But if you want to, you can explicitly remove them with good - which( x != 0 ) sum( ( x[good] - y[good] )/ x[good] ) Regards, Adai On Wed, 2005-07-27 at 16:51 +0800, Chun-Ying Lee wrote: Dear R users: I have two set of data, as follow: x-c(0,0,0.28,0.55,1.2,2,1.95,1.85, 1.6,0.86,0.78,0.6,0.21,0.18) y-c(0,0,0,0.53,1.34,1.79,2.07,1.88, 1.52,0.92,0.71,0.55,0.32,0.19) i-1:length(x) I want to sum each (x[i]-y[i])^2/x[i] together, like: Sum -sum((x[i]-y[i])^2/x[i]) Sum [1] NaN Because the denominator shoud not be zero. So I want to overlook those when x[i]=0, and just to sum those x[i] not equal to 0. What should I do? Any suggestion. Thanks in advance !! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Error in FUN(newX[, i], ...) : `x' must be atomic
Simon Blomberg [EMAIL PROTECTED] writes: Actually, atoms are originally a Lisp concept. Objects are either atoms or not. Atoms are data types that cannot be taken apart, such as numbers or symbols. Lists and vectors (of length 1) are examples of non-atomic data types. Did you pass a vector to FUN? Actually, vectors ARE atomic in R, so your definition is somewhat off target. is.atomic(rnorm(5)) [1] TRUE In the extreme, the only true atom is the bit, everything else can be taken apart - doubles into (sign,exponent,mantissa) etc. So languages *define* their own atoms, as objects that are not composed of other objects in the language. (And even that is a partial lie for R, because atoms can have attributes. Atomicity is purely based on the type of an object. The help page has a list of the atomic types.) Cheers, Simon. At 12:22 PM 27/07/2005, Srinivas Iyyer wrote: Hello Group, What is the meaning of the error. is there any place to look for this. I guess 'atomic' seems to be OOP related concept. thank you srini __ 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 Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ 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 -- 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
Re: [R] Problem specifying function for mle operation
Narcyz Ghinea [EMAIL PROTECTED] writes: MY THEORY: I think it has something to do with the fact that the function argument is a vector in CASE 2. Hope this doesn't mean I have to re-write the function in a way that it doesn't require vector inputs. You do. The innards of mle has f - function(p) { l - as.list(p) names(l) - nm l[n] - fixed do.call(minuslogl, l) } which converts the parameters to a list before calling the likelihood. Any suggestions on how to make CASE 2 work would be appreciated. Well, either you conform or you patch mle to handle functions with vector parameters -- 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
[R] GAM weights
Dear all, we are trying to model some data from rare plants so we always have less than 50 1x1 km presences, and the total area is about 550.000 square km. So we have a real problem, when we perform a GAM, if we consider only the same amount of absences than presences. We have thought to use a greater number of absences but in this case we shoud downweight them. Does anybody know how to use the wheight term? thank you in advance daniel -- Mensaje enviado mediante una herramienta Webmail integrada en *El Rincon*: - https://rincon.uam.es -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] HOW to Create Movies with R with repeated plot()?
Dear R-helpers, Is it possible to create a type of 'movie' in R based on the output of several figures (e.g., jpegs) via the plot() function. I obtained dynamic results with the plotting function and would like to save these as a movie (e.g., avi or other formats)? Regards, Jan _ Ir. Jan Verbesselt Research Associate Group of Geomatics Engineering Department Biosystems ~ M³-BIORES Vital Decosterstraat 102, 3000 Leuven, Belgium Tel: +32-16-329750 Fax: +32-16-329760 http://gloveg.kuleuven.ac.be/ ___ [[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
[R] default family object in glm
hi what is the default family object in glm? I cannot find it from the doc. It would be great if you could tell me where I should look into. thanks, lu - Stay connected, organized, and protected. Take the tour [[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
Re: [R] default family object in glm
From ?glm() you get: ... Usage glm(formula, family = gaussian, data, weights, subset, na.action, start = NULL, etastart, mustart, offset, control = glm.control(...), model = TRUE, method = glm.fit, x = FALSE, y = TRUE, contrasts = NULL, ...) ... So the default family is the gaussian. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: luk [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Wednesday, July 27, 2005 1:10 PM Subject: [R] default family object in glm hi what is the default family object in glm? I cannot find it from the doc. It would be great if you could tell me where I should look into. thanks, lu - Stay connected, organized, and protected. Take the tour [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Asymmetric colors for heatmap
Dear Sean Thank you, however the heatmap() function from the stats package does not have this option. Browsing around I see that you mean heatmap.2() from package gplots, which we have not installed yet. Is there also another possibility besides heatmap.2() since I would also need this option for e.g. function image(). Best regards Christian -Original Message- From: Sean Davis [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 27, 2005 13:16 To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Subject: Re: [R] Asymmetric colors for heatmap See the breaks argument to heatmap. Sean - Original Message - From: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] To: r-help@stat.math.ethz.ch mailto:r-help@stat.math.ethz.ch Sent: Wednesday, July 27, 2005 3:54 AM Subject: [R] Asymmetric colors for heatmap Dear expeRts, Currently, my colors are as follows: mycol - c(blue1,blue2,blue3,blue4,black,yellow4,yellow3,yellow2,y ellow1) heatmap(snp, Rowv=NA, Colv=NA, col=mycol) However, I would like to have the following colors: bright blue - dark blue: for intensity range from 0 to 2 in steps of 0.5 (i.e. 4 grades of blue) black: for intensity 2 dark yellow - bright yellow: for intensity range from 2 to 8 in steps of 0.5 (i.e. 8 grades of yellow) You may realize that I want to display copy number data from SNP-chips as heatmap. Since copynumber = 2, is the default value, I want to display it in black, LOH in increasing blue, and amplifications in increasing yellow. Even though there may be higher amplification rates, a value of CN=8 should already display the brightest yellow. In Spotfire it is easy to achieve this, especially that CN=2 is always displayed as black, however, I do not know how to do it in R. Can you tell me how I have to create the colors to achieve this? (P.S.: Of course, I could do: snp[snp8] - 8, but this will not solve my problem with asymmetric colors) Thank you in advance Christian Stratowa __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] make.names() does not return what is expected
Hello, I don't know if it's only me, but I can't get make.names() transform '_' in the way it is expected when I add the allow_ option. A simple example trying to replicate the example provided in the help page gives: -8--- make.names(c(a and b, a_and_b), unique=TRUE, allow_=FALSE) [1] a and b. a_and_b -8--- When the example says it should be: -8--- make.names(c(a and b, a_and_b), unique=TRUE, allow_=FALSE) # a.and.b a.and.b.1 -8--- I'm using R-2.1.1 compiled by myself on a gentoo GNU/Linux laptop. Anybody with the same problems? Thank you, -- Xavier Fernández i Marín [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
[R] a class matrix with class ordered data
Deart R-help, I could not transfer ordered data into a matrix, does anybody knows if there is something wrong in the code below please? Thanks in advance, Tom Y - ordered( unlist( Q[,1:2] ) ) z - matrix(0, nrow(Q), 2) z - Y is.ordered(z) [1] T is.matrix(z) [1] F i.e. Is it possibile somehow to have is.matrix(z) equal TRUE? __ [[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
Re: [R] default family object in glm
On Wed, 27 Jul 2005, luk wrote: what is the default family object in glm? I cannot find it from the doc. It would be great if you could tell me where I should look into. Try the help page: glm(formula, family = gaussian, data, weights, subset, It is not clear what you don't understand, e.g. the format of R help pages? -- 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
Re: [R] LyX and Sweave
On Mon, 25 Jul 2005 14:12:41 +0200, Gorjanc Gregor (GG) wrote: Hello R-users! I have tried to use Sweave within LyX* and found two ways to accomplish this. I have attached LyX source file for both ways as well as generated PDFs. I have copied Gregor's files at http://www.ci.tuwien.ac.at/~leisch/Sweave/LyX for those who didn't get the attachments. LyX looks actually much better and stable then when I last had a look a couple of years ago. To add to the discussion: One might even get better integration between Sweave and LyX because LyX allows specification of file converters: Edit-Preferences-Converters Edit-Preferences-File Formats After registering .Stex as a file format for Sweave I can import .Stex files using conversion command reLyX -f $$i mv $$i.lyx $$o and the move is necessary only because reLyX produces foo.Stex.lyx rather then foo.lyx. Using an Sweave shell script like Gregor's in combination with lyx -e latex might do the trick to have direct conversion to PDF from the LyX GUI. Best, Fritz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] LyX and Sweave
On Wed, 27 Jul 2005 15:28:54 +0200, Gorjanc Gregor (GG) wrote: [...] Nope. That's what I also thought, but I was really amaized when discovered that there is no need for this. You only need to set up noweb stuff as mentioned at http://thread.gmane.org/gmane.editors.lyx.general/18847 and use article(noweb) for document style. Then everything (export and view directly from LyX GUI) just works. As I said I was really surprised with it. Try with SweaveNoweb.lyx and you will see. This way, one can skip my silly Sweave.sh ;) Ahh, now I get it. Still it needs some polishing, because after configuring LyX that way regular noweb will no longer work, but it shouldn't take too much of an effort to duplicate the noweb configs in LyX to recognise Sweave. That certainly looks like the way to go, might give Sweave another strong push because people do no longer have to learn all of LaTeX ... If we make a clean solution then I think it shouldn't be too hard to convince the LyX guys to include it in their distribution - that would make an out-of-the-box solution. But it certainly looks very promising. Best, Fritz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Off Topic Simulation Techniques.
I wonder if anyone can help me find a text or reference to the probabilistic under pinnings of simulation techniques. I come from an econometrics background where the approach to Monte Carlo is a bit cook booky, most of the focus is on the implementation rather than the theoretical justification. Given a standard setup; a probability triple, random variable and a functional on this random variable, we need to find the measure on the functional. This measure can be approximated by the ECDF, which is the counting measure. Asymptotically the counting measure must coincide with the measure on the functional. Are there any authors who have followed this approach? Phineas Campbell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] LyX and Sweave
[...] Nope. That's what I also thought, but I was really amaized when discovered that there is no need for this. You only need to set up noweb stuff as mentioned at http://thread.gmane.org/gmane.editors.lyx.general/18847 and use article(noweb) for document style. Then everything (export and view directly from LyX GUI) just works. As I said I was really surprised with it. Try with SweaveNoweb.lyx and you will see. This way, one can skip my silly Sweave.sh ;) Ahh, now I get it. Still it needs some polishing, because after configuring LyX that way regular noweb will no longer work, but it shouldn't take too much of an effort to duplicate the noweb configs in LyX to recognise Sweave. Nice isn't it. That certainly looks like the way to go, might give Sweave another strong push because people do no longer have to learn all of LaTeX ... If we make a clean solution then I think it shouldn't be too hard to convince the LyX guys to include it in their distribution - that would make an out-of-the-box solution. Yes, LyX developers should copy noweb configuration to Sweave configuration and add small (like yours at Sweave repository) Sweave.sh and additionaly also import configuration you mentioned before. I strongly encourage you to send this to LyX developers. Gregor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] make.names() does not return what is expected
On Wed, 27 Jul 2005, Xavier [utf-8] Fernández i Marín wrote: Ok, thanks. BTW, before writing the email I've been trying to search in the bugsweb interface athttp://r-bugs.biostat.ku.dk/cgi-bin/R searching for make.names, but with no success. Is this the way to procede? See the posting guide about how to discover already fixed bugs (not including this one). Prof Brian Ripley vas escriure el dia dc, 27 jul 2005: It's a bug, soon to be fixed in R-patched. -- Xavier Fernández i [EMAIL PROTECTED] [EMAIL PROTECTED] mailing listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 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
Re: [R] Asymmetric colors for heatmap
Sorry, my mistake, I did not realize that image() has breaks and that heatmap() inherits from image(). However, I have the following problem, maybe I am doing something wrong. I have defined: mycol - c(blue1,blue2,blue3,blue4,black,yellow4,yellow3,yellow2,yel low1) breaks-c(0,0.5,1,1.5,2,2.5,3,4,5,6) When I call image() then the colors change slightly: image(t(tmp),col=mycol,axes=F) image(t(tmp),col=mycol,axes=F,breaks=breaks) However, when I call heatmap(): heatmap(tmp,Rowv=NA,Colv=NA,col=mycol) heatmap(tmp,Rowv=NA,Colv=NA,col=mycol,breaks=breaks) then breaks results in half of the heatmap drawn in white! Do you know what may be my mistake? Best regards Christian -Original Message- From: Stratowa,Dr.,Christian FEX BIG-AT-V Sent: Wednesday, July 27, 2005 14:07 To: 'Sean Davis'; r-help@stat.math.ethz.ch Subject: RE: [R] Asymmetric colors for heatmap Dear Sean Thank you, however the heatmap() function from the stats package does not have this option. Browsing around I see that you mean heatmap.2() from package gplots, which we have not installed yet. Is there also another possibility besides heatmap.2() since I would also need this option for e.g. function image(). Best regards Christian -Original Message- From: Sean Davis [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 27, 2005 13:16 To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Subject: Re: [R] Asymmetric colors for heatmap See the breaks argument to heatmap. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Off Topic Simulation Techniques.
_Monte Carlo Statistical Methods_ by Christian P. Robert, George Casella Springer, 2nd ed 2005 This book (I have edition 1) is a dandy. It will be rough sledding unless you have a reasonable background in math stats but I think it is just what you are looking for. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Campbell Sent: Wednesday, July 27, 2005 9:47 AM To: r-help Cc: phineas Subject: [R] Off Topic Simulation Techniques. I wonder if anyone can help me find a text or reference to the probabilistic under pinnings of simulation techniques. I come from an econometrics background where the approach to Monte Carlo is a bit cook booky, most of the focus is on the implementation rather than the theoretical justification. Given a standard setup; a probability triple, random variable and a functional on this random variable, we need to find the measure on the functional. This measure can be approximated by the ECDF, which is the counting measure. Asymptotically the counting measure must coincide with the measure on the functional. Are there any authors who have followed this approach? Phineas Campbell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] thks all
hi all I wish to thanks every body on the R mailing list for answering very fast, directly in my mail box ;). I've finish my work with R and i can say that it is very difficult at the beginning, and when you succeed you are stopped by a stack overflow when you call your nice recursive function (which was working with a tab of 100 element) with a tab of 900 elements, but R just do what you tell him and these errors have push me to optimize , i succeed to do it with R ! and you've helped me that way :) so THKS all R-users! guillaume. // Webmail Oreka : http://www.oreka.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
Re: [R] HOW to Create Movies with R with repeated plot()?
[Jan Verbesselt] Is it possible to create a type of 'movie' in R based on the output of several figures (e.g., jpegs) via the plot() function. I obtained dynamic results with the plotting function and would like to save these as a movie (e.g., avi or other formats)? You may also peek at an actual example of using R for mini-movies: http://pinard.progiciels-bpi.ca/plaisirs/animations/index.html I wrote this toy about the same week I started to learn R, and it was a hell of a good exercise for the poor little me! :-) -- François Pinard http://pinard.progiciels-bpi.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Question on glm for Poisson distribution.
Good afternoon, I REALLY try to answer to my question as an autonomous student searching in the huge pile of papers on my desk and on the Internet but I can't find out the solution. Would you mind giving me some help? Please. # I'm trying to use glm with factors: Pyr.1.glm-glm(Pyrale~Trait,DataRav,family=poisson) If I have correctly payed attention to my cyber professor explanations I have, for the variable Pyrale which I suppose Poisson-distributed, the following mathematical expression: P(Pyrale=k)=exp(-m).[(m^k)/k!] with log(m)=Intercept+Trait(i) (link function is log for Poisson distribution) Then I test the significativity of Trait: anova(Pyr.1.glm,test=Chisq) Analysis of Deviance Table Model: poisson, link: log Response: Pyrale Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev P(|Chi|) NULL 19 49.813 Trait 3 31.281 16 18.532 7.419e-07 Which means that variable Trait is significant for determining the value of P(Pyrale=k). I tried to order the effects of the modalities of my variable Trait using: summary(Pyr.1.glm) Call: glm(formula = Pyrale ~ Trait, family = poisson, data = DataRav) Deviance Residuals: Min 1Q Median 3Q Max -1.7117 -0.8944 -0.6237 0.6390 1.5224 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 1.3350 0.2294 5.819 5.92e-09 *** TraitInsFong -2.9444 1.0259 -2.870 0.00410 ** TraitInsecticide -2.2513 0.7434 -3.028 0.00246 ** TraitTemoin -0.2364 0.3454 -0.684 0.49372 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 (Dispersion parameter for poisson family taken to be 1) Null deviance: 49.813 on 19 degrees of freedom Residual deviance: 18.532 on 16 degrees of freedom AIC: 61.85 Number of Fisher Scoring iterations: 5 ## I have therefore two questions: - Considering the values of estimated coefficients for Trait(i), does it mean that the bigger is the coefficient, the lower is the probability considering the mathematical expression (exp(-m))? - How can I check that coefficients are significatively different one from each other (as with function TukeyHSD for other models)? Thanks for you help. Regards Ghislain. -- Ghislain Vieilledent 30, rue Bernard Ortet 31 500 TOULOUSE 06 24 62 65 07 [[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
[R] Redirecting Messages and Errors to a file
Hello all, I'm trying to setup a simple construct that will email me all errors, warnings, and output of a sample R script. My initial thought was to use sink() and tryCatch around the script such that at the end of the script any output would be mailed to me, i.e.: sinkFile - tempfile() sink(sinkFile) tryCatch({ [R script]}, finally = { sink() if (length(readLines(sinkFile))) mailOutput(readLines(sinkFile)) }) However, the sink() does not seem to be capturing the error messages as I would have hoped. That is, if the R-script is {print(abc); stop(def)}, the print output is captured to the file, the stop error message is not, and instead sent to the screen. Any thoughts on how to do this such that everything is sent to the file for emailing? Perhaps something different all together? Thanks, Robert This e-mail, and any attachments hereto, are intended for us...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] spss.read factor reversal
On Wed, 27 Jul 2005, Peter Dalgaard wrote: Adaikalavan Ramasamy [EMAIL PROTECTED] writes: I think it is doing what is supposed to do but I never used read.spss, so take this with a pinch of salt. In R when you use as.integer on a factor, the one with the lowest level gets a value of 1 and so on. The lowest level of the factor can determined from levels() function. f - factor( c(Green, Green, Red, Blue), levels=c(Red, Blue, Green) ) levels(f) [1] Red Blue Green as.integer(f) [1] 3 3 1 2 But the levels of a factor can be changed as.integer( factor( f, levels=c(Green, Blue, Red ) ) ) [1] 1 1 3 2 Doesn't explain why 1 2 3 in the input file comes out as Green Blue Red, does it? You can also try setting use.value.labels=FALSE in read.spss function and then creating a factor out of it. Would be interesting to see this. I would suspect that the damage is already done at that point though. It would also be interesting because the raw value label information is then available as the value.labels attribute of the variable. I notice that the value labels are in reverse order. Shouldn't matter to read.spss which has rval[[nm]] - factor(rval[[nm]], levels = vl[[v]], labels = trim(names(vl[[v]]))) i.e. levels and labels should be in the correct order. yes, something wrong must be coming out of the .C call. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Redirecting Messages and Errors to a file
On Wed, 27 Jul 2005, McGehee, Robert wrote: However, the sink() does not seem to be capturing the error messages as I would have hoped. That is, if the R-script is {print(abc); stop(def)}, the print output is captured to the file, the stop error message is not, and instead sent to the screen. Any thoughts on how to do this such that everything is sent to the file for emailing? Perhaps something different all together? There is a separate output connection for errors. The help page for sink() describes how to divert it, and warns of risks in doing so. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] HOW to Create Movies with R with repeated plot()?
Jan Verbesselt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dear R-helpers, Is it possible to create a type of 'movie' in R based on the output of several figures (e.g., jpegs) via the plot() function. I obtained dynamic results with the plotting function and would like to save these as a movie (e.g., avi or other formats)? 1) You can create animated GIFs with the caTools package. 2) ImageMagick (clipped from R-Help) It is quite easy to do with ImageMagick (www.imagemagick.org), which can be installed on most OSes. I tried this simple sequence and it worked beautifully. In R: for(i in 1:5) { + jpeg(paste(fig, i, .jpg, sep = )) + hist(rnorm(100)) + dev.off() + } Then from the command line (I tried it using Linux, though it should be the same on any platform): % convert -delay 50 -loop 50 fig*.jpg animated.gif This created animated.gif, a nice animation of my sequence of files. You can control the timing of the animation by playing with -delay and -loop. 3) TCL/TK Animation (clipped from R-Help) The tcltk package also has ways of doing this kind of stuff: library(tcltk) f - function(){plot(rnorm(1000)); tkcmd(after, 1000,f)} f() (To stop, set f - NULL) efg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] CART analysis
Most of time, I prefer to use randomForest of R though it really depends on your problem. And don't forget Leo's Random Forest if you don't use it for commercial purpose. weiwei On 7/26/05, Marc R. Feldesman [EMAIL PROTECTED] wrote: --- Adaikalavan Ramasamy [EMAIL PROTECTED] wrote: RSiteSearch(CART) should bring up a few hits including http://finzi.psych.upenn.edu/R/Rhelp02a/archive/25850.html CART is a trademarked statistical procedure owned by Salford Systems of San Diego, CA. If you're looking for an R-package that implements the procedures described in the Breiman, Friedman, Olshen, and Stone book entitled Classification and Regression Trees, the closest you can come to the original algorithm is the R-package called rpart, by Therneau and Atkinson. If you combine that with Andy Liaw's randomForest, you have a pretty potent set of tools. If you really want CART, you need to contact Salford Systems for their implementation and pay their very expensive licensing fees. Dr. Marc R Feldesman Professor Chair Emeritus Department of Anthropology Portland State University Portland, OR 97207 Please respond to all emails at: [EMAIL PROTECTED] Some people live and die by actuarial tables Groundhog Day __ 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 -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] thks all
add me. I really appreciate r-help mail list VERY MUCH! I learn a lot. You guys are doing a great and very important job. thanks. On 7/27/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hi all I wish to thanks every body on the R mailing list for answering very fast, directly in my mail box ;). I've finish my work with R and i can say that it is very difficult at the beginning, and when you succeed you are stopped by a stack overflow when you call your nice recursive function (which was working with a tab of 100 element) with a tab of 900 elements, but R just do what you tell him and these errors have push me to optimize , i succeed to do it with R ! and you've helped me that way :) so THKS all R-users! guillaume. // Webmail Oreka : http://www.oreka.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 -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Redirecting Messages and Errors to a file
Ahh, I misunderstood the help page. I took that since the default values for type were c(output, message), that both the output _and_ the messages were simultaneously being redirected (else why not just make the default output). I see that this is not the case (as noted in the details). After specifying type = message, I was also able to successfully send off the error messages to a file, but not at the same time as sending the output. That is, do I need to have two sink files, one for errors, one for output and then append them before mailing? I'd prefer a way of sending all output/messages to the same file to preserve the order of the messages/output, if this is possible. Robert -Original Message- From: Thomas Lumley [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 27, 2005 10:37 AM To: McGehee, Robert Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Redirecting Messages and Errors to a file On Wed, 27 Jul 2005, McGehee, Robert wrote: However, the sink() does not seem to be capturing the error messages as I would have hoped. That is, if the R-script is {print(abc); stop(def)}, the print output is captured to the file, the stop error message is not, and instead sent to the screen. Any thoughts on how to do this such that everything is sent to the file for emailing? Perhaps something different all together? There is a separate output connection for errors. The help page for sink() describes how to divert it, and warns of risks in doing so. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] error message running R2WinBUGS
*Dear R-user, * I try to run Winbugs from R using bugs function in R2WinBUGS.My model works well in Winbugs except that I can't get DIC. Since I don't need DIC, when I try to run Winbugs from R , I set DIC=FALSE. My model is as following: model { for (i in 1:N) { for(j in 1 : T ) { x[i, j] ~ dbin(p[i, j],n[i]) #Hier.prior p[i, j] ~ dbeta(alpha[i, j], beta[i, j]) alpha[i, j] - pi[ j]*(1-theta[i])/theta[i] beta[i, j] -(1-pi[ j])*(1-theta[i])/theta[i] } } for(j in 1 : T ) { pi[ j ] ~dbeta(0.1,0.1)I(0.1,0.9) } for (i in 1:N) { theta[i] ~dbeta(2,10) } } And my R code is as followings: initials1-list(theta=c(0.2,0.01), pi=rbeta(50, 0.1, 0.1)*0.8+0.1 , p=matrix(rbeta(100, 2, 10)*0.8+0.1,nr=2,nc=50,byrow=TRUE)) inits-list(initials1 initials1) data-list(N=2,T=50 ,n=c(100,150),x = structure(.Data = c( 3, 47, 8, 19, 87, 69, 2, 4, 75, 24, 16, 81, 10, 78, 87, 44, 17, 56, 23, 75, 55, 85, 84, 69, 6, 36, 8, 90, 47, 6, 87, 61, 49, 57, 28, 56, 31, 54, 75, 79, 67, 38, 28, 13, 89, 63, 32, 68, 70, 7, 24, 95, 8, 14, 127, 134, 7, 8, 133, 40, 76, 126, 0, 132, 120, 137, 9, 91, 3, 130, 18, 80, 134, 95, 12, 34, 19, 111, 34, 25, 127, 79, 132, 84, 72, 134, 67, 44, 95, 69, 80, 51, 57, 12, 138, 137, 64, 80, 130, 58), .Dim = c(2, 50))) #run winbugs library(R2WinBUGS) structure-bugs(data,inits,model.file=S:/Common/zhangqi/ebayes/for R/model.txt, parameters=c(p,pi,theta),n.chains=2,n.iter=2000,n.burnin=500, debug=TRUE,DIC=FALSE,bugs.directory=c:/Program Files/WinBUGS14/, working.directory = NULL ) Even if I changed initial values several times, I still keep geting the following error message in Winbugs: display(log) check(S:/Common/zhangqi/ebayes/for R/model.txt) model is syntactically correct data(C:/Program Files/R/rw2011/data.txt) data loaded compile(2) model compiled inits(1,C:/Program Files/R/rw2011/inits1.txt) value of binomial x[1,28] must be between zero and order of x[1,28] I really have no clue about what I can do to fix it. Could any of your please take a look at my problem, I truely appreciate any suggestions. Qi Zhang [[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
Re: [R] HOW to Create Movies with R with repeated plot()?
On 27-Jul-05 Jan Verbesselt wrote: Dear R-helpers, Is it possible to create a type of 'movie' in R based on the output of several figures (e.g., jpegs) via the plot() function. I obtained dynamic results with the plotting function and would like to save these as a movie (e.g., avi or other formats)? A similar question was discussed on R-help some months ago: Start at Cari G Kaufman [EMAIL PROTECTED], [R] animation without intermediate files? Thu, 6 Jan 2005 16:21:36 -0500 (EST) However, this is not quite your question! It seems you would be content with making a movie out of files already saved from R, so it's not a real-time situation. There are several approaches you could adopt. One (if you are using Linux with ImageMagick installed -- or if this is available for your platform if different) is to use the program 'animate' in that suite of programs. The format of the image files does not matter for 'animate' (though I think all should have the same format), so they could be .jpg, .gif, etc. Suppose you had a set of files graph001.jpg graph001.jpg ... graph100.jpg then the command animate graph*.jpg would present them as an animation in due order. There are several options to the 'animate' command which you can use to control features of how they are displayed. One you would probably want to use is -delay -- e.g. animate -delay 7 graph*.jpg would pause for 7/100 seconds between successive images. Another option is to create an animated GIF -- a single file which encapsulates several images and displays them in sequence when the file is opened with suitable software (most Web browsers do this well; likewise so does ImageMagick's 'display'). Programs which can create animated GIFs include the GIMP and gifsicle in the Free Software world. There are also several programs for non-Linux platforms. Sorry I can't help with suggestions for creating .avi files. Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 27-Jul-05 Time: 14:08:00 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] HOW to Create Movies with R with repeated plot()?
Dear R-list, I'm surprised that no one on this list has mentioned anything about the ffmpeg tools! Hands down these are the tools to use for generating animations and movies. Processing the images is much quicker than imagemagick and with a little tweaking, you can add additional filter effects to the images as they are being processed. http://ffmpeg.sourceforge.net/index.php Also see the smilutils and some examples at: http://users.pandora.be/acp/ppmfilter/ Although I haven't used these tools in quite a while, I have been able to export the resulting mpeg files into VCD quality videos for playing on DVDs. I hope this helps. Jason On Wed, 2005-07-27 at 08:44, [EMAIL PROTECTED] wrote: On 27-Jul-05 Jan Verbesselt wrote: Dear R-helpers, Is it possible to create a type of 'movie' in R based on the output of several figures (e.g., jpegs) via the plot() function. I obtained dynamic results with the plotting function and would like to save these as a movie (e.g., avi or other formats)? A similar question was discussed on R-help some months ago: Start at Cari G Kaufman [EMAIL PROTECTED], [R] animation without intermediate files? Thu, 6 Jan 2005 16:21:36 -0500 (EST) However, this is not quite your question! It seems you would be content with making a movie out of files already saved from R, so it's not a real-time situation. There are several approaches you could adopt. One (if you are using Linux with ImageMagick installed -- or if this is available for your platform if different) is to use the program 'animate' in that suite of programs. The format of the image files does not matter for 'animate' (though I think all should have the same format), so they could be .jpg, .gif, etc. Suppose you had a set of files graph001.jpg graph001.jpg ... graph100.jpg then the command animate graph*.jpg would present them as an animation in due order. There are several options to the 'animate' command which you can use to control features of how they are displayed. One you would probably want to use is -delay -- e.g. animate -delay 7 graph*.jpg would pause for 7/100 seconds between successive images. Another option is to create an animated GIF -- a single file which encapsulates several images and displays them in sequence when the file is opened with suitable software (most Web browsers do this well; likewise so does ImageMagick's 'display'). Programs which can create animated GIFs include the GIMP and gifsicle in the Free Software world. There are also several programs for non-Linux platforms. Sorry I can't help with suggestions for creating .avi files. Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 27-Jul-05 Time: 14:08:00 -- XFMail -- __ 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 -- Jason W. Martinez 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
[R] logistic regression: categorical value, and multinomial
I have two questions: 1. If I want to do a binomial logit, how to handle the categorical response variable? Data for the response variables are not numerical, but text. 2. What if I want to do a multinomial logit, still with categorical response variable? The variable has 5 non-numerical response levels, I have to do it with a multinomial logit. Any input is highly appreciated! Thanks! Ed __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] core dump when call t.test via the RJava --example --gui-none interface
using ./RJava --example --gui-none to invoke t.test core dumps. The line of R works if I go directly thru R and not RJava. Version info and code are below. Any help would be appreciated. --Laura O'Brien Applications Architect Version info Java: jdk1.5.0_03 R: 2.1.1 SJava: 0.68 OS: SunOs 5.8 example code that works --- [omegahat-R] mean (c (1,2,3)) 2.0 example code that core dumps - [omegahat-R] t.test (c (1,2,3), c(4,5,6)) Unexpected Signal : 11 occurred at PC=0xFE0C2B44 Function=[Unknown. Nearest: JVM_Close+0x6BFC4] Library=/imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/client/libjvm.so Current Java thread: at org.omegahat.R.Java.REvaluator.eval(Native Method) at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:90) at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:40) at org.omegahat.R.Java.Examples.JavaRPrompt.main(JavaRPrompt.java:26) Dynamic libraries: 0x1 /tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/bin/java 0xff36 /usr/lib/libthread.so.1 0xff3a /usr/lib/libdl.so.1 0xff20 /usr/lib/libc.so.1 0xff33 /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1 0xfe00 /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/client/libjvm.so 0xff2d /usr/lib/libCrun.so.1 0xff1e /usr/lib/libsocket.so.1 0xff10 /usr/lib/libnsl.so.1 0xff0d /usr/lib/libm.so.1 0xff30 /usr/lib/libw.so.1 0xff0b /usr/lib/libmp.so.2 0xff08 /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/native_threads/libhpi.so 0xff05 /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libverify.so 0xfe7c /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libjava.so 0xff02 /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libzip.so 0xfdfc /imports/filer04/tools/app/R-2.1.1/lib/R/library/SJava/libs/SJava.so 0xfdf9 /imports/filer04/tools/app/R-2.1.1/lib/R/library/SJava/libs/libRSNativeJava.so 0xf178 /imports/filer04/tools/app/R-2.1.1/lib/R/lib/libR.so 0xfc7c /tools/app/gcc-3.4.3/lib/libg2c.so.0 0xfc4e /tools/app/gcc-3.4.3/lib/libgcc_s.so.1 0xfc4b /tools/app/R-2.1.1/lib/R/library/grDevices/libs/grDevices.so 0xfc45 /tools/app/R-2.1.1/lib/R/library/stats/libs/stats.so 0xfc43 /tools/app/R-2.1.1/lib/R/library/methods/libs/methods.so Local Time = Wed Jul 27 12:28:07 2005 Elapsed Time = 28 # # HotSpot Virtual Machine Error : 11 # Error ID : 4F530E43505002E6 01 # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.1_02-b06 mixed mode) # # An error report file has been saved as /tmp/hs_err_pid22520.log. # Please refer to the file for further information. # Abort __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] unable to source a .R file using RJava
I am unable to source a .R file using RJava. I tried a couple of different tests: 1) using java and the evaluation method core dumps 2) using ./RJava --example --gui-none to invoke source core dumps. 3) The line of R works if I go directly thru R and not RJava. Version info and code are below. Any help would be appreciated. --Laura O'Brien Applications Architect version info Java: j2sdk1.4.1_02 R: 2.1.1 SJava: 0.68 OS: SunOs 5.8 doNothing.R file I'd like to source --- # # $Author: lobrien $ # # $Date: 2005/07/27 16:20:00 $ # # $Header: /unixfiles/softengr/cvs/repository/hh/src/r/doNothing.R,v 1.2 2005/07/27 16:20:00 lobrien Exp $ # # # # test file to see if I can source a .R file via SJava # # Works when # -- #I invoke R version 2.1.1 on SunOS jupiter 5.8 #source (/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R) #res - getData(something) #res # [1] 2 # # # doesn't work when # - # (A) launch R thru java via -- ./RJava --example --gui-none # [omegahat-R] source (/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R) # # Unexpected Signal : 11 occurred at PC=0xFE0C2B44 # Function=[Unknown. Nearest: JVM_Close+0x6BFC4] # snip # # (B) call it via .java file. See JavaRCall3 getData - function(query, db.name=csbdev, user.name=noone, passwd=pass){ R - 2 R } .java code to invoke the evaluate method - package com.icoria.rwrapper; import org.omegahat.R.Java.ROmegahatInterpreter; import org.omegahat.R.Java.REvaluator; public class JavaRCall3 { /** * want to see if I can eval a t.test command like what I would run in the * R command line */ static public void run_sourceRFile(REvaluator e, ROmegahatInterpreter interp) { /* produces a core */ System.err.println(running source doNothing.R); Object value = e.eval(source (\/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R); if (value != null) interp.show(value); } /** * */ static public void main(String[] args) { ROmegahatInterpreter interp = new ROmegahatInterpreter(ROmegahatInterpreter.fixArgs(args), false); REvaluator e = new REvaluator(); Object[] funArgs; String[] objects; Object value; int i; run_sourceRFile(e, interp); } } the corresponding core dump when using java [EMAIL PROTECTED] ./RJava Loading RInterpreter library R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 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. 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 a HTML browser interface to help. Type 'q()' to quit R. running source doNothing.R Problems: unrecognized user-level object of mode 0 Error: No default Java type for S class ??? An unexpected exception has been detected in native code outside the VM. Unexpected Signal : 11 occurred at PC=0xF1835E50 Function=setup_Rmainloop+0x4F8 Library=/imports/filer04/tools/app/R-2.1.1/lib/R/lib/libR.so Current Java thread: at org.omegahat.R.Java.REvaluator.eval(Native Method) at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:90) at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:40) at com.icoria.rwrapper.JavaRCall3.run_sourceRFile(JavaRCall3.java:25) at com.icoria.rwrapper.JavaRCall3.main(JavaRCall3.java:46 Dynamic libraries: 0x1 /tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/bin/java 0xff36 /usr/lib/libthread.so.1 0xff3a /usr/lib/libdl.so.1 0xff20 /usr/lib/libc.so.1 0xff33 /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1 0xfe00 /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/client/libjvm.so 0xff2d /usr/lib/libCrun.so.1 0xff1e /usr/lib/libsocket.so.1 0xff10 /usr/lib/libnsl.so.1 0xff0d /usr/lib/libm.so.1 0xff30 /usr/lib/libw.so.1 0xff0b /usr/lib/libmp.so.2 0xff08 /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/native_threads/libhpi.so 0xff05 /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libverify.so 0xfe7c /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/libjava.so 0xff02
[R] How to delete rows
Dear R-users, I am very new to R, so maybe my question is very easy to answer. I have the following table: TAB1-data.frame(Name,Number), Name and Number are all character strings, it looks like this: Name Number ab 2 ab 2 NA 15 NA 15 NA 15 cd 3 ef 1 NA 15 NA 15 gh 15 gh 15 I want to delete all the rows which begin with NA and all the rows where names are duplicates (for example the second row). I have tried this, but I only get numbers: for (i in 1:ZeileMax ) {if ( TAB1[[1]] [i] != NA ) {cat(TAB1[[1]][i],file = Name.txt,fill= TRUE,append = TRUE ,sep = );cat(TAB1[[2]][i], file=Number.txt, fill=TRUE,append=TRUE, sep=)}} Name-readLines(Name.txt) Number-readLines(Number.txt) TAB-data.frame(Name,Number) Thanks in advance, Michael Graber __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] logistic regression: categorical value, and multinomial
d-data.frame(y=sample(letters[1:2],100,T),x=rnorm(100)) head(d,10) y x 1 b 0.55915620 2 b 0.87575380 3 b -0.13093156 4 b 0.75925729 5 b 0.40233427 6 b 1.34685918 7 a 1.10487752 8 a -2.27456596 9 a 1.65919787 10 b 0.05095611 glm(y~x,data=d,family=binomial) Call: glm(formula = y ~ x, family = binomial, data = d) Coefficients: (Intercept)x 0.2771 0.5348 Degrees of Freedom: 99 Total (i.e. Null); 98 Residual Null Deviance: 136.1 Residual Deviance: 129.5AIC: 133.5 === 2005-07-28 00:22:55 您在来信中写道:=== I have two questions: 1. If I want to do a binomial logit, how to handle the categorical response variable? Data for the response variables are not numerical, but text. 2. What if I want to do a multinomial logit, still with categorical response variable? The variable has 5 non-numerical response levels, I have to do it with a multinomial logit. Any input is highly appreciated! Thanks! Ed __ 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 = = = = = = = = = = = = = = = = = = = = 2005-07-28 -- Deparment of Sociology Fudan University Blog:http://sociology.yculblog.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
Re: [R] odesolve/lsoda differences on Windows and Mac
Hello Hank, thank you for your interest in simulating ODEs with R. Unfortunately, I am out of office until end of August and I have no acces to a Mac with R. Maybe, Woodrow Setzer has an idea, and as an alternative I would suggest to post a minimal reproducible example to the R-help mailing list. Sorry that I can't do more in the moment Thomas Petzoldt Thomas Petzoldt, Institute of Hydrobiology, Dresden University of Technology [EMAIL PROTECTED] http://www.tu-dresden.de/fghhihb/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to generate 00Index.html from Rd or html
On Wed, 27 Jul 2005, Jonathan Baron wrote: I'd like to generate 00Index.html for a bunch of libraries for my R search page. I think you mean for a package, not a library, that is the file /path/to/library/some_pky/html/00index.html ? I have now almost all the html help files for individual functions, even for packages that won't install on my computer (e.g., because they are specific to Windows). I made these using Rdconv. But that won't make the 00Index file, and neither will Rdindex, which makes a text file. I'm probably missing something really simple, but I've looked for a while. (Assuming Linux, which I am pretty sure is true for you.) You need to use share/perl/build-help.pl --index. Using --help should tell you enough to get started. That will in fact generate all the per-package html files you need with other options. -- 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
Re: [R] unable to source a .R file using RJava
Please, this is R-help, not the list for SJava questions. SJava is part of the Omegahat project (not the R project) and that used to have its own mailing lists. I believe they are currently non-operational, but please check. The R posting guide suggests that you first ask the maintainer and then perhaps the R-devel list. On Wed, 27 Jul 2005, O'Brien, Laura wrote: I am unable to source a .R file using RJava. I tried a couple of different tests: 1) using java and the evaluation method core dumps 2) using ./RJava --example --gui-none to invoke source core dumps. 3) The line of R works if I go directly thru R and not RJava. Version info and code are below. Any help would be appreciated. --Laura O'Brien Applications Architect version info Java: j2sdk1.4.1_02 R:2.1.1 SJava:0.68 OS: SunOs 5.8 doNothing.R file I'd like to source --- # # $Author: lobrien $ # # $Date: 2005/07/27 16:20:00 $ # # $Header: /unixfiles/softengr/cvs/repository/hh/src/r/doNothing.R,v 1.2 2005/07/27 16:20:00 lobrien Exp $ # # # # test file to see if I can source a .R file via SJava # # Works when # -- #I invoke R version 2.1.1 on SunOS jupiter 5.8 #source (/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R) #res - getData(something) #res # [1] 2 # # # doesn't work when # - # (A) launch R thru java via -- ./RJava --example --gui-none # [omegahat-R] source (/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R) # # Unexpected Signal : 11 occurred at PC=0xFE0C2B44 # Function=[Unknown. Nearest: JVM_Close+0x6BFC4] # snip # # (B) call it via .java file. See JavaRCall3 getData - function(query, db.name=csbdev, user.name=noone, passwd=pass){ R - 2 R } .java code to invoke the evaluate method - package com.icoria.rwrapper; import org.omegahat.R.Java.ROmegahatInterpreter; import org.omegahat.R.Java.REvaluator; public class JavaRCall3 { /** * want to see if I can eval a t.test command like what I would run in the * R command line */ static public void run_sourceRFile(REvaluator e, ROmegahatInterpreter interp) { /* produces a core */ System.err.println(running source doNothing.R); Object value = e.eval(source (\/imports/nas1/people/lobrien/dist2.1_rc1/hh/src/r/doNothing.R); if (value != null) interp.show(value); } /** * */ static public void main(String[] args) { ROmegahatInterpreter interp = new ROmegahatInterpreter(ROmegahatInterpreter.fixArgs(args), false); REvaluator e = new REvaluator(); Object[] funArgs; String[] objects; Object value; int i; run_sourceRFile(e, interp); } } the corresponding core dump when using java [EMAIL PROTECTED] ./RJava Loading RInterpreter library R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 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. 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 a HTML browser interface to help. Type 'q()' to quit R. running source doNothing.R Problems: unrecognized user-level object of mode 0 Error: No default Java type for S class ??? An unexpected exception has been detected in native code outside the VM. Unexpected Signal : 11 occurred at PC=0xF1835E50 Function=setup_Rmainloop+0x4F8 Library=/imports/filer04/tools/app/R-2.1.1/lib/R/lib/libR.so Current Java thread: at org.omegahat.R.Java.REvaluator.eval(Native Method) at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:90) at org.omegahat.R.Java.REvaluator.eval(REvaluator.java:40) at com.icoria.rwrapper.JavaRCall3.run_sourceRFile(JavaRCall3.java:25) at com.icoria.rwrapper.JavaRCall3.main(JavaRCall3.java:46 Dynamic libraries: 0x1 /tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/bin/java 0xff36 /usr/lib/libthread.so.1 0xff3a /usr/lib/libdl.so.1 0xff20 /usr/lib/libc.so.1 0xff33 /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1 0xfe00 /imports/filer04/tools/app/j2sdk1.4.1_02-20030305/j2sdk1.4.1_02/jre/lib/sparc/client/libjvm.so 0xff2d /usr/lib/libCrun.so.1 0xff1e /usr/lib/libsocket.so.1 0xff10 /usr/lib/libnsl.so.1
Re: [R] How to delete rows
To delete duplicate rows, use unique(TAB1): see its help page. It looks to me as if the names are missing values NA and *not* start with NA. If so, you want to use TAB1[!is.na(TAB1$Name), ] Otherwise, perhaps TAB1[substr(TAB1$Name, 1, 2) == NA, ]. On Wed, 27 Jul 2005, Michael Graber wrote: Dear R-users, I am very new to R, so maybe my question is very easy to answer. I have the following table: TAB1-data.frame(Name,Number), Name and Number are all character strings, it looks like this: Name Number ab 2 ab 2 NA 15 NA 15 NA 15 cd 3 ef 1 NA 15 NA 15 gh 15 gh 15 I want to delete all the rows which begin with NA and all the rows where names are duplicates (for example the second row). I have tried this, but I only get numbers: for (i in 1:ZeileMax ) {if ( TAB1[[1]] [i] != NA ) {cat(TAB1[[1]][i],file = Name.txt,fill= TRUE,append = TRUE ,sep = );cat(TAB1[[2]][i], file=Number.txt, fill=TRUE,append=TRUE, sep=)}} Name-readLines(Name.txt) Number-readLines(Number.txt) TAB-data.frame(Name,Number) Thanks in advance, Michael Graber __ 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 -- 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
[R] setting elements to NA across an array
Please excuse what is obviously a trivial matter... I have a large 3-d array. I wish to set the third dimension (z) to NA if there are any NA values in the first two dimnesions (xy). So, given array foo: foo - array(data = NA, dim = c(5,5,3)) foo[,,1] - matrix(rnorm(25), 5, 5) foo[,,2] - matrix(rnorm(25), 5, 5) foo[,,3] - matrix(rnorm(25), 5, 5) I'll set two elements to NA foo[2,2,1]- NA foo[3,5,2]- NA foo Now I want to set foo[2,2,] - NA and foo[3,5,] - NA. How can I build a logical statement to do this? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R Reference Card (especially useful for Newbies)
Newbies (and others!) may find useful the R Reference Card made available by Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf or through the Contributed link on CRAN (where some other reference cards are also linked). It categorizes and organizes a bunch of R's basic, most used functions so that they can be easily found. For example, paste() is under the Strings heading and expand.grid() is under Data Creation. For newbies struggling to find the right R function as well as veterans who can't quite remember the function name, it's very handy. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] logistic regression: categorical value, and multinomial
Dear Ed, See ?glm for fitting binomial logit models, and ?multinom (in the nnet package) for multinomial logit models. Neither function will handle a character (text) variable as the response, but you could easily convert the variable to a factor. 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 Haibo Huang Sent: Wednesday, July 27, 2005 11:23 AM To: r-help@stat.math.ethz.ch Subject: [R] logistic regression: categorical value, and multinomial I have two questions: 1. If I want to do a binomial logit, how to handle the categorical response variable? Data for the response variables are not numerical, but text. 2. What if I want to do a multinomial logit, still with categorical response variable? The variable has 5 non-numerical response levels, I have to do it with a multinomial logit. Any input is highly appreciated! Thanks! Ed __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] setting elements to NA across an array
Dear Dr Carbon, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dr Carbon Sent: Wednesday, July 27, 2005 12:19 PM To: [EMAIL PROTECTED] Subject: [R] setting elements to NA across an array Please excuse what is obviously a trivial matter... I have a large 3-d array. I wish to set the third dimension (z) to NA if there are any NA values in the first two dimnesions (xy). So, given array foo: foo - array(data = NA, dim = c(5,5,3)) foo[,,1] - matrix(rnorm(25), 5, 5) foo[,,2] - matrix(rnorm(25), 5, 5) foo[,,3] - matrix(rnorm(25), 5, 5) I'll set two elements to NA foo[2,2,1]- NA foo[3,5,2]- NA foo Now I want to set foo[2,2,] - NA and foo[3,5,] - NA. How can I build a logical statement to do this? That should work just as you've specified it: That is, elements in all layers in the second row, second column and in the the third row, fifth column of the array should be NA. Since you posed the question, I suppose that I'm missing something. I hope this helps, John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] setting elements to NA across an array
Sorry for being obtuse. How can I build a logical statement that will set foo[2,2,] - NA and foo[3,5,] - NA? Something like, if any row and column are NA, then set NA to that row and column to NA for the entire array On 7/27/05, John Fox [EMAIL PROTECTED] wrote: Dear Dr Carbon, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dr Carbon Sent: Wednesday, July 27, 2005 12:19 PM To: [EMAIL PROTECTED] Subject: [R] setting elements to NA across an array Please excuse what is obviously a trivial matter... I have a large 3-d array. I wish to set the third dimension (z) to NA if there are any NA values in the first two dimnesions (xy). So, given array foo: foo - array(data = NA, dim = c(5,5,3)) foo[,,1] - matrix(rnorm(25), 5, 5) foo[,,2] - matrix(rnorm(25), 5, 5) foo[,,3] - matrix(rnorm(25), 5, 5) I'll set two elements to NA foo[2,2,1]- NA foo[3,5,2]- NA foo Now I want to set foo[2,2,] - NA and foo[3,5,] - NA. How can I build a logical statement to do this? That should work just as you've specified it: That is, elements in all layers in the second row, second column and in the the third row, fifth column of the array should be NA. Since you posed the question, I suppose that I'm missing something. I hope this helps, John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] HOW to Create Movies with R with repeated plot()?
What platform are you working on? On windows you can also create an animated gif file using ImageMagik (http://www.imagemagick.org/) from the cmd or you can use the more user friendly UnFREEz downloadable at http://www.whitsoftdev.com/unfreez/ ot Microsoft GIF animator(search for it on google). All the software mentioned are free and I have used them in the past to animate R output. Take a look at RSiteSearch(movie) for other interesting threads. Cheers Francisco From: Martyn Plummer [EMAIL PROTECTED] To: Jan Verbesselt [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] HOW to Create Movies with R with repeated plot()? Date: Wed, 27 Jul 2005 15:23:54 +0200 On Wed, 2005-07-27 at 12:11 +0200, Jan Verbesselt wrote: Dear R-helpers, Is it possible to create a type of 'movie' in R based on the output of several figures (e.g., jpegs) via the plot() function. I obtained dynamic results with the plotting function and would like to save these as a movie (e.g., avi or other formats)? You can use ImageMagick tools to convert a set of bitmap files into an animated GIF. For example, in R, this creates 101 separate png files: x - seq(-1,1,length=101) y - x^2 png() for (i in 1:length(y)) { plot(x[1:i], y[1:i], xlim=c(-1,1), ylim=c(0,1), type=l) } dev.off() Then, on the command line (on Linux) this joins them together convert -delay 10 Rplot*.png Rplot.gif animate Rplot.gif You can also create MNG format, but this is less widely supported. Martyn --- This message and its attachments are strictly confidential. ...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] setting elements to NA across an array
Dear Dr Carbon, Actually, it appears that I'm the one who was being obtuse. To make sure that I'm now interpreting what you want correctly, you'd like to set all entries in a layer to NA if any entry in a layer is NA. If that's correct, then how about the following? foo[array(apply(foo, c(1,2), function(x) any(is.na(x))), dim(foo))] - NA Regards, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: Dr Carbon [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 27, 2005 12:45 PM To: John Fox Cc: [EMAIL PROTECTED] Subject: Re: [R] setting elements to NA across an array Sorry for being obtuse. How can I build a logical statement that will set foo[2,2,] - NA and foo[3,5,] - NA? Something like, if any row and column are NA, then set NA to that row and column to NA for the entire array On 7/27/05, John Fox [EMAIL PROTECTED] wrote: Dear Dr Carbon, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dr Carbon Sent: Wednesday, July 27, 2005 12:19 PM To: [EMAIL PROTECTED] Subject: [R] setting elements to NA across an array Please excuse what is obviously a trivial matter... I have a large 3-d array. I wish to set the third dimension (z) to NA if there are any NA values in the first two dimnesions (xy). So, given array foo: foo - array(data = NA, dim = c(5,5,3)) foo[,,1] - matrix(rnorm(25), 5, 5) foo[,,2] - matrix(rnorm(25), 5, 5) foo[,,3] - matrix(rnorm(25), 5, 5) I'll set two elements to NA foo[2,2,1]- NA foo[3,5,2]- NA foo Now I want to set foo[2,2,] - NA and foo[3,5,] - NA. How can I build a logical statement to do this? That should work just as you've specified it: That is, elements in all layers in the second row, second column and in the the third row, fifth column of the array should be NA. Since you posed the question, I suppose that I'm missing something. I hope this helps, John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] fitting extreme value distribution
hi, rgev function gives me random deviates and I have a data set which I am fitting to an EVD,IS there a way I can plot both observed and ideal evd on the same plot thankyou Rangesh __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] get the content of object in ls()?
Hi, I am wirting a R script to process some data routinely and have a problem when try to get the content of object in ls()? Here is the script: ls() [1] a b [3] files.num fll92_1a_gpr [5] fll92_1a_gpr_norm fll92_1a.gpr.norm.scale [7] fname fullnames [9] gal galfile [11] i readGalfile2 [13] sample1 ttest1 grep(_gpr$,ls()) [1] 4 ls()[4] [1] fll92_1a_gpr class(ls()[4]) [1] character class(fll92_1a_gpr) [1] marrayRaw attr(,package) [1] marray I use the regular expression to get the name of the object I want, which is fll92_1a_gpr, the fourth element in ls() list. But i can't get the content of that object using ls()[4], which gives me a character object(having a double quote). I can still get the data in fll92_1a_gpr by typing fll92_1a_gpr. But this can't be done if I want to implement it in a executable R script. Anyone has an idea how to solve this? meng [[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
Re: [R] HOW to Create Movies with R with repeated plot()?
Hi, Here was a short tutorial about howto do that: http://r.vsthost.com/wordpress/2005/07/01/creating-video-files-on-gnulinux-using-r/ PS: You can submit such short articles or tutorials, if you have time. I was thinking to add more stuff, but these days I don't have much time. --Vehbi Sinan Jan Verbesselt wrote: Dear R-helpers, Is it possible to create a type of 'movie' in R based on the output of several figures (e.g., jpegs) via the plot() function. I obtained dynamic results with the plotting function and would like to save these as a movie (e.g., avi or other formats)? Regards, Jan _ Ir. Jan Verbesselt Research Associate Group of Geomatics Engineering Department Biosystems ~ M³-BIORES Vital Decosterstraat 102, 3000 Leuven, Belgium Tel: +32-16-329750 Fax: +32-16-329760 http://gloveg.kuleuven.ac.be/ ___ [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] setting elements to NA across an array
It's easiest to reshape foo first: d - dim(foo) dim(foo) - c(d[1]*d[2],d[3]) m - rowSums(is.na(foo)) and then assign foo[m,] - NA and reshape dim(foo) - d (Reshaping just makes the indexing easier). Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dr Carbon Sent: Wednesday, July 27, 2005 1:45 PM To: John Fox Cc: [EMAIL PROTECTED] Subject: Re: [R] setting elements to NA across an array Sorry for being obtuse. How can I build a logical statement that will set foo[2,2,] - NA and foo[3,5,] - NA? Something like, if any row and column are NA, then set NA to that row and column to NA for the entire array On 7/27/05, John Fox [EMAIL PROTECTED] wrote: Dear Dr Carbon, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dr Carbon Sent: Wednesday, July 27, 2005 12:19 PM To: [EMAIL PROTECTED] Subject: [R] setting elements to NA across an array Please excuse what is obviously a trivial matter... I have a large 3-d array. I wish to set the third dimension (z) to NA if there are any NA values in the first two dimnesions (xy). So, given array foo: foo - array(data = NA, dim = c(5,5,3)) foo[,,1] - matrix(rnorm(25), 5, 5) foo[,,2] - matrix(rnorm(25), 5, 5) foo[,,3] - matrix(rnorm(25), 5, 5) I'll set two elements to NA foo[2,2,1]- NA foo[3,5,2]- NA foo Now I want to set foo[2,2,] - NA and foo[3,5,] - NA. How can I build a logical statement to do this? That should work just as you've specified it: That is, elements in all layers in the second row, second column and in the the third row, fifth column of the array should be NA. Since you posed the question, I suppose that I'm missing something. I hope this helps, John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] get the content of object in ls()?
See ?get. Andy From: Meng Cheng Hi, I am wirting a R script to process some data routinely and have a problem when try to get the content of object in ls()? Here is the script: ls() [1] a b [3] files.num fll92_1a_gpr [5] fll92_1a_gpr_norm fll92_1a.gpr.norm.scale [7] fname fullnames [9] gal galfile [11] i readGalfile2 [13] sample1 ttest1 grep(_gpr$,ls()) [1] 4 ls()[4] [1] fll92_1a_gpr class(ls()[4]) [1] character class(fll92_1a_gpr) [1] marrayRaw attr(,package) [1] marray I use the regular expression to get the name of the object I want, which is fll92_1a_gpr, the fourth element in ls() list. But i can't get the content of that object using ls()[4], which gives me a character object(having a double quote). I can still get the data in fll92_1a_gpr by typing fll92_1a_gpr. But this can't be done if I want to implement it in a executable R script. Anyone has an idea how to solve this? meng [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] gamma distribution
Hi You are right but here I am taking into account the p values I get from the tests on the raw and the transformed samples. And then I calculate the power of the tests based on the # of rejections of the p values. DO you think its a good way to determine the power of a test? thanks -dev Quoting Christoph Buser [EMAIL PROTECTED]: Hi I am a little bit confused. You create two sample (from a gamma distribution) and you do a wilcoxon test with this two samples. Then you use the same monotone transformation (log) for both samples and redo the wilcoxon test. But since the transformations keeps the order of your samples the second wilcoxon test is identical to the first one: x-rgamma(10, 2.5, scale = 10) y-rgamma(10, 2.5, scale = 10) wilcox.test(x, y, var.equal = FALSE) x1-log(x) y1-log(y) wilcox.test(x1, y1, var.equal = FALSE) Maybe you can give some more details about the hypothesis you'd like to test. Regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH (Federal Inst. Technology)8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- [EMAIL PROTECTED] writes: Hi R Users This is a code I wrote and just want to confirm if the first 1000 values are raw gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get 2000 rows once I import into excel, the p - values beyond 1000 dont look that good, they are very high. -- sink(a1.txt); for (i in 1:1000) { x-rgamma(10, 2.5, scale = 10) y-rgamma(10, 2.5, scale = 10) z-wilcox.test(x, y, var.equal = FALSE) print(z) x1-log(x) y1-log(y) k-wilcox.test(x1, y1, var.equal = FALSE) print(k) } --- any suggestions are welcome thanks -devarshi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to get actual value from predict in nnet?
Dear All, After followed the help of nnet, I could get the networks trained and, excitedly, get the prediction for other samples. It is a two classes data set, I used N and P to label the two. My question is, how do I get the predicted numerical value for each sample? Not just give me the label(either N or P)? Thanks! FYI: The nnet example I followed from help document is, ird - data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]), species = c(rep(s,50), rep(c, 50), rep(v, 50))) ir.nn2 - nnet(species ~ ., data = ird, subset = samp, size = 2, rang = 0.1, decay = 5e-4, maxit = 200) table(ird$species[-samp], predict(ir.nn2, ird[-samp,], type = class)) Best regards, Baoqiang Cao __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Installing SJava (I'm almost there, just a little more help please!....please!)
Hi. Day three and Im still struggling with this. Any advice to overcome the final hurdle will be enormously appreciated. I now have all the right Java applications etc. in their right places and have managed to get rid of most errors but still get this: Making package SJava Building JNI header files... adding build stamp to DESCRIPTION running src/Makefile.win (cd .. ; ./configure.win c:/PROGR~1/R/rw200l) /configure.win: not found make[3]: *** [config] Error 127 make[2]: *** [srcDynLib] Error 2 make[1]: *** [all] Error 2 Make: *** [pk9SJava] Error 2 *** Installation of SJava failed *** Removing c:/PROGR~1/R/rw200l/library/SJava I am Windows XP with SJava (SJava_0.68-0.tar.gz) downloaded to my c drive (c:\SJava_0.68-0.tar.gz). R is rw2001 (c:\Program Files\R\rw2001). I am using the following R CMD INSTALL c:\SJava-0.68-0.tar.gz. Why is the configure.win file not being found? Where is it looking for it? My eternal gratitude to anybody willing to take me out of my pain. --- [[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
Re: [R] odesolve/lsoda differences on Windows and Mac
Martin Henry H. Stevens [EMAIL PROTECTED] writes: Hi - I am getting different results when I run the numerical integrator function lsoda (odesolve package) on a Mac and a PC. I am trying to simulating a system of 10 ODE's with two exogenous pulsed inputs to the system, and have had reasonably good success with many model parameter sets. Under some parameter sets, however, the simulations fail on the Mac (see error message below). The same parameter sets, however, appear to run fine for our computational technician on his PC, generating apparently very reasonable data. One thought: Integrating across input pulses is a known source of turbulence in lsoda. You might have better luck integrating over intervals in which the input function is continuous. Tweaking the lsoda tolerances is another thing to try. I haven't seen lsoda fail like that, but it's not too surprising that marginal cases show platform dependency (i.e. the integrator just fails on Mac and barely succeeds on PC). Our tech is successfully running Dell Latitude D810, Windows XP Pro (Service Pack 2), 1Gb RAM. RGUI 2.1.1 I am running: R Version 2.1.1 (2005-06-20) on a Mac OS 10.3.9 Machine Model: Power Mac G5 CPU Type: PowerPC 970 (2.2) Number Of CPUs:2 CPU Speed: 2 GHz L2 Cache (per CPU):512 KB Memory:1.5 GB Bus Speed: 1 GHz Boot ROM Version: 5.0.7f0 Serial Number: XB3472Q1NVS My Error Message system.time( + outAc2 - as.data.frame(lsoda(xstart,times, pondamph, parms, tcrit=170*730, hmin=.1)) + ) [1] 0.02 0.01 0.04 0.00 0.00 Warning messages: 1: lsoda-- at t (=r1) and step size h (=r2), the 2: corrector convergence failed repeatedly 3: or with abs(h) = hmin 4: Returning early from lsoda. Results are accurate, as far as they go Thanks for any input. Hank Stevens -- 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
Re: [R] Installing SJava (I'm almost there, just a little more help please!....please!)
Hi Duncan Thank you for responding... I apologise for being so ignorant. I presume that is a UNIX command - so have just downloaded cygwin (read about that today) and ran your suggested line. I get: Chmod: cannot acess 'configure.win'. No such file or directory I am assuming that isn't good. Is this the configure file I find in SJava? Do I need to move it somewhere for this to work? All of the best, Quin -Original Message- From: Duncan Temple Lang [mailto:[EMAIL PROTECTED] Sent: 27 July 2005 09:30 PM To: Quin Wills Subject: Re: [R] Installing SJava (I'm almost there, just a little more help please!please!) Hi. It has been a long time since I looked at the Windows side of things of SJava. Is configure.win present _AND_ executable. Make certain that it is by using chmod +x configure.win D. Quin Wills wrote: Hi. Day three and I’m still struggling with this. Any advice to overcome the final hurdle will be enormously appreciated. I now have all the right Java applications etc. in their right places and have managed to get rid of most errors but still get this: —Making package SJava — Building JNI header files... adding build stamp to DESCRIPTION running src/Makefile.win (cd .. ; ./configure.win c:/PROGR~1/R/rw200l) /configure.win: not found make[3]: *** [config] Error 127 make[2]: *** [srcDynLib] Error 2 make[1]: *** [all] Error 2 Make: *** [pk9—SJava] Error 2 *** Installation of SJava failed *** Removing ‘c:/PROGR~1/R/rw200l/library/SJava’ I am Windows XP with SJava (SJava_0.68-0.tar.gz) downloaded to my c drive (c:\SJava_0.68-0.tar.gz). R is rw2001 (c:\Program Files\R\rw2001). I am using the following “R CMD INSTALL c:\SJava-0.68-0.tar.gz”. Why is the configure.win file not being found? Where is it looking for it? My eternal gratitude to anybody willing to take me out of my pain. --- [[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 -- Duncan Temple Lang[EMAIL PROTECTED] Department of Statistics work: (530) 752-4782 371 Kerr Hall fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA --- Incoming mail is certified Virus Free. --- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Returning positions of a vector
Hi, I'd like to return the rows of sampled values of a vector. Can't figure out how to do it. For example: I start with [3, 1, 7, 4, 10] that have position [1,2,3,4,5]. I sample [10,1,4] and I want to return [5,2,4]. I'm sure there's a simple way to do that but haven't been able to figure it out or locate it. Thanks in advance...mj [[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
Re: [R] Returning positions of a vector
On 7/27/05 5:44 PM, Mike Jones [EMAIL PROTECTED] wrote: Hi, I'd like to return the rows of sampled values of a vector. Can't figure out how to do it. For example: I start with [3, 1, 7, 4, 10] that have position [1,2,3,4,5]. I sample [10,1,4] and I want to return [5,2,4]. I'm sure there's a simple way to do that but haven't been able to figure it out or locate it. Thanks in advance...mj Look at ?match: junk - c(3,1,7,4,10) junk1 - c(10,1,4) match(junk1,junk) [1] 5 2 4 Hope that helps Sean [[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
Re: [R] Returning positions of a vector
Mike Jones wrote: Hi, I'd like to return the rows of sampled values of a vector. Can't figure out how to do it. For example: I start with [3, 1, 7, 4, 10] that have position [1,2,3,4,5]. I sample [10,1,4] and I want to return [5,2,4]. I'm sure there's a simple way to do that but haven't been able to figure it out or locate it. Thanks in advance...mj Try ?match. x - c(3, 1, 7, 4, 10) match(c(10, 1, 4), x) HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] gamma distribution
Hi I ran your code. I think it should give me the number of p values below 0.05 significance level (thats what i could understand from your code), but after running your code there is neither any error that shows up nor any value that the console displays. thanks in advance -dev. Quoting Uwe Ligges [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Hi R Users This is a code I wrote and just want to confirm if the first 1000 values are raw gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get 2000 rows once I import into excel, the p - values beyond 1000 dont look that good, they are very high. He? - log() transforming the data does not change the Wilcoxon statistics (based on ranks!)! - Why is this related to Excel? - What are you going to show? I get erg - replicate(1000, { x-rgamma(10, 2.5, scale = 10) y-rgamma(10, 2.5, scale = 10) wilcox.test(x, y, var.equal = FALSE)$p.value }) sum(erg 0.05) # 45 which seems plausible to me. Uwe Ligges -- sink(a1.txt); for (i in 1:1000) { x-rgamma(10, 2.5, scale = 10) y-rgamma(10, 2.5, scale = 10) z-wilcox.test(x, y, var.equal = FALSE) print(z) x1-log(x) y1-log(y) k-wilcox.test(x1, y1, var.equal = FALSE) print(k) } --- any suggestions are welcome thanks -devarshi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Error in FUN(newX[, i], ...) : `x' must be atomic
Aah, OK. Thanks for the correction. I learn something new every day. That's why I like this list! Serves me right for relying on my Lisp knowledge. Cheers, Simon. At 07:26 PM 27/07/2005, Peter Dalgaard wrote: Simon Blomberg [EMAIL PROTECTED] writes: Actually, atoms are originally a Lisp concept. Objects are either atoms or not. Atoms are data types that cannot be taken apart, such as numbers or symbols. Lists and vectors (of length 1) are examples of non-atomic data types. Did you pass a vector to FUN? Actually, vectors ARE atomic in R, so your definition is somewhat off target. is.atomic(rnorm(5)) [1] TRUE In the extreme, the only true atom is the bit, everything else can be taken apart - doubles into (sign,exponent,mantissa) etc. So languages *define* their own atoms, as objects that are not composed of other objects in the language. (And even that is a partial lie for R, because atoms can have attributes. Atomicity is purely based on the type of an object. The help page has a list of the atomic types.) Cheers, Simon. At 12:22 PM 27/07/2005, Srinivas Iyyer wrote: Hello Group, What is the meaning of the error. is there any place to look for this. I guess 'atomic' seems to be OOP related concept. thank you srini __ 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 Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ 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 -- 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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] CSV file and date. Dates are read as factors!
I am using read.csv to read a CSV file (produced by saving an Excel file as a CSV file). The columns containing dates are being read as factors. Because of this, I can not compute follow-up time, i.e. Followup-postDate-preDate. I would appreciate any suggestion that would help me read the dates as dates and thus allow me to calculate follow-up time. Thanks John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryland School of Medicine Claude Pepper OAIC University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 410-605-7119 - NOTE NEW EMAIL ADDRESS: [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
Re: [R] fitting extreme value distribution
If this is a question about plotting 2 series on a plot then in general terms you can plot 2 series as per this example in the list http://finzi.psych.upenn.edu/R/Rhelp02a/archive/5463.html If it is about the use of rgev you should tell us the name of the package. If you read the posting guide you will find ways to help imporve the way that you ask questions, so that it is easier for people to give you an answer that works for you. Tom -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of kunnavrv Sent: Thursday, 28 July 2005 1:58 AM To: r-help@stat.math.ethz.ch Subject: [R] fitting extreme value distribution hi, rgev function gives me random deviates and I have a data set which I am fitting to an EVD,IS there a way I can plot both observed and ideal evd on the same plot thankyou Rangesh __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Dates are read as factors!
I am using read.csv to read a CSV file (produced by saving an Excel file as a CSV file). The columns containing dates are being read as factors. Because of this, I can not compute follow-up time, i.e. Followup-postDate-preDate. I would appreciate any suggestion that would help me read the dates as dates and thus allow me to calculate follow-up time. Thanks John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryland School of Medicine Claude Pepper OAIC University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 410-605-7119 - NOTE NEW EMAIL ADDRESS: [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
Re: [R] Dates are read as factors!
On Wed, 2005-07-27 at 23:07 -0400, John Sorkin wrote: I am using read.csv to read a CSV file (produced by saving an Excel file as a CSV file). The columns containing dates are being read as factors. Because of this, I can not compute follow-up time, i.e. Followup-postDate-preDate. I would appreciate any suggestion that would help me read the dates as dates and thus allow me to calculate follow-up time. Thanks John John, Depending upon how may columns you are reading, you could: 1. Use the 'colClasses' argument in read.csv() to specify the data types for each incoming column, one of which is 'Date' Or 2. Post process the data after importing by using the as.Date() function. See ?as.Date for more information and pay particular attention to the 'format' argument. My own preference is number 2. Once the requisite columns are converted to the Date class, you can engage in date based arithmetic, etc. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] fitting extreme value distribution
Which rgev are you using? There are at least two in at least three different packages: evd, evir, and fExtremes. I found this by using 'help.search(rgev)', which will however only identify related material I already have installed locally. 'RSiteSearch(rgev)' produced 22 hits, the first of which was for the one in fExtremes. The documentation for the one in fExtremes includes a reasonable plotting example. Regarding fitting, have you considered fitdistr in library(MASS)? Beyond this, may I suggest you PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html. It can increase the likelihood you will get a useful reply relatively quickly. spencer graves kunnavrv wrote: hi, rgev function gives me random deviates and I have a data set which I am fitting to an EVD,IS there a way I can plot both observed and ideal evd on the same plot thankyou Rangesh __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Unexpected behavior in recode{car}
Thanks to the R creators for such a great statistical system. Thanks to the R help list, I have (finally) gotten far enough in R to have a question I hope to be worth posting. I'm using the recode function from John Fox's car package and have encountered some unexpected behavior. Consider the following example: ## Begin cut-and-paste example require( car ) set.seed(12345) nn - sample( c( 2, 4 ), size=50, replace=TRUE ) rr - recode( nn, 2='TWO';4='FOUR' ) table( rr, exclude=NULL ) ss - recode( nn, 2='Num2';4='Num4' ) # Doesn't work as expected table( ss, exclude=NULL ) tt - recode( nn, 2='TWO'; 4='Num4' ) table( tt, exclude=NULL ) uu - recode( nn, 2='Num2'; 4='FOUR' ) table( uu, exclude=NULL ) ## End cut-and-paste example All but the recoding to ss work as expected: I get a character vector with 23 instances of either FOUR or Num4 and 27 instances of TWO or Num2. But for the ss line, wherein all the strings to be assigned contain a digit, the resulting vector contains all NAs. Using str(), I note that ss is a numeric vector. Is there a tidy way (using recode) to recode numeric values into character strings, all of which contain a digit? I have a workaround for my current project, but it would be nice to be able to use mixed alphanumeric strings in this context. Thanks in advance for any insight you can give into this question. Using R 2.1.1 (downloaded binary) on Windows XP Pro, car version 1.0-17 (installed from CRAN via Windows GUI). Complete version information below: version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R t(t( installed.packages()['car',] )) [,1] Package car LibPath C:/Programs/R/rw2011/library Version 1.0-17 Priority NA Bundle NA Contains NA Depends R (= 1.9.0) Suggests MASS, nnet, leaps Imports NA Built2.1.0 I subscribe to the help list in digest form, so would appreciate being copied directly in addition to seeing responses sent to the list. David Dailey Shoreline, Washington, USA [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
Re: [R] Wishart Density
'RSiteSearch(wishart)' just produced 45 hits for me, the first of which was for function 'Simnu.mix' in package 'SharedHT2'. If this does not help you, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html. It can improve the chances that you will get a useful reply. spencer graves Wang, Meihua wrote: Dear R users, I am doing MCMC using Metropolis-Hastings. My model is bivariate-log-normal and the prior for variance-covariance is wishart distribution. I am wondering if there are some simple codes about how to get the density of Wishart distribution in my case ? Thanks in advance. Meihua [[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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] SETAR Estimation
I just got zero hits from 'RSiteSearch(SETAR)'. When I Googled for SETAR, I got 219,000 hits, but nothing on the first page looked like it might be your SETAR. Then I Googled for SETAR Model and got something that suggested threshold autoregressive ... Then and 'RSiteSearch(threshold autoregressive) produced 6 hits, the first of which was for wle.ar in package wle. hope this helps. spencer graves p.s. If this does not solve your problem, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html. It can increase your chances of getting a useful reply from this list. [EMAIL PROTECTED] wrote: Dear R-helpers, I was wondering if anyone has or knows someone who might have an implementation of algorithm for estimating SETAR models including the lag-order. For some reason my code gives me a bit wrong results. I am fighting with it for a week and cannot bring it down. Thanks a million in advance, Sincerely, Evgueni McGill University Department of Economics __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] a class matrix with class ordered data
If you still are interested in help with your problem, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html. It can increase the likelihood of you getting a useful reply. See other comments in line. spencer graves Werner Bier wrote: Deart R-help, I could not transfer ordered data into a matrix, does anybody knows if there is something wrong in the code below please? Thanks in advance, Tom Y - ordered( unlist( Q[,1:2] ) ) This creates Y as an ordered factor. z - matrix(0, nrow(Q), 2) z - Y This completely discards the matrix z and replaces it with Y. Nothing of the matrix remains (except in your memory). is.ordered(z) [1] T is.matrix(z) [1] F i.e. Is it possibile somehow to have is.matrix(z) equal TRUE? Rather than asking only for an explanation of some little thing that didn't solve your problem, may I suggest you tell us more about the problem you are actually trying to solve. Why are you doing this? What specifically do you want to accomplish -- but expressed in terms of a very simple example with a few lines of code that a reader can copy into R on their computer and get something, then try a couple of modifications that might be closer to what you want. __ [[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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Convert quarterly data to monthly data
Have you considered aggregate in library(zoo)? If you are not familiar with zoo, I suggest you install it, then run 'vignette(zoo)' and 'edit(vignette(zoo))' [NOTE: If you use Emacs, 'edit(vignette(...))' won't work. There is something that will, but I don't remember what it is. If you need it, please PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html and try this list again.] spencer graves Haibo Huang wrote: Hi, I am new to use R, but can anyone tell me how to tranform quarterly data to monthly data? I know SAS has this procedure, so may I assume it is also available in R? Thanks a lot! Ed __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Question on glm for Poisson distribution.
I can't help you much, because you did not include a simple example that is sufficiently complete for me to run it myself and play with the results. I ran the example glm.D93 - glm(counts ~ outcome + treatment, family=poisson()) in the glm help file. Then I looked at str(glm.D93); attributes(glm.D93) might have been a better choice in this case, but str is more general and will expose things hidden from attributes. Then I looked at glm.D93$contrasts, and found that the contrasts used for outcome and treatment were both contr.treatment. Then I tried contr.treatment(outcome) and got something useful. If this is not adequate and you still could use help, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html and try this list again. spencer graves Ghislain Vieilledent wrote: Good afternoon, I REALLY try to answer to my question as an autonomous student searching in the huge pile of papers on my desk and on the Internet but I can't find out the solution. Would you mind giving me some help? Please. # I'm trying to use glm with factors: Pyr.1.glm-glm(Pyrale~Trait,DataRav,family=poisson) If I have correctly payed attention to my cyber professor explanations I have, for the variable Pyrale which I suppose Poisson-distributed, the following mathematical expression: P(Pyrale=k)=exp(-m).[(m^k)/k!] with log(m)=Intercept+Trait(i) (link function is log for Poisson distribution) Then I test the significativity of Trait: anova(Pyr.1.glm,test=Chisq) Analysis of Deviance Table Model: poisson, link: log Response: Pyrale Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev P(|Chi|) NULL 19 49.813 Trait 3 31.281 16 18.532 7.419e-07 Which means that variable Trait is significant for determining the value of P(Pyrale=k). I tried to order the effects of the modalities of my variable Trait using: summary(Pyr.1.glm) Call: glm(formula = Pyrale ~ Trait, family = poisson, data = DataRav) Deviance Residuals: Min 1Q Median 3Q Max -1.7117 -0.8944 -0.6237 0.6390 1.5224 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 1.3350 0.2294 5.819 5.92e-09 *** TraitInsFong -2.9444 1.0259 -2.870 0.00410 ** TraitInsecticide -2.2513 0.7434 -3.028 0.00246 ** TraitTemoin -0.2364 0.3454 -0.684 0.49372 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 (Dispersion parameter for poisson family taken to be 1) Null deviance: 49.813 on 19 degrees of freedom Residual deviance: 18.532 on 16 degrees of freedom AIC: 61.85 Number of Fisher Scoring iterations: 5 ## I have therefore two questions: - Considering the values of estimated coefficients for Trait(i), does it mean that the bigger is the coefficient, the lower is the probability considering the mathematical expression (exp(-m))? - How can I check that coefficients are significatively different one from each other (as with function TukeyHSD for other models)? Thanks for you help. Regards Ghislain. -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to get actual value from predict in nnet?
Ask predict.nnet for a type other than class, as described on its help page. Please do read the help pages for yourself (as the posting guide asks). On Wed, 27 Jul 2005, Baoqiang Cao wrote: Dear All, After followed the help of nnet, I could get the networks trained and, excitedly, get the prediction for other samples. It is a two classes data set, I used N and P to label the two. My question is, how do I get the predicted numerical value for each sample? Not just give me the label(either N or P)? Thanks! FYI: The nnet example I followed from help document is, ird - data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]), species = c(rep(s,50), rep(c, 50), rep(v, 50))) ir.nn2 - nnet(species ~ ., data = ird, subset = samp, size = 2, rang = 0.1, decay = 5e-4, maxit = 200) table(ird$species[-samp], predict(ir.nn2, ird[-samp,], type = class)) -- 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