Re: [R] Problem with outer()

2010-09-22 Thread Christofer Bogaso
Thanks Petr for your input. As you correctly said to make the function vectorize, I have done it and it is working fine: > fff=Vectorize(function(x,y) { +AA <- sign(x) +BB <- sign(y) +CC <- abs(y) +DD1

[R] Problem with outer()

2010-09-22 Thread Christofer Bogaso
Dear all, I have following piece of codes: xx <- seq(-2,2, length.out=11) mat1 <- cbind(rep(43, 5), rnorm(5)) mat2 <- cbind(rep(53, 5), rnorm(5)) outer(c(1,-1), xx, function(x,y) { AA <- sign(x) BB <- sign(y) CC <- abs(y)

Re: [R] problem with outer

2010-09-09 Thread Joshua Wiley
On Wed, Sep 8, 2010 at 3:03 PM, Joshua Wiley wrote: > I got into the habit of starting a > new R session and testing the code I was going to email, before hand. > It helps to notice missing variables, libraries that need to be > loaded, etc. It was rightly pointed out to me that the correct term

Re: [R] problem with outer

2010-09-09 Thread tuggi
hello, i don not really understand what you me, sorry. can you describe what you mean. tuggi -- View this message in context: http://r.789695.n4.nabble.com/problem-with-outer-tp2532074p2533259.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] problem with outer

2010-09-09 Thread Peng, C
Can you set the multinomial prob. to zero for p1+p2+p3 != 1 if you have to use the multinomial distribution in guete(). Otherwise, I would say the problem/guete() itself is problematic. -- View this message in context: http://r.789695.n4.nabble.com/problem-with-outer-tp2532074p2533050.html Sent

Re: [R] problem with outer

2010-09-09 Thread tuggi
thank you for your answers, but my problem is that i want plot the function guete for the variables p_11 and p_12 between zero and one. that means that i also want to plot p_11=0.7 and p_12=0.3. but with a=0.4 and b=0.6 and p_11=seq(0,a,0.05*a) and p_12=seq(0,b,0.0*b) i cannot do that. i hope you

Re: [R] problem with outer

2010-09-08 Thread David Winsemius
On Sep 8, 2010, at 6:59 PM, tuggi wrote: hello, tank you very very much. it solves my first problem. i hope you can help me also with the second problem. it was like this. p_11=seq(0,1,0.1) p_12=seq(0,1,0.1) then i get also this error message: Error in rmultinom(n - q + 1, size = 1, prob

Re: [R] problem with outer

2010-09-08 Thread Peng, C
The defintion of the sequency of probability was wrong! > p_11=seq(0,1,0.1) > p_12=seq(0,1,0.1) Since your multinomial distribution requires P_11, P_12, P13=1-P_11-P12 be greater than or equal to zero and P_11+P_12+P_13 = 1. In your above definition of P_11[6] =P_12[6]= 0.6, P_11[7] = P_12[7] =

Re: [R] problem with outer

2010-09-08 Thread tuggi
hello, i hope anyone can help me until tomorow, because i must give me bachelor theses on friday the prof. thanks tuggi -- View this message in context: http://r.789695.n4.nabble.com/problem-with-outer-tp2532074p2532262.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] problem with outer

2010-09-08 Thread tuggi
hello, tank you very very much. it solves my first problem. i hope you can help me also with the second problem. it was like this. p_11=seq(0,1,0.1) p_12=seq(0,1,0.1) then i get also this error message: Error in rmultinom(n - q + 1, size = 1, prob = rbind(p_11, p_12, (1 - : non-positive

Re: [R] problem with outer

2010-09-08 Thread Joshua Wiley
Great, that helps. With all those variables, your function worked for me. I did slightly edit it for testing, mostly just adding spaces to make it easier for me to read. N <- 10; q <- 8; k <- q-2; L <- 5; n <- 2 * k + L + 1 p_0 <- c(0.2, 0.4, 0.4) f_1 <- qf(0.05, 2, 2) f_2 <- qf(0.95, 2, 2) p_1

Re: [R] problem with outer

2010-09-08 Thread Phil Spector
Does outer(p_11,p_12,Vectorize(guete)) do what you want? - Phil Spector Statistical Computing Facility Department of Statistics UC

Re: [R] problem with outer

2010-09-08 Thread tuggi
hello, thank you for your answer. here the parameter N=10 q=8 k=q-2 L=5 n=2*k+L+1 p_0=c(0.2,0.4,0.4) f_1=qf(0.05,2,2) f_2=qf(0.95,2,2) tuggi -- View this message in context: http://r.789695.n4.nabble.com/problem-with-outer-tp2532074p2532132.html Sent from the

Re: [R] problem with outer

2010-09-08 Thread Joshua Wiley
On Wed, Sep 8, 2010 at 2:33 PM, tuggi wrote: > > Hello, > > i wrote this function guete and now i want to plot it: but i get this error > message. i hope someone can help me. > > Error in dim(robj) <- c(dX, dY) : >  dims [product 16] do not match the length of object [1] > > p_11=seq(0,0.3,0.1) >

[R] problem with outer

2010-09-08 Thread tuggi
Hello, i wrote this function guete and now i want to plot it: but i get this error message. i hope someone can help me. Error in dim(robj) <- c(dX, dY) : dims [product 16] do not match the length of object [1] p_11=seq(0,0.3,0.1) p_12=seq(0.1,0.4,0.1) guete = function(p_11,p_12) { set.seed(