[R] MailMonitor Alert
Scanner: MMSMTP2.0 Problem description: Scanning message headers: Body part: 1 [] SAV sweep results: Body part: 2 [Part-2.zip] SAV sweep results: A virus was detected. Virus found: W32/Netsky-Z Virus found: W32/Netsky-Z condition: virus infection action taken: disinfect condition: virus disinfection failed action taken: delete attachment __ [EMAIL PROTECTED] 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 : generating correlation matrix with a particular structure
Hi, I would like to generate a correlation matrix with a particular structure. For example, a 3n x 3n matrix : A_(nxn) aI_(nxn) bI_(nxn) aI_(nxn) A_(nxn) cI_(nxn) aI_(nxn) cI_(nxn) A_(nxn) where - A_(nxn) is a *specified* symmetric, positive definite nxn matrix. - I_(nxn) is an identity matrix of order n - a, b, c are (any) real numbers Many attempts have been unsuccessful because a resulting matrix with any a, b, c may not be a positive definite one, and hence cannot qualify as a correlation matrix. Trying to first generate a covariance matrix however, does not guarantee a corresponding correlation matrix with the above structure. My larger purpose is to use this correlation matrix to generate multivariate normal observations from the corresponding covariance matrix (derived via cholesky decomposition of the cor matrix). Greatly appreciate any comments, if this is possible or how this can be done. Many grateful thanks and good day, Melinda R-version used : --- Windows version R-1.8.1 Running on Windows XP __ [EMAIL PROTECTED] 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] Help : generating correlation matrix with a particular structure
Siew Leng TENG [EMAIL PROTECTED] writes: Hi, I would like to generate a correlation matrix with a particular structure. For example, a 3n x 3n matrix : A_(nxn) aI_(nxn) bI_(nxn) aI_(nxn) A_(nxn) cI_(nxn) aI_(nxn) cI_(nxn) A_(nxn) where - A_(nxn) is a *specified* symmetric, positive definite nxn matrix. - I_(nxn) is an identity matrix of order n - a, b, c are (any) real numbers Many attempts have been unsuccessful because a resulting matrix with any a, b, c may not be a positive definite one, and hence cannot qualify as a correlation matrix. Trying to first generate a covariance matrix however, does not guarantee a corresponding correlation matrix with the above structure. Er, a correlation matrix *is* a covariance matrix with 1 down the diagonal... You need to sort out the parametrization issues. What you're trying to achieve is quite hard. Consider the simpler case of two blocks and n=2; what you're asking for is a covariance matrix of the form 1 r a 0 r 1 0 a a 0 1 r 0 a r 1 so if this is the correlation matrix of (X1,Y1,X2,Y2) you want X1 and Y1 correlated X2 and Y2 correlated X1 and X2 correlated Y1 and Y2 correlated but X1 and Y2 uncorrelated Y1 and X2 uncorrelated One approach is to work out the conditional variance of (X2,Y2) given (X1,Y1) and check for positive semidefiniteness. You do the math... (Some preliminary experiments suggest that the criterion could be abs(a)+abs(r) = 1, but don't take my word for it) R-version used : --- Windows version R-1.8.1 Running on Windows XP You might want to upgrade, but it might not do anything for you in this respect. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] 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-2.0.0 on ARM (Sharp Zaurus)
Hi All, I've recently dusted off my cross-compiling hat and decided to add R to the OpenEmbedded build environment (this is used to build the OpenZaurus/Familiar distributions for the Zaurus/iPAQ amongst other things - I note there's also work underway to add the Psion 5mx etc. to OpenEmbedded). OpenEmbedded builds now use -soft-float which makes floating point operations something like 10x faster than the previous GCC3.x implementation which was itself faster than the GCC2.95 implementation of the original Sharp and OpenZaurus ROMs. That means, for those of you with Zauruses, that a switch from OZ3.2 (or any Sharp ROM) to the current OZ3.5.2 should produce significant speed increases when using R; perhaps even enough to make it usable/useful? Once I have a fully compiled version I'd be more than happy to run some benchmarks. Another thing to note with regards to usability, is that the OpenZaurus distribution now also comes in the GPE (X11 based) flavour, so R should be usable with all of its graphics. For those who want to stick with Opie (Qtopia based), a new development, XQt - which allows X11 apps to run inside a Qtopia/Opie window without needing to use VNC, as was previously the case - is available and it works very well. On to my progress... As ever the configure script isn't overly happy cross-compiling. The problem is the way in which LD_LIBRARY_PATH is altered (I note the FIXME comments around this bit of code). I've patched the file to remove this for my cross-build and it now works fine. I'm also passing ac_cv_bigendian=yes to avoid the NA problem of old (I presume this is still necessary, I'll test once I have a working binary). The next issue is related to the compilation process's use of the R.bin binary during the compilation. Obviously this doesn't work very well when you're cross-compiling. To try to get around this, I've created a native build of R as part of the cross-build process. I currently get an error in R-2.0.0/src/library/base: | make[3]: Entering directory `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library/base' | building package 'base' | mkdir -p -- ../../../library/base/demo | mkdir -p -- ../../../library/base/man | Error in eval(expr, envir, enclos) : may already be using lazy loading on base | Execution halted | make[3]: *** [all] Error 1 | make[3]: Leaving directory `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library/base' | make[2]: *** [R] Error 1 | make[2]: Leaving directory `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src/library' | make[1]: *** [R] Error 1 | make[1]: Leaving directory `/home/simon/dev/bk/build/tmp/work/r-2.0.0-r0/R-2.0.0/src' | make: *** [R] Error 1 Although I've no idea what it's trying to do here, my guess is that this 'lazy loading' has already been enabled on the native build (and this is what R_EXE points to as I've patched all the Makefile.in files under R-2.0.0/src/library), and therefore it's not happy trying to re-enable it on the cross-build. I'd appreciate it if someone could tell me whether my method (using the native version of R to perform these steps) can even work (or does the ARM version have to run these steps itself)? Assuming these steps build a database of some sort, would it be possible to just copy across the native built one? Would this work if placed in the correct location for the ARM build? If the ARM version has to run these steps, could they be delayed until it is installed and then run as a batch job? Sorry for the long post and the many questions. I Hope this is of interest to some of you, and that you might find a bit of time to help me out. Many thanks, Simon Simon Pickering MEng Research Officer Materials Research Centre Faculty of Engineering Design University of Bath Bath, BA2 7AY, UK Tel: +44 (0)1225 384802 Fax: +44 (0)1225 386928 __ [EMAIL PROTECTED] 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
R __ [EMAIL PROTECTED] 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] Help : generating correlation matrix with a particular structure
Siew Leng TENG siewlengteng at yahoo.com writes: : : Hi, : : I would like to generate a correlation matrix with a : particular structure. For example, a 3n x 3n matrix : : A_(nxn) aI_(nxn) bI_(nxn) : aI_(nxn) A_(nxn) cI_(nxn) : aI_(nxn) cI_(nxn) A_(nxn) : : where : - A_(nxn) is a *specified* symmetric, positive : definite nxn matrix. : - I_(nxn) is an identity matrix of order n : - a, b, c are (any) real numbers : : Many attempts have been unsuccessful because a : resulting matrix with any a, b, c may not be a : positive definite one, and hence cannot qualify as a : correlation matrix. Trying to first generate a : covariance matrix however, does not guarantee a : corresponding correlation matrix with the above : structure. : : My larger purpose is to use this correlation matrix to : generate multivariate normal observations from the : corresponding covariance matrix (derived via cholesky : decomposition of the cor matrix). This can be formulated a semidefinite programming problem. I don't think R has any packages that do that but a google search for semidefinite programming will find more info and some free non-R software which you could consider interfacing to R. __ [EMAIL PROTECTED] 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] Help : generating correlation matrix with a particular structure
Extending what Gabor and Peter have already said, the following should provide a partial solution: patternCor3 - function(A=diag(2), a=1:3){ # nk x nk covariance correlation matrices # k = length(a); abs(a) = min(diag(A) minV.A - min(diag(A)) if(any(adj.a - abs(a)minV.A)){ warning(abs(a) too large; can't exceed, min(diag(A)) = , minV.A, ; forced into that range.) a[adj.a] - sign(a[adj.a])*minV.A } Aa - kronecker(diag(3), A) n - dim(A)[1] i1 - n+1:n i2 - n+i1 diag(Aa[1:n, i1]) - a[1] diag(Aa[i1, 1:n]) - a[1] diag(Aa[1:n, i2]) - a[2] diag(Aa[i2, 1:n]) - a[2] diag(Aa[i1, i2]) - a[3] diag(Aa[i2, i1]) - a[3] s.A - sqrt(diag(A)) r.Aa - (Aa/outer(rep(s.A,3), rep(s.A,3))) eig.Aa - eigen(Aa) list(Aa=Aa, corr.Aa=r.Aa, eigen.Aa=eig.Aa) } If this works, all(eigen.Aa$values=0). Thus, you can add a test for this and have something close to what you want. You could add an objective function that includes these eigenvalues with, say, minimum adjustment of a and feed it to optim and let optim find a solution that is closest in whatever sense you think is useful. hope this helps. spencer graves Gabor Grothendieck wrote: Siew Leng TENG siewlengteng at yahoo.com writes: : : Hi, : : I would like to generate a correlation matrix with a : particular structure. For example, a 3n x 3n matrix : : A_(nxn) aI_(nxn) bI_(nxn) : aI_(nxn) A_(nxn) cI_(nxn) : aI_(nxn) cI_(nxn) A_(nxn) : : where : - A_(nxn) is a *specified* symmetric, positive : definite nxn matrix. : - I_(nxn) is an identity matrix of order n : - a, b, c are (any) real numbers : : Many attempts have been unsuccessful because a : resulting matrix with any a, b, c may not be a : positive definite one, and hence cannot qualify as a : correlation matrix. Trying to first generate a : covariance matrix however, does not guarantee a : corresponding correlation matrix with the above : structure. : : My larger purpose is to use this correlation matrix to : generate multivariate normal observations from the : corresponding covariance matrix (derived via cholesky : decomposition of the cor matrix). This can be formulated a semidefinite programming problem. I don't think R has any packages that do that but a google search for semidefinite programming will find more info and some free non-R software which you could consider interfacing to R. __ [EMAIL PROTECTED] 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 O: (408)938-4420; mobile: (408)655-4567 __ [EMAIL PROTECTED] 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] firefox and R 201
please help. why is it that i cannot open html help pages out of the R menu? here is what I do: using browser firefox1.0 (open source!), java plugin jre 150 installed, supposedly working properly. opening R201patched, html help, link:search engine and keywords: works properly, jre symbol appears. clicking on any link (keywords on that page): no reaction whatsoever. what am i doing wrong? closing and reopening firefox won't help, since the browser then asks me to create a new profile. maybe, firefox and R (interacting with java) are conflicting? i couldn't find any help entry, so i am sorry if this problem was addressed earlier. R forever! viele grüße mark hempelmann universität bielefeld __ [EMAIL PROTECTED] 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] switching to Linux, suggestions?
Dear List, I have acquired a new desktop and wanted to put a free OS on it. I am trying Fedora Core 1, but not sure what the best Linux OS is for using R 2.0.1? Thank you in advance for your input, Tom Volscho Thomas W. Volscho Graduate Student Dept. of Sociology U-2068 University of Connecticut Storrs, CT 06269 Phone: (860) 486-3882 http://vm.uconn.edu/~twv1 __ [EMAIL PROTECTED] 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] firefox and R 201
[EMAIL PROTECTED] (Mark Hempelmann) writes: please help. why is it that i cannot open html help pages out of the R menu? here is what I do: using browser firefox1.0 (open source!), java plugin jre 150 installed, supposedly working properly. opening R201patched, html help, link:search engine and keywords: works properly, jre symbol appears. clicking on any link (keywords on that page): no reaction whatsoever. what am i doing wrong? closing and reopening firefox won't help, since the browser then asks me to create a new profile. maybe, firefox and R (interacting with java) are conflicting? i couldn't find any help entry, so i am sorry if this problem was addressed earlier. Works for me on Linux (Fedora Core 3), but another old issue is there: Links that disappear when returning to the search page, and the search page is not responding to pgUp/pgDown keys until after the links have become defunct. Presumably, this means that we can add 1.4.2_06 to the list of java versions that don't work. (and apparently, no yum repository is carrying 1.5.0 yet, and I'm not going to mess with other forms of installs if I can help it). Did you check out the Windows section on http://cran.r-project.org/doc/manuals/R-admin.html ? (Not that you actually told us which OS you are running...) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] 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] US 2004 Elections map
Hi, I've updated the page with the US election maps, now using white instead of purple for counties that are 50/50 (thanks to Gregoire Thomas for the code). I like this graph, it relays the information a lot better. (Note that New England's missing counties are white as well.) I also removed some old code that was still around in the map.r file, so it now actually works when source'ing the code. http://www.ai.rug.nl/~hedderik/R/US2004 Moreover, some people asked me about a portfolio of graphics for R, e.g.: David Forrest wrote: I really like that -- Is there a place where R collects a portfolio of graphics and the code to build them? I think these sorts of things could help demonstrate and disseminate the graphics abilities of R. I would be more than willing to host such a page. If someone has graphs (with or without code) that s/he wants to share, please let me know, I'll create a page with pointers (or code/graphs itself), and will report back to the list. - Hedderik. P.S. And for those who asked whether I forgot Alaska and Hawaii, I did indeed forget about Alaska, but for Hawaii you just have to look slightly more to the left, just left of your monitor. :-) __ [EMAIL PROTECTED] 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] switching to Linux, suggestions?
El dom, 12-12-2004 a las 15:23 -0500, Thomas W Volscho escribió: Dear List, I have acquired a new desktop and wanted to put a free OS on it. I am trying Fedora Core 1, but not sure what the best Linux OS is for using R 2.0.1? Thank you in advance for your input, Tom Volscho I used R in the susseccive Fedora Core release (at the moment I use R 2.0.0 + FC3) with satisfaction. best, Juan Antonio Thomas W. Volscho Graduate Student Dept. of Sociology U-2068 University of Connecticut Storrs, CT 06269 Phone: (860) 486-3882 http://vm.uconn.edu/~twv1 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Juan Antonio Caballero Molina /\ASCII Ribbon Campaign Universidad de Córdoba \ /Respect for open standards Looking for fine softwareX No HTML/RTF in email and/or writing? / \No M$ Word docs in email http://counter.li.org Linux user number 346272 __ [EMAIL PROTECTED] 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] Is k equivalent to k:k ?
Havent seen anything on R-devel yet on this topic, but if the elseif statement on line 43 of seq.default was else if (length.out == 0) double(0) instead of else if (length.out == 0) numeric(0) then that *might* satisfy Richard A. O'Keefe's comment for length=0:n cases storage.mode(seq(length=0)) RichOK [1] integer storage.mode(seq(length=1)) RichOK [1] double marcus Martin Maechler [EMAIL PROTECTED] 10/12/2004 9:34:11 PM I'm diverting to R-devel, where this is really more appropriate. Here (R-help) only a shorter version: RichOK == Richard A O'Keefe [EMAIL PROTECTED] on Fri, 10 Dec 2004 14:37:16 +1300 (NZDT) writes: RichOK In this discussion of seq(), can anyone explain to RichOK me _why_ seq(to=n) and seq(length=3) have different RichOK types? well, the explantion isn't hard: look at seq.default :-) RichOK In fact, it's worse than that (R2.0.1): storage.mode(seq(length=0)) RichOK [1] integer storage.mode(seq(length=1)) RichOK [1] double { str(.) is shorter than storage.mode(.) } RichOK If you want to pass seq(length=n) to a .C or RichOK .Fortran call, it's not helpful that you can't tell RichOK what the type is until you know n! It would be nice RichOK if seq(length=n) always returned the same type. I RichOK use seq(length=n) often instead of 1:n because I'd RichOK like my code to work when n == 0; it would make life RichOK simpler if seq(length=n) and 1:n were the same type. now if that really makes your *life* simpler, what does that tell us about your life ;-) :-) For more on this, see the R-devel list to which this has been diverted. Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ The contents of this e-mail are privileged and/or confidenti...{{dropped}} __ [EMAIL PROTECTED] 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] errors when trying to rename data frame columns
Dear R users, I need to rename the columns of a series of data frames. The names of the data frames and those of the columns need to be pulled from some vectors. I tried a couple of things but only got errors. What am I missing? #---create data frame dframes - c(a,b,c) assign(dframes[2],data.frame(11:20,21:30)) #---rename the columns cols - c(one,two) names(get(dframes[2])) - cols Error: couldn't find function get- assign(dframes[2],data.frame(cols[1]=11:20,cols[2]=21:30)) Error: syntax error labels(get(dframes[2]))[[2]] - cols Error: couldn't find function labels- I'm using R 2.0.0 on Windows XP. Thank you, b. __ [EMAIL PROTECTED] 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] 'object.size' takes a long time to return a value
I was using 'object.size' to see how much memory a list was taking up. After executing the command, I had thought that my computer had locked up. After further testing, I determined that it was taking 241 seconds for object.size to return a value. I did notice in the release notes that 'object.size' did take longer when the list contained character vectors. Is the time that it is taking 'object.size' to return a value to be expected for such a list? Much better results were obtained when the character vectors were converted to factors. ## Results from the testing ### str(x.1) List of 10 $ : chr [1:227299] sadc sar date ksh ... $ : chr [1:227299] aprperf aprperf aprperf aprperf ... $ : num [1:227299] 23 23 0 23 23 0 0 0 0 23 ... $ : num [1:227299] 0 0 0 0 0 0 0 0 0 0 ... $ : num [1:227299] 3600 3600 0.01 3600 3600 0.01 0.01 0.01 0.01 3600 ... $ : num [1:227299] 0.01 0 0.01 0 0.01 0 0.01 0 0 0.01 ... $ : num [1:227299] 0 0 0 0 0 0 0 0 0 0 ... $ : num [1:227299] 0.01 0 0.01 0 0.01 0 0.01 0 0 0.01 ... $ : num [1:227299] 62608 6796829 10208 13128 ... $ : num [1:227299] 0 1 0 0 1 0 0 0 0 0 ... # takes a long time (241 seconds) to report the size gc();system.time(print(object.size(x.1))) used (Mb) gc trigger (Mb) Ncells 711007 19.02235810 59.8 Vcells 5191294 39.7 14409257 110.0 [1] 34154972 [1] 241.07 0.00 241.08 NA NA # trying list of 1000 x.2 - list.subset(x.1, 1:1000);gc();system.time(print(object.size(x.2))) used (Mb) gc trigger (Mb) Ncells 711006 19.02235810 59.8 Vcells 4300288 32.9 14409257 110.0 [1] 145860 [1] 0.01 0.00 0.01 NA NA # trying list of 10,000 x.2 - list.subset(x.1, 1:1);gc();system.time(print(object.size(x.2))) used (Mb) gc trigger (Mb) Ncells 711006 19.02235810 59.8 Vcells 4381288 33.5 14409257 110.0 [1] 1491948 [1] 0.28 0.00 0.28 NA NA # list of 40,000 x.2 - list.subset(x.1, 1:4);gc();system.time(print(object.size(x.2))) used (Mb) gc trigger (Mb) Ncells 711006 19.02235810 59.8 Vcells 4651288 35.5 14409257 110.0 [1] 5988460 [1] 7.15 0.00 7.15 NA NA # list of 60,000 x.2 - list.subset(x.1, 1:6);gc();system.time(print(object.size(x.2))) used (Mb) gc trigger (Mb) Ncells 711006 19.02235810 59.8 Vcells 4831288 36.9 14409257 110.0 [1] 9001556 [1] 17.33 0.00 17.32NANA # list of 100,000 x.2 - list.subset(x.1, 1:10);gc();system.time(print(object.size(x.2))) used (Mb) gc trigger (Mb) Ncells 711006 19.02235810 59.8 Vcells 5191288 39.7 14409257 110.0 [1] 15044780 [1] 51.85 0.00 51.86NANA # list structure of the last object str(x.2) List of 10 $ : chr [1:10] sadc sar date ksh ... $ : chr [1:10] aprperf aprperf aprperf aprperf ... $ : num [1:10] 23 23 0 23 23 0 0 0 0 23 ... $ : num [1:10] 0 0 0 0 0 0 0 0 0 0 ... $ : num [1:10] 3600 3600 0.01 3600 3600 0.01 0.01 0.01 0.01 3600 ... $ : num [1:10] 0.01 0 0.01 0 0.01 0 0.01 0 0 0.01 ... $ : num [1:10] 0 0 0 0 0 0 0 0 0 0 ... $ : num [1:10] 0.01 0 0.01 0 0.01 0 0.01 0 0 0.01 ... $ : num [1:10] 62608 6796829 10208 13128 ... $ : num [1:10] 0 1 0 0 1 0 0 0 0 0 ... # with the first two items on the list converted to factors, # 'object.size' performs a lot better str(x.1) List of 10 $ : Factor w/ 175 levels #bpbkar,#bpcd,..: 132 133 60 93 13 160 60 84 60 132 ... $ : Factor w/ 8 levels apra3g,aprperf,..: 2 2 2 2 2 2 2 2 2 2 ... $ : num [1:227299] 23 23 0 23 23 0 0 0 0 23 ... $ : num [1:227299] 0 0 0 0 0 0 0 0 0 0 ... $ : num [1:227299] 3600 3600 0.01 3600 3600 0.01 0.01 0.01 0.01 3600 ... $ : num [1:227299] 0.01 0 0.01 0 0.01 0 0.01 0 0 0.01 ... $ : num [1:227299] 0 0 0 0 0 0 0 0 0 0 ... $ : num [1:227299] 0.01 0 0.01 0 0.01 0 0.01 0 0 0.01 ... $ : num [1:227299] 62608 6796829 10208 13128 ... $ : num [1:227299] 0 1 0 0 1 0 0 0 0 0 ... system.time(print(object.size(x.1))) # now it is fast [1] 16374176 [1] 0 0 0 NA NA version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor0.1 year 2004 month11 day 15 language R __ James HoltmanWhat is the problem you are trying to solve? Executive Technical Consultant -- Office of Technology, Convergys [EMAIL PROTECTED] +1 (513) 723-2929 -- NOTICE: The information contained in this electronic mail ...{{dropped}} __ [EMAIL PROTECTED] 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] Multiv. NR
Do you know if R has any multiv. Newton-Raphson routine implemented? __ [EMAIL PROTECTED] 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] switching to Linux, suggestions?
Have you tried Qunatian? http://dirk.eddelbuettel.com/quantian.html Not only does it have R 2.0.1, but it's got a whole bunch of other programs already installed, including emacs, TeX, kile, and many more apps. It's debian and based on clusterKnoppix. You can run it live or install it to hard drive. - Mohamed -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Thomas W Volscho Sent: 12 December 2004 15:24 To: [EMAIL PROTECTED] Subject: [R] switching to Linux, suggestions? Dear List, I have acquired a new desktop and wanted to put a free OS on it. I am trying Fedora Core 1, but not sure what the best Linux OS is for using R 2.0.1? Thank you in advance for your input, Tom Volscho Thomas W. Volscho Graduate Student Dept. of Sociology U-2068 University of Connecticut Storrs, CT 06269 Phone: (860) 486-3882 http://vm.uconn.edu/~twv1 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] 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] Parallel computing in Splus?
On Dec 11, 2004, at 9:42 AM, Lun Li wrote: Does anyone know if there is any function or package provides parallel computing in splus? Consider using R and take a look at the SNOW package. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: [R-sig-finance] dates and times on Windows for fMetrics
# Here is the solution: require(fBasics) # Be sure that R is running in time zone GMT. # Set your Windows environment variable to GMT # Your PC Windows clock can still run in any other time zone! # My clock is now running in Zurich in Europe. Date= c(2003-10-09, 2003-10-10, 2003-10-13, 2003-10-14) Open = c(1.27, 1.25, 1.27, 1.29) High = c(1.28, 1.28, 1.29, 1.29) Low= c(1.25, 1.25, 1.27, 1.27) Close = c(1.25, 1.27, 1.28, 1.27) Volume = c(152810, 111338, 243843, 180211) Data= data.frame(Open, High, Low, Close, Volume) # In which time zone are your data recorded? zone = Australia/Sydney # At what local time have your data been recorded? # Say, 16:00:00 local time Australia/Sydney when the exchange closes? Time = 16:00:00 # At which Financial Center you like to use your Data? FinCenter = Australia/Sydney # Make a timeSeries Object: sydney.ts = timeSeries( data = Data, charvec = paste(Date, Time), units = c(Open, High, Low, Close, Volume), zone = Australia/Sydney, FinCenter = Australia/Sydney) sydney.ts # You should get: # Open High Low Close Volume # 2003-10-09 16:00:00 1.27 1.28 1.25 1.25 152810 # 2003-10-10 16:00:00 1.25 1.28 1.25 1.27 111338 # 2003-10-13 16:00:00 1.27 1.29 1.27 1.28 243843 # 2003-10-14 16:00:00 1.29 1.29 1.27 1.27 180211 # Now, you are living at your FinCenter in Adelaide, # but the data were recorded in the time zone of Sydney: adelaide.ts = timeSeries( data = Data, charvec = paste(Date, Time), units = c(Open, High, Low, Close, Volume), zone = Australia/Sydney, FinCenter = Australia/Adelaide) adelaide.ts # Or, you are living in Melbourne: melbourne.ts = timeSeries( data = Data, charvec = paste(Date, Time), units = c(Open, High, Low, Close, Volume), zone = Australia/Sydney, FinCenter = Australia/Melbourne) melbourne.ts # Why does it fail for Perth? # Have a look on the tail of the DST rules for Sydney: tail(Sydney()) # You get: # Sydney offSet # 123 2028-03-25 16:00:00 36000 # 124 2028-10-28 16:00:00 39600 # 125 2029-03-24 16:00:00 36000 # 126 2029-10-27 16:00:00 39600 # 127 2030-03-30 16:00:00 36000 # 128 2030-10-26 16:00:00 39600 # Now for Perth: tail(Perth()) # You get: # Perth offSet # 8 1974-10-26 18:00:00 32400 # 9 1975-03-01 18:00:00 28800 # 10 1983-10-29 18:00:00 32400 # 11 1984-03-03 18:00:00 28800 # 12 1991-11-16 18:00:00 32400 # 13 1992-02-29 18:00:00 28800 # OOPS ... # The DST rules are missing after 1992. # A quick repair: # Let's assume that the DST dates are the same as for Sydney: # and the offset 2 hours (120 Minutes) earlier: rm(Perth) PERTH - Perth Perth = function() { Perth = paste(substring(as.character(Sydney()[52:128,1]), 1, 10), 18:00:00) offSet = Sydney()[52:128,2] - 2*60*60 rbind(PERTH(), data.frame(Perth, offSet)) } # Try the complete Perth(): Perth() perth.ts = timeSeries( data = Data, charvec = paste(Date, Time), units = c(Open, High, Low, Close, Volume), zone = Australia/Sydney, FinCenter = Australia/Perth) perth.ts # You get: # Open High Low Close Volume # 2003-10-09 14:00:00 1.27 1.28 1.25 1.25 152810 # 2003-10-10 14:00:00 1.25 1.28 1.25 1.27 111338 # 2003-10-13 14:00:00 1.27 1.29 1.27 1.28 243843 # 2003-10-14 14:00:00 1.29 1.29 1.27 1.27 180211 # Is that right, there are 2 hours difference from Perth to Sydney? # Note there are some other FinCenters which are not up to date. # The list will be checked and updated with the next version of Rmetrics. # Regards # Diethelm Wuertz Tom Mulholland wrote: First things first R R version 2.0.1, 2004-11-15 OS.type windows GUI Rgui I thought that I had the time and date stuff nearly under control. I don't get the ubiquitous GMT warning although I'm not sure that the way I have done it is correct. I use a batch file to invoke R set TZ=GMT rgui.exe I have a dataset that I use called tempdata str(tempdata) `data.frame': 300 obs. of 7 variables: $ date : chr 2003/10/09 2003/10/10 2003/10/13 2003/10/14 ... $ Open : num 1.27 1.25 1.27 1.29 1.27 1.28 1.32 1.35 1.35 1.34 ... $ High : num 1.28 1.28 1.29 1.29 1.29 1.31 1.35 1.37 1.37 1.34 ... $ Low : num 1.25 1.25 1.27 1.27 1.27 1.28 1.31 1.32 1.33 1.32 ... $ Close: num 1.25 1.27 1.28 1.27 1.28 1.31 1.35 1.35 1.34 1.33 ... $ Volume : int 152810 111338 243843 180211 159147 386021 270289 690343 574630 314740 ... $ dateposix:`POSIXct', format: chr 2003-10-09 2003-10-10 2003-10-13 2003-10-14 ... I use the POSIXct in my own home-made plots. In playing with Fmetrics I naturaly wanted to create a time series This works ts = timeSeries(tempdata[,2:6], charvec = tempdata[,1],format = %Y/%m/%d,FinCenter = Australia/Sydney) Although if I set myFinCenter to Australia/Perth it fails. (See below for structure) while ts = timeSeries(tempdata[,2:6], charvec = tempdata[,1],format = %Y/%m/%d,FinCenter = Australia/Perth) fails with Error in if (timeTest == 0)
[R] Re: [R-sig-finance] dates and times on Windows for fMetrics
Diethelm Wuertz wrote: ... # OOPS ... # The DST rules are missing after 1992. ... We don't have daylight saving anymore,(the running joke here is that it fades the curtains too quickly) and it's been that way for at least a decade. So I don't think there are any missing rules. I'm just on my way out to work so I'll fully digest the message once I get home. Thanks. Tom __ [EMAIL PROTECTED] 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] switching to Linux, suggestions?
I have both desktop and laptop with Fedora core 3. R 2.0.1 are working well on all PCs. There is a problem with Fedora core 3 on HP nx500 laptop. The display resolution is 1024x768 according to HP's description. However, during the installation, there were only two options on display resolution 800x600 640x480. I tried various ways, but can't set it to 1024x768. any one have fix for this. Yuandan On Sun, 12 Dec 2004 15:23:40 -0500 Thomas W Volscho [EMAIL PROTECTED] wrote: Dear List, I have acquired a new desktop and wanted to put a free OS on it. I am trying Fedora Core 1, but not sure what the best Linux OS is for using R 2.0.1? Thank you in advance for your input, Tom Volscho Thomas W. Volscho Graduate Student Dept. of Sociology U-2068 University of Connecticut Storrs, CT 06269 Phone: (860) 486-3882 http://vm.uconn.edu/~twv1 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: [R-sig-finance] dates and times on Windows for fMetrics
Thanks for this information. I will take care about DST in Australia for the next Rmetrics release. Thanks Diethelm Tom Mulholland wrote: Diethelm Wuertz wrote: ... # OOPS ... # The DST rules are missing after 1992. ... We don't have daylight saving anymore,(the running joke here is that it fades the curtains too quickly) and it's been that way for at least a decade. So I don't think there are any missing rules. I'm just on my way out to work so I'll fully digest the message once I get home. Thanks. Tom __ [EMAIL PROTECTED] 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] about vsn
Hello sir: As to the variance stabilization method which is applied in the vsnpackage under R environment,here's a question about the ratio of the 2 channels: After applying vsn,we can get new_cy5 and new_cy3 intensity according to the original cy5 and cy3 intensity respectively. And the new_cy5 new_cy3 are similar with ln(intensity). But how can I calculate the ratio=cy5/cy3 ? If the new_cy5 and new_cy3 is log2(intensity),the ratio equals to 2^(log2cy5-log2cy3),but as to vsn,how to get the ratio? Since the vsn transformation is similar to ln transformation when the intensity is high, I wanna know how high the intensity is so that I can use ln instead of vsn? Thanks a lot! my best regards! __ [EMAIL PROTECTED] 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] AIC, glm, lognormal distribution
I'm attempting to do model selection with AIC, using a glm and a lognormal distribution, but: fit1-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian(link=log)) ## gives the same result as either of the following: fit1-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian) fit1-lm(BA~Year,data=pdat.sp1.65.04) fit1 #Coefficients: #(Intercept) Year2004 #-1.6341 -0.2741 #Degrees of Freedom: 84 Total (i.e. Null); 83 Residual #Null Deviance: 1.521 #Residual Deviance: 1.476AIC: -97.31 fit1-glm(BA~Year,data=pdat.sp1.65.04, family=quasi(link=log)) # also gives the same result but returns AIC: NA ## Is it possible to model a lognormal distribution without having to transform ## the data themselves? (i.e.: fit1-lm(log(BA)~Year,data=pdat.sp1.65.04) Thanks in advance, Ben Osborne -- Botany Department University of Vermont 109 Carrigan Drive Burlington, VT 05405 [EMAIL PROTECTED] phone: 802-656-0297 fax: 802-656-0440 __ [EMAIL PROTECTED] 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] AIC, glm, lognormal distribution
Benjamin, A couple of points: fit - glm(y ~ x, gaussian(link = log)) does NOT fit a model with a lognormal response distribution. It fits a non-linear regression model with an ordinary gaussian response distribution. This model has constant variance, whereas the lognormal model (which you would fit by transforming the response) has constant coefficient of variation. You would transform the response for two reasons, namely it should linearize the relationship between (transformed) response and predictors AND it should change a constant CV into homoscedasticity, or constant variance. This latter property as important as the first, usually. You should not think of a glm with log link as a kind of handy alternative to a log-transformed regression as they are in reality very different models. Second point: you claim that the calls fitA - glm(y ~ x, gaussian(link = log)) fitB - glm(y ~ x, gaussian) fitC - lm(y ~ x) give identical results. This is NOT true for me on R 2.0.1 (Windows), so you may care to check that, (although fitB and fitC are fully equivalent, of course). When you sort out the model you really need to use, you may find stepAIC in the MASS library useful as one tool for model selection, or at least for steps towards that generally rather complex goal. Bill Venables. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin M. Osborne Sent: Monday, 13 December 2004 12:40 PM To: [EMAIL PROTECTED] Subject: [R] AIC, glm, lognormal distribution I'm attempting to do model selection with AIC, using a glm and a lognormal distribution, but: fit1-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian(link=log)) ## gives the same result as either of the following: fit1-glm(BA~Year,data=pdat.sp1.65.04, family=gaussian) fit1-lm(BA~Year,data=pdat.sp1.65.04) fit1 #Coefficients: #(Intercept) Year2004 #-1.6341 -0.2741 #Degrees of Freedom: 84 Total (i.e. Null); 83 Residual #Null Deviance: 1.521 #Residual Deviance: 1.476AIC: -97.31 fit1-glm(BA~Year,data=pdat.sp1.65.04, family=quasi(link=log)) # also gives the same result but returns AIC: NA ## Is it possible to model a lognormal distribution without having to transform ## the data themselves? (i.e.: fit1-lm(log(BA)~Year,data=pdat.sp1.65.04) Thanks in advance, Ben Osborne -- Botany Department University of Vermont 109 Carrigan Drive Burlington, VT 05405 [EMAIL PROTECTED] phone: 802-656-0297 fax: 802-656-0440 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] 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] correlations
__ [EMAIL PROTECTED] 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] MailMonitor Alert
Scanner: MMSMTP2.0 Problem description: Scanning message headers: Body part: 1 [] SAV sweep results: Body part: 2 [Part-2.zip] SAV sweep results: A virus was detected. Virus found: W32/Netsky-Z Virus found: W32/Netsky-Z condition: virus infection action taken: disinfect condition: virus disinfection failed action taken: delete attachment __ [EMAIL PROTECTED] 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] makeARIMA() for SARIMA models
I am carrying out my project titulation in Models of state space and Kalman filtering. I was commended to carry out the applications in R, what implies that I am beginner in him. I have not had big problems, the program is very flexible. I modeled a time of serie with a SARIMA (3,1,2) (1,1,2) and I am very good. The problem is now to apply Kalman, specifically with KalmanLike (), KalmanForecast (), KalmanSmooth(), KalmanRun(). For I use it before makeARIMA () but I don't understand and i don't know to include the seasonal coefficients. Then take the nuisance of writing him to request their help. In fact I want to know if I can include the seasonal part with the intruction makeARIMA () and as making it, so that this I surrender the representation in the space of the states and I can to use Kalman. Thank's __ [EMAIL PROTECTED] 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] switching to Linux, suggestions?
Hi, recently, i installed Gentoo in addition to SuSE on my Laptop. In order to see whether it was worth the effort, i did a small benchmark for R under SuSE and Gentoo. I guess, that the benchmarks under SuSE are also approximately valid for other binary distributions. As a consequence, depending on your Unix/Linux experience, i would recommend Gentoo for optimal performance. If you are new to Linux and want to avoid the relatively complicated Gentoo setup, i recommend that you should least compile R from source, which should be easy also for a Linux newbie. The benchmark (see below for the script) consisted of i) Generating random normals and plotting density plots. ii) Cox model iii) Inverting random 200x200 matrices. I used different versions of R, since 2.0.1 is not yet included in the Gentoo portage tree. Here are my results: A) SuSE 9.2, R 2.0.1 (from i586 rpm): benchmark cpu.user cpu.system 1benchmark.density 222.22 6.76 11 benchmark.survival 133.69 0.27 12 benchmark.linearalgebra 365.25 3.64 B) R 1.9.0 compiled under SuSE 9.2, without additional CFLAGS (i.e. using CFLAGS from the configure script): benchmark cpu.user cpu.system 1benchmark.density 217.31 6.12 11 benchmark.survival 101.77 0.14 12 benchmark.linearalgebra 165.49 3.34 C) R 1.9.0 compiled under SuSE 9.2, using the same CFLAGS as in Gentoo (see below for my CFLAGS): benchmark cpu.user cpu.system 1benchmark.density 199.16 5.96 11 benchmark.survival94.26 0.15 12 benchmark.linearalgebra 159.17 4.93 D) R 1.9.0-r1 under Gentoo, using the CFLAGS for the whole system, not just for R. benchmark cpu.user cpu.system 1benchmark.density 176.08 6.10 11 benchmark.survival84.20 0.14 12 benchmark.linearalgebra 134.72 6.54 My CFLAGS (for a centrino) are: CFLAGS=-pipe -O3 -march=pentium4 -mmmx -msse -msse2 -mfpmath=sse,387 -maccumulate-outgoing-args -mno-align-stringops -fomit-frame-pointer -ffast-math -fsched-spec-load -fprefetch-loop-arrays -ftracer -fmove-all-movables Question to the Gurus: Would it be allowed, to use -funsafe-math-optimizations? Here is my benchmark script: -- require(survival) benchmark.density - function() { for (i in 1:1000) { x - rnorm(10) plot(density(x), type=l, xlim=c(-10,10), main=i) } } benchmark.survival - function() { for (i in 1:1000) { time - c(rexp(800, 1), rexp(800, 0.8), rexp(800, 0.9), rexp(800, 0.7), rexp(800, 0.5)) time - round(time, digits=2) # introduce ties event - as.integer(time = 1) time[time 1] - 1 group - c(rep(0, 800), rep(1, 800), rep(2, 800), rep(3, 800), rep(4, 800)) plot(survfit(Surv(time,event) ~ group), xlim=c(0,1)) title(main=i) dummy - coxph(Surv(time,event) ~ group) } } benchmark.linearalgebra - function() { for (i in 1:1000) { A - matrix(rnorm(200*200), nrow=200, ncol=200) AI - solve(A) residual - A %*% AI - diag(1, 200) hist(residual, main=i) } } my.benchmark - function(func) { funcname - (as.character(sys.call()[[2]])) cat(funcname, \n) times - system.time(func()) return(data.frame(benchmark=funcname, cpu.user=times[1], cpu.system=times[2])) } result - my.benchmark(benchmark.density) result - rbind(result, my.benchmark(benchmark.survival)) result - rbind(result, my.benchmark(benchmark.linearalgebra)) sink(benchmark.out) cat(Sys.info(), \n) print(result) sink() -- Christian Dear List, I have acquired a new desktop and wanted to put a free OS on it. I am trying Fedora Core 1, but not sure what the best Linux OS is for using R 2.0.1? Thank you in advance for your input, Tom Volscho Thomas W. Volscho Graduate Student Dept. of Sociology U-2068 University of Connecticut Storrs, CT 06269 Phone: (860) 486-3882 http://vm.uconn.edu/~twv1 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] 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] errors when trying to rename data frame columns
bogdan romocea br44114 at yahoo.com writes: : : Dear R users, : : I need to rename the columns of a series of data frames. The names of : the data frames and those of the columns need to be pulled from some : vectors. I tried a couple of things but only got errors. What am I : missing? : : #---create data frame : dframes - c(a,b,c) : assign(dframes[2],data.frame(11:20,21:30)) : : #---rename the columns : cols - c(one,two) : df - data.frame(11:20, 21:30) names(df) - cols assign(dframes[2], df) At the expense of some complexity you can do it all in one assign like this: assign(dframes[2], as.data.frame( mapply({, cols, list(11:20, 21:30), SIMPLIFY = FALSE) )) Another possibility is to paste together, as a character string, the names- statement and then parse and eval it: assign(dframes[2], data.frame(11:20, 21:30)) eval(parse(text = paste(names(, ) - cols, sep = dframes[2]))) : names(get(dframes[2])) - cols : Error: couldn't find function get- : assign(dframes[2],data.frame(cols[1]=11:20,cols[2]=21:30)) : Error: syntax error : labels(get(dframes[2]))[[2]] - cols : Error: couldn't find function labels- : : I'm using R 2.0.0 on Windows XP. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html