Re: [R] the function doesn´t work

2010-09-26 Thread Joshua Wiley
As long as p <= 1, the minimum value of H will be log(m). Here are some more (I think clearer) graphs. They show the basic function p[,i] * log(p[,i] (the log function defaults to natural logarithm), for values ranging from 0 to 1. Then include log(m) for different values of m. I included the c

Re: [R] the function doesn´t work

2010-09-26 Thread jethi
wow thnx a lot josh. so now i understand the most of the things. so my power function is depent on the number of the blocks "m". how u said, if i take m=0.8 or lower i get a different value than a 1. ofcourse a number between 0 or 1. but i can just take positive interger number for m, because m r

Re: [R] the function doesn´t work

2010-09-26 Thread Joshua Wiley
Hi Jethi, Please look at this code, and the graph that is created in the code. This all leads me to suspect you are trying to use the wrong formula at the end. Since there was some confusion with it, I just removed the stuff with apply(). Josh ## I moved stu

Re: [R] the function doesn´t work

2010-09-26 Thread jethi
hi josh, and really thnx again. i have now 2 problems . the first one ist if i take ur idea and programm like u: N = 10 n = 100 m = 2 k = n/m l = matrix(0,nrow=m,ncol=N) p=matrix(0,nrow=m,ncol=N) alpha = 0.05 q_1 <- qnorm(alpha, 0, 0.05) q_2 <- qnorm(1 -alpha, 0, 0.05) for(i in 1:N){ x=rnorm(

Re: [R] the function doesn´t work

2010-09-26 Thread Joshua Wiley
On Sun, Sep 26, 2010 at 3:16 PM, jethi wrote: > > thnx again. now i understand my big problem. ok so now a want to watch the > probabilities p, which are do this for example > p[1,1]=cor(x1,y1)/(cor(x1,y1)+..+cor(xm,ym)). > > > so > N = 10 > n = 100 > m = 2 > k = n/m > l = matrix(0,nrow=m,ncol=N)

Re: [R] the function doesn´t work

2010-09-26 Thread jethi
thnx again. now i understand my big problem. ok so now a want to watch the probabilities p, which are do this for example p[1,1]=cor(x1,y1)/(cor(x1,y1)+..+cor(xm,ym)). so N = 10 n = 100 m = 2 k = n/m l = matrix(0,nrow=m,ncol=N) p=matrix(0,nrow=m,ncol=N) for(i in 1:N){ x=rnorm(n,0,0.5) y=rn

Re: [R] the function doesn´t work

2010-09-26 Thread Joshua Wiley
Hi, You are correct that you do not know what the correlations are from exactly. I tried to make up some examples to show you why. ## Your Code N = 10 n = 100 m = 5 k = n/m l = matrix(0,nrow=m,ncol=N) for(i in 1:N){ for(j in 1:m){ x=rnorm(n,0

Re: [R] the function doesn´t work

2010-09-26 Thread jethi
thanks a lot for ur patience and understandig, josh. ok perhaps it would be help me to change my programm by step by step. the first important thing of my programm is to caluculate the correlation of each block of a radom variable. so i have a n bivariate random sample wich i saperate in m block

Re: [R] the function doesn´t work

2010-09-26 Thread Joshua Wiley
Dear Kaja, I've read quite a few of your emails and spent some time trying to understand what you want, and so have a lot of other people. I know this must be very frustrating for you especially because you have a deadline soon. I have noticed that in your emails, your explanations of what you a

Re: [R] the function doesn´t work

2010-09-26 Thread jethi
i´m really sorry, once again. ok i will try to explain what i have to programm. i want to programm a powerfunction. i have to research if the correlations in a bivariate random sample are homogeneous. for that i saperate the random sample in m blocks and calculate the correlation of each block(p

Re: [R] the function doesn´t work

2010-09-26 Thread Mario Valle
It is not a problem of not knowing R. It is a problem of reasoning. if you use m1 and not assign to it a value beforehand it is difficult your function works. And this will happen in any language, not only R. Maybe explaining what you are trying to do helps. To do this try to add comments (sta

Re: [R] the function doesn´t work

2010-09-26 Thread Bill.Venables
about what you are doing. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jethi Sent: Sunday, 26 September 2010 5:29 PM To: r-help@r-project.org Subject: Re: [R] the function doesn´t work hi, sorry but i can´t remove the

Re: [R] the function doesn´t work

2010-09-26 Thread jethi
hi, sorry but i can´t remove the problem.but i change the programm a little bit. i didn´t work with r programm before, so its really hard for me to find my problems. :) N=5 n=100 p_0=c(1/5,1-1/5) power = function(k1) { set.seed(1000) H=matrix(0,nrow=N,ncol=1) for(i in 1:N) { x <- matrix(r

Re: [R] the function doesn´t work

2010-09-26 Thread Mario Valle
The message is clear. Just resove this problem before posting a terribly general and so not useful "it does not work". Best mario > f=outer(p,m,Vectorize(power)) Error in outer(p, m, Vectorize(power)) : object 'p' not found > persp(p,m,power,theta=-50,phi=30,d=4,border="blac

[R] the function doesn´t work

2010-09-25 Thread jethi
hey, my function doesn´t work. can somebody help me? the graphic doesn´t work and also the function. thnx a lot. N=10 n=100 p_0=c(1/5,1-1/5) power = function(p,m) { set.seed(1000) H=matrix(0,nrow=N,ncol=1) for(i in 1:N) { x <- matrix(rnorm(n, 0, 0.5), ncol = m) y <- matrix(rnorm(n, 0, 0.8), n