Re: [R] how to generate balanced sample from two normal distribution

2009-11-22 Thread gcheer3
elect the first ten. For the SAME 20 observation, I want permutation happens among the first ten and also the second ten. How can I use the same dataset (generated 20 observations) to do two kinds of permutations? Thanks a lot. gcheer3 wrote: > > Good afternoon, > > I have a quest

[R] how to generate balanced sample from two normal distribution

2009-11-22 Thread gcheer3
Good afternoon, I have a question on generating simple randomization data. Thanks for any suggestions. Two normal distribution N(0,1) and N(1,1) A: I want to generate 20 data, 10 from N(0,1) and 10 from (1,1). each observation's indicator (either is from N(0,1) or N(1,1) ) is randomized. I need

Re: [R] symbol in the plot

2009-11-20 Thread gcheer3
Thank you, David. thanks for letting me know how to use expression in legend. It works too. gcheer3 wrote: > > a graph question. Thanks a lot in advance. > > I made two scatterplots on one graph (sigma vs. delta1, sigma vs. delta2) > (20 observations of delta1, delta2 and corr

Re: [R] symbol in the plot

2009-11-20 Thread gcheer3
axes=FALSE, type='o') legend("topleft", cs,pch = c(21, 22), lty=1, col=2:1) only concern is there is a waring message in R: Warning message: In plot.xy(xy.coords(x, y), type = type, ...) : "axes" is not a graphical parameter gcheer3 wrote: > > a graph questio

Re: [R] symbol in the plot

2009-11-20 Thread gcheer3
im=range(-0.5, 2), xlab='sigma', ylab='delta', > pch=22, > type='o') > points(sigma, delta2, col='red', axes=FALSE, type='o') > legend("topleft",c("Delta1","Delta2"),fill=TRUE,col=c("black","

Re: [R] symbol in the plot

2009-11-20 Thread gcheer3
Thanks for your reply. It is very helpful. I am sorry I didn't make my queston clearer. I have two concerns about this graph. One thing is denote 'sigma' and 'delta' as greek letters, usually I use 'expression'. But I don't know how to use 'expression' in the 'legend' The other thing is, the gra

Re: [R] symbol in the plot

2009-11-19 Thread gcheer3
lta2--circle', col='red', axes=FALSE, type='o') Thanks a lot gcheer3 wrote: > > a graph question. Thanks a lot in advance. > > I made two scatterplots on one graph (sigma vs. delta1, sigma vs. delta2) > (20 observations of delta1, delta2 and corresponding

[R] symbol in the plot

2009-11-19 Thread gcheer3
a graph question. Thanks a lot in advance. I made two scatterplots on one graph (sigma vs. delta1, sigma vs. delta2) (20 observations of delta1, delta2 and corresponding sigma) the x-axis is sigma, the y-axis is either delta1 or delta2. I connected both scatterplots. To seperate them, one curves

Re: [R] is that possible to graph 4 dimention plot

2009-10-07 Thread gcheer3
sorry for y y=rnorm(20,mean= rep(th[1:2],10),sd=th[3]) th=c(0, 0.5, 1) gcheer3 wrote: > > Thanks for your reply. > > But I don't think it will really help. My problem is as follows: > > I have 20 observations > y <- rnorm(N,mean= rep(th[1:2],N/2),sd=th[3]

Re: [R] is that possible to graph 4 dimention plot

2009-10-07 Thread gcheer3
Thanks for your reply. But I don't think it will really help. My problem is as follows: I have 20 observations y <- rnorm(N,mean= rep(th[1:2],N/2),sd=th[3]) I have a loglikelihood function for 3 variables mu<-(mu1,mu2) and sig loglike <- function(mu,sig){ temp<-rep(0,length(y))

[R] is that possible to graph 4 dimention plot

2009-10-04 Thread gcheer3
Suppose there are 4 variables d is a function of a , b and c I want to know how a, b and c change will make d change It will be straightforward to see it if we can graph the d surface if d is only a function of a and b, I can use 'persp' to see the surface of d. I can easily see at what values of

[R] if else statement error

2009-10-03 Thread gcheer3
Hello, I am doing a if else statement in R. But it always comes out error such as 'unexpected symbol' There are two variables. ini and b. when ini=1, a=3; when ini>1 and b>2, a=3; all other situations, a=6. I don't know where it is wrong. Here is my code ini=3 b=4 if (ini==1) { a=3