Re: [R] Inverse of many small matrices

2015-04-02 Thread Feng Li
On 04/02/2015 10:40 PM, Duncan Murdoch wrote: On 02/04/2015 9:31 AM, Feng Li wrote: Dear all, I am working with a likelihood function that requires the inverse of many small covariance matrices for multivariate normal densities. When the sample size is large, this calculation is really heavy

[R] Inverse of many small matrices

2015-04-02 Thread Feng Li
to vectorize them. Can anyone give me a hint to speed this up? Thanks in advance! Feng -- Feng Li, Ph.D. School of Statistics and Mathematics Central University of Finance and Economics 100081 Beijing, China http://feng.li/ __ R-help@r-project.org mailing

[R] Use BatchJobs package to submit Rmpi job

2015-03-19 Thread Feng Li
/opt/openlava/bin/openmpi-mpirun -np 1 R CMD BATCH %= rscript % Please let us know your comments, Thanks, Feng Li Teraproc Inc. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

[R] The three-dot question

2013-01-14 Thread Feng Li
) + } + } myTask - function(a) + { + b - 3 + testFun(a, b = b) + } myTask(FALSE) Error in print(b) : object 'b' not found Thanks in advance! Feng -- Feng Li Department of Statistics Stockholm University SE-106 91 Stockholm, Sweden http://feng.li/ __ R

Re: [R] The three-dot question

2013-01-14 Thread Feng Li
On Mon, Jan 14, 2013 at 10:21 AM, Feng Li m...@feng.li wrote: Dear all, Why does not the three-dot accept arguments from the parent environment? I am just confused with this error, can someone give me a hint? rm(list=ls()) testFun - function

Re: [R] The three-dot question

2013-01-14 Thread Feng Li
- function(x, ...) { cat(g: exists('x') = , exists(x), \n); list(...) } f - function(...) { cat(f: exists('x') = , exists(x), \n); g(...) } f(x = 3, y = 4) f: exists('x') = FALSE g: exists('x') = TRUE $y On Mon, Jan 14, 2013 at 5:21 AM, Feng Li m...@feng.li wrote: Dear

Re: [R] #!/usr/bin/env Rscript --vanilla ??

2012-04-13 Thread Feng Li
variations on the theme, using quotes in different places, but have not succeeded till now. Any suggestions? Martin Maechler, ETH Zurich -- Feng Li Department of Statistics Stockholm University SE-106 91 Stockholm, Sweden http://feng.li/ __ R-help@r

Re: [R] #!/usr/bin/env Rscript --vanilla ??

2012-04-13 Thread Feng Li
variations on the theme, using quotes in different places, but have not succeeded till now. Any suggestions? Martin Maechler, ETH Zurich -- Feng Li Department of Statistics Stockholm University SE-106 91 Stockholm, Sweden http://feng.li/ __ R-help@r

[R] ess-tracebug to open a file

2012-03-13 Thread Feng Li
Best regards, Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] While loop working with TRUE/FALSE?

2012-02-01 Thread Feng Li
. If there is no element of z equal to r the loop will run forever (with the correct condition of course). A much better way of doing what you seem to be wanting is which(z == r) or possibly any(z == r) Berend -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li

[R] PDF help for linux

2011-04-19 Thread Feng Li
] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.13.0 -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ __ R-help@r-project.org mailing

[R] R gui problem for windows

2011-03-23 Thread Feng Li
especially when they are running time consuming simulations. What do you think? Best, Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted]] __ R-help@r

Re: [R] R gui problem for windows

2011-03-23 Thread Feng Li
concern. Have a good day! Feng On Wed, Mar 23, 2011 at 11:30 AM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On Wed, 23 Mar 2011, Feng Li wrote: Dear R, I rare use the standard R-gui on Windows. Yesterday I tried the latest stable release on Windows 7 and XP and found one thing interesting

[R] Singularity problem

2011-03-16 Thread Feng Li
is computationally singular: reciprocal condition number = 1e-17 Thanks in advance! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Singularity problem

2011-03-16 Thread Feng Li
of the message by you is prohibited. -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

[R] Wired behavior of a 2-by-2 matrix indicies

2011-02-26 Thread Feng Li
reproduce this for both 32bit windows and 64bit linux with R 2.12.1 and some earlier versions. Can someone tell me whether this a bug or a feature or something I don't know? Thanks! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li

Re: [R] Weird behavior of a 2-by-2 matrix indicies

2011-02-26 Thread Feng Li
is just a vector with dimensions attributed in R. I know I can convert them to a vector but I did not do it anyway. Thanks for this information! Feng On Sat, Feb 26, 2011 at 6:29 PM, Sarah Goslee sarah.gos...@gmail.comwrote: Hello, On Sat, Feb 26, 2011 at 12:11 PM, Feng Li m...@feng.li wrote

Re: [R] kmeans: number of cluster centres must lie between 1 and nrow(x)

2011-02-02 Thread Feng Li
here, but why would you want to create as many clusters as there are observations? Won't the outcome just be one observation in each cluster? -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted

[R] kmeans: number of cluster centres must lie between 1 and nrow(x)

2011-02-01 Thread Feng Li
2.12 allows number of clusters to be one. So I guess allowing number of clusters to be nrow(x) should be also possible in the future release? Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted

Re: [R] Sparse matrix multiplication

2011-01-30 Thread Feng Li
Thanks Martin. That is exactly what I want. Feng On Sat, Jan 29, 2011 at 11:59 PM, Martin Maechler maech...@stat.math.ethz.ch wrote: FL == Feng Li m...@feng.li on Sat, 29 Jan 2011 19:46:48 +0100 writes: FL I meant sparse matrix, sorry for the typo. aha.. :-) FL On Sat, Jan

[R] Spare matrix multiplication

2011-01-29 Thread Feng Li
-- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Spare matrix multiplication

2011-01-29 Thread Feng Li
I meant sparse matrix, sorry for the typo. Feng On Sat, Jan 29, 2011 at 7:02 PM, Feng Li m...@feng.li wrote: Dear R, I have a simple question concerning with a special case of sparse matrix multiplications. Say A is a 200-by-1 dense matrix. B is a 1-by-1 block- diagonal matrix

[R] Convert a matrix's columns to list

2011-01-18 Thread Feng Li
like this b - list(a[, 1], a[, 2]) b [[1]] [1] 1 2 3 4 5 [[2]] [1] 6 7 8 9 10 Thanks in advance! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted

Re: [R] How to disable using enter key to exit the browser in debugging mode

2011-01-13 Thread Feng Li
the StatEt plug-in for Eclipse. Of course, using a new IDE is a big undertaking, but I can assure you: it's worth it! This is just one small benefit. On Wed, Jan 12, 2011 at 4:00 PM, Feng Li m...@feng.li wrote: Dear R, How can I disable using enter key to exit the browser() in debug mode? I

Re: [R] How to disable using enter key to exit the browser in debugging mode

2011-01-13 Thread Feng Li
have never encountered this. But if you wish you could submit this as a 'wishlist' request to R-bugs, and if enough users support it (and especially if someone submits a high-quality patch to do this), it might be added in a future release. On Wed, 12 Jan 2011, Feng Li wrote: Dear R

[R] How to disable using enter key to exit the browser in debugging mode

2011-01-12 Thread Feng Li
this line ## test - function() { x- 5 browser() y-4 } test() end of copy at this line Any suggestions are most welcome! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative

Re: [R] lapply to subsets

2010-10-13 Thread Feng Li
Yes, that is what I what... Thanks. Feng On Wed, Oct 13, 2010 at 6:38 AM, Michael Bedward michael.bedw...@gmail.comwrote: Hello Feng, I think you just want this... lapply(A, function(x) apply(x[,,-c(1,2)], c(1,2), mean)) Michael On 13 October 2010 04:00, Feng Li feng...@stat.su.se

[R] lapply to subsets

2010-10-12 Thread Feng Li
the above task but take away some burn-in, e.g. do not take A$a[,,1:2],and A$b[,,1:2] into account. How can I do then? Thanks! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted

Re: [R] Intel i7 utilization

2010-10-05 Thread Feng Li
core 2 CPU which works well. But I haven't tried with i7 CPU. Feng On 10/05/2010 12:42 PM, Costas wrote: Hello, Is there a way to force through R the amount of the cpu's cores (or the cpu's utilization level) used under Windows 7 or Linux? Thanks, Costas -- Feng Li Department

[R] boundary check

2010-09-24 Thread Feng Li
to manage it when the dimension is large. Can someone give a hint? Thanks in advance! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted]] __ R-help@r

Re: [R] boundary check

2010-09-24 Thread Feng Li
offline; I'll summarize) HTH rksh On 24/09/10 10:44, Feng Li wrote: Dear R, I have a covariates matrix with 10 observations,  e.g. X - matrix(rnorm(50), 10, 5) X              [,1]        [,2]        [,3]        [,4]       [,5]  [1,]  0.24857135  0.30880745 -1.44118657

[R] How to generate a particular sequence ?

2010-09-13 Thread Feng Li
! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] How to generate a particular sequence ?

2010-09-13 Thread Feng Li
Sorry. It was my typo. Should be three times as it in the example. Feng On Mon, Sep 13, 2010 at 11:32 AM, Jim Lemon j...@bitwrit.com.au wrote: On 09/13/2010 07:19 PM, Feng Li wrote: Dear R, I have a vector, say a = c(1,2,4,5,6,8). Can I generate a vector or array (2-by-3-by-3

Re: [R] How to generate a particular sequence ?

2010-09-13 Thread Feng Li
Thanks. That's what I want. Sorry for the typo:) Feng On Mon, Sep 13, 2010 at 11:42 AM, Ted Harding ted.hard...@manchester.ac.ukwrote: On 13-Sep-10 09:19:21, Feng Li wrote: Dear R, I have a vector, say a = c(1,2,4,5,6,8). Can I generate a vector or array (2-by-3-by-3) of this form c

[R] a^c(1:3)

2010-09-07 Thread Feng Li
like this, a^c(2, 3, 4) [,1] [,2] [,3] [1,]1 81 125 [2,]8 16 1296 BTW, I have a 64bit R version (2.11) for Linux. Any advice would be appreciated. Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative

Re: [R] a^c(1:3)

2010-09-07 Thread Feng Li
Very fruitful, thanks all of you:) Feng [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and

[R] Speed up sparse matrices

2010-03-08 Thread Feng Li
in advance. Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] R-package related to the topic of INARMA models

2010-01-05 Thread Feng Li
Dear R, I am looking for R-package related to INARMA (Integer-valued ARMA). Can anyone give me some information? I did not get information from task view. Many thanks. Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li

[R] rm(list-ls()) error

2009-11-05 Thread Feng Li
Dear R, Why rm(list-ls()) gives an error but rm(list=ls()) not? I remember the operator ‘-’ can be used anywhere... Thanks! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted

[R] rm(list-ls()) error

2009-11-05 Thread Feng Li
Dear R, Why rm(list-ls()) gives an error but rm(list=ls()) not?. I remember the operator ‘-’ can be used anywhere... Thanks! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted

[R] How to handle large numbers?

2009-02-11 Thread Feng Li
the following command: exp(1000)/(exp(1007)+5) [1] NaN I am pretty sure this should be close to zero. My question is whether there is a general way to solve this kind of question or should I do some settings before computing? Thanks in advance! Feng -- Feng Li Department of Statistics Stockholm

Re: [R] How to handle large numbers?

2009-02-11 Thread Feng Li
(1000))/(exp(as.brob(1007))+5)) [1] 0.000911882 Feng Li wrote: Dear R, I have two questions: 1, Why both R and Matlab give 0*Inf==NaN? To my knowledge, it should be zero mathematically. Am I right? 2, I need to calculate e.g. exp(a)/(exp(b)+c), where both a and b are very large numbers

Re: [R] How to handle large numbers?

2009-02-11 Thread Feng Li
Thanks for your explanation. Now I am quite clear about that. On Wed, Feb 11, 2009 at 12:05 PM, Thomas Lumley tlum...@u.washington.eduwrote: On Wed, 11 Feb 2009, Feng Li wrote: 1, Why both R and Matlab give 0*Inf==NaN? To my knowledge, it should be zero mathematically. Am I right

[R] Passing data among multiple instances

2009-02-04 Thread Feng Li
Dear R, I have two R instances running at the same time, say instance A and instance B. Is there a simpler way to pass the data in A to B? More precise, I have a stupid example: In instance A, I am running a function test1 test1 - function (x1) { x2 - sin(x1) return(x2) } In

Re: [R] Passing data among multiple instances

2009-02-04 Thread Feng Li
Very very fruitful. Now I only do the experiment on my single computer with a Quad CPU and more than 2 G ram. Let me have a try first. Feng On Wed, Feb 4, 2009 at 4:02 PM, Warren Young war...@etr-usa.com wrote: Feng Li wrote: I have two R instances running at the same time, On the same

Re: [R] Passing data among multiple instances

2009-02-04 Thread Feng Li
. But wait till someone else responds because I'm not an expeRt and someone else might say something more useful or different. In instance B, another function test2 test2 - function (x2) { x3 - cos(x2) return(x3) } On Wed, Feb 4, 2009 at 9:08 AM, Feng Li wrote

Re: [R] Passing data among multiple instances

2009-02-04 Thread Feng Li
On Wed, Feb 4, 2009 at 4:02 PM, Warren Young war...@etr-usa.com wrote: Feng Li wrote: I have two R instances running at the same time, On the same computer, or on different computers? The first trial is only on my single computer with Quad CPU and more than 2G mem. Is the number