[R] define matrix by outer?

2005-05-26 Thread Zhen Pang
Dear all, I'd like to define a k by k matrix where the element is defined by mn-function(m,n) sum(choose(m,(m-0:m))*choose((k-m),(n-m+0:m))) the mn function works fine for scalar m and n, however, it fails to define the matrix by outer. a-outer(1:k,1:k,mn) gives error message: Error in

RE: [R] local average

2005-04-20 Thread Zhen Pang
a-sapply(1:100,function(x)mean(Y[Xx Xx-1])) b-sapply(1:100,function(x)median(Y[Xx Xx-1])) From: Jens Hainmueller [EMAIL PROTECTED] To: R-Help r-help@stat.math.ethz.ch Subject: [R] local average Date: Wed, 20 Apr 2005 23:43:41 -0400 Hello, probably this isn't hard, but I can't get R to do this.

RE: [R] Boxplot by factors

2005-02-02 Thread Zhen Pang
boxplot(force ~ cellnumber) From: [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] Boxplot by factors Date: Wed, 2 Feb 2005 14:29:49 -0600 Dear all, I have the following data format cellnumberforce 1 100 1 230 1 100 1 200

Re: [R] sapply and loop

2004-10-19 Thread Zhen Pang
() storm.boot - boot(rs, storm.bf, R = 4999) # pretty slow Rprof(NULL) summaryRprof() Error in summaryRprof() : no events were recorded Zhen From: Prof Brian Ripley [EMAIL PROTECTED] To: Zhen Pang [EMAIL PROTECTED] CC: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [R] sapply and loop Date: Tue

RE: Question on Rprof(); was: Re: [R] sapply and loop

2004-10-19 Thread Zhen Pang
The situation is the same even if I specify the directory to the D drive,where I have the full read/write permissions. Anyway, I do success in my own laptops. Thanks. Yours, Zhen From: Uwe Ligges [EMAIL PROTECTED] To: Zhen Pang [EMAIL PROTECTED] CC: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL

Re: [R] sapply and loop

2004-10-18 Thread Zhen Pang
(boot.out) storm.boot - boot(rs, storm.bf, R = 4999) # pretty slow Rprof(NULL) summaryRprof() Error in summaryRprof() : no events were recorded I am using R1.8.1 in windows. Why can't I get the results? Zhen From: Thomas Lumley [EMAIL PROTECTED] To: Zhen Pang [EMAIL PROTECTED] CC: [EMAIL

RE: [R] sapply and loop

2004-10-16 Thread Zhen Pang
PROTECTED] To: 'Zhen Pang' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [R] sapply and loop Date: Sat, 16 Oct 2004 08:23:54 -0400 Without seeing what myfunction is, it's almost impossible to tell. In addition to system.time(), you might want to profile your code. e.g., Rprof() zz - sapply(ma

[R] sapply and loop

2004-10-15 Thread Zhen Pang
Dear all, I am doing 200 times simulation. For each time, I generate a matrix and define some function on this matrix to get a 6 dimension vector as my results. As the loop should be slow, I generate 200 matrice first, and save them into a list named ma, then I define zz-sapply(ma, myfunction)

Re: Vectorising and loop (was Re: [R] optim alog-likelihood function)

2004-09-30 Thread Zhen Pang
ok. You just simulate a 200 by 3 matrix z, all positive integers. The first column is i, the second column is j, and the third column is in fact the frequency of (i,j) combination, you can set the third column to be 1 for simplification. Notice that ij, and k=max of the second column. theta is

Re: Vectorising and loop (was Re: [R] optim alog-likelihoodfunction)

2004-09-30 Thread Zhen Pang
Mr. Grothendieck does suggest me to paste the data here. I just show a small one here. I must metion that I made a mistake in my former email. The first column should be j and is greater than the second column. I have corrected ll. z is the matrix below 2 1 3 3 1 1 3 3 1 5 2 4 k-max(z[,1]) ll

Re: Vectorising and loop (was Re: [R] optim alog-likelihoodfunction)

2004-09-30 Thread Zhen Pang
(UTC) Zhen Pang nusbj at hotmail.com writes: : : Mr. Grothendieck does suggest me to paste the data here. I just show a small : one here. I must metion that I made a mistake in my former email. The first : column should be j and is greater than the second column. I have corrected : ll. : : z

Re: [R] optim a log-likelihood function

2004-09-29 Thread Zhen Pang
From: Sundar Dorai-Raj [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Christian Schulz [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [R] optim a log-likelihood function Date: Wed, 29 Sep 2004 10:41:45 -0700 Christian Schulz wrote: Hello, i know that i have to use optim, but i'm

RE: Vectorising and loop (was Re: [R] optim a log-likelihood function)

2004-09-29 Thread Zhen Pang
From: Sundar Dorai-Raj [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Zhen Pang [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Vectorising and loop (was Re: [R] optim a log-likelihood function) Date: Wed, 29 Sep 2004 18:21:17 -0700 Zhen Pang wrote: I also use optim, however, for my case

[R] iterative proportional fitting

2003-12-18 Thread Zhen Pang
Dear all, I wonder if there are some function or package in R which can do the iterative proportional fitting. In the exponential model f(y1,...yn)=exp(a'yi+b'(yi*yj)+.+c'(y1*...*yn)+constance), instead of the canonical parameters, I use maginal probability instead of a and log odds

Re: [R] Where is rmutil package?

2003-10-29 Thread Zhen Pang
http://alpha.luc.ac.be/~jlindsey/rcode.html From: Peter Flom [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R] Where is rmutil package? Date: Wed, 29 Oct 2003 10:49:10 -0500 Pursing my earlier question, when I tried loading Lindsey's gnlm, I got a message Loading required package: rmutil

Re: [R] run R under linux

2003-10-22 Thread Zhen Pang
Thank you for your help. But try() seems to only allow for an expression. My simulation have serveral expressions which possibly have problem. Is there any possibility to include them all in the try()? If not, I seem to use several try(). From: Jason Turner [EMAIL PROTECTED] To: Zhen Pang

Re: [R] run R under linux

2003-10-21 Thread Zhen Pang
[EMAIL PROTECTED] To: Zhen Pang [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [R] run R under linux Date: Tue, 21 Oct 2003 22:17:59 +1300 Zhen Pang wrote: I want to do 200 simulations. I found during the fisrt 128 simulations, some parameters may be NAs, since I use if (abs(aold-anew)1e-5) {print

[R] command line limit under unix?

2003-10-09 Thread Zhen Pang
Dear all, I have made my testing program to run successfully under unix in the background. However, my simulation work does not work. I read the foo.results file, I found it only have part of my code and not any output I want. Is there any line limit? My code is nearly 400 line. I can cut some

[R] run R under unix

2003-10-08 Thread Zhen Pang
Dear I used to use R under windows. I always save my code in a txt file. When I want to run something, I just copy and paste to the windows. I recently need to do a big simulation work which will cost 5 or 6 days. I am afraid the memory of windows can not cope with this situation. I now want