[R] question

2015-04-13 Thread Mahdiyeh Erfaniyan
Hi all, Recently I sent an email and I was asked to provide reproducible code of a simple example of my situation. Instead of providing the code, I decided to describe what I need in my code. I've written a function V, which is a function of (r,s); so I have a function V(r,s) in fact. The output of

[R] How to complete this code

2015-04-10 Thread Mahdiyeh Erfaniyan
Hi, Consider the line below: for(r in a)for (s in a) x=rbind(x,apply(replicate(1000,V(r,s)),1,mean)) V is a vector of (n-1) variables calculated by some rule and is a functions of (r,s). So the line above produces 1000 replicates of V for each (r,s), puts them in a matrix, calculates the m

[R] mixed normal distriburtion

2009-08-25 Thread mahdiyeh
I'm trying to draw the density function of a mixed normal distribution in the form of: .6*N(.4,.1)+ .4*N(.8,.1) At first I generate a random sample with size 200 by the below code: means = c(.4,.8) sds = sqrt(c(.1,.1)) ind = sample(1:2, n, replace=TRUE, prob=c(.6,.4)) x=rnorm(n,mean=means[ind],sd=s

[R] identify a bimodal distribution

2009-08-14 Thread mahdiyeh
How can I understand if a distribution is bimodal? The quantiles of desired probablities and also cumulative probablities in desired data points are provided. -- Free e-mail accounts at http://zworg.com __ R-help@r-project.org mailing list https://stat.

[R] mixed normal distriburtion

2009-08-14 Thread mahdiyeh
How I can generate a random sample from a mixed norml distribution? (i.e. a mixed normal distribution in the form f(x)=.6*N(1,5)+.4*N(2,3) in which N(A,B) is a normal distribution with mean A and variance B.) -- Free e-mail accounts at http://zworg.com

[R] sample data from density created by splines

2009-08-14 Thread mahdiyeh
How I can create some sample data from a density in the form: f(x)=sum(a(j)M(j)), in which M(j) is the B-spline basis function. In fact my density function is a linear combination of B-splines. (Is there any other way than using the well-known and general uniform distribution method?) -- Free e