David Jones wrote: > [EMAIL PROTECTED] wrote: >> Hi All >> >> Is it possible to generate a sample that has a specific mean, SD >> (also skewness, kurtosis)? >> To be more specific, I do not want to sample from a given >> distribution (like the normal distribution) that has a specific mean >> and SD. If sampled from a normal distribution with a given mean and >> SD, of course the mean of the sample is not the exact same as the >> mean of the normal distribution. >> I try to get a sample that has a previously given mean and SD (and >> also if possible skewness and kurtosis). >> >> Does anybody know the mathematical approach to this question? And, >> does anybody know a software package that does this perhaps, or an >> algorithm to use to program my own thing? Some vague things, like >> moments, are in my head but that is perhaps not the correct path. >> Others asked, expressed it this way: Sampling from a normal >> distribution with restriction (restriction that the mean is exactly >> the given mean). >> >> Thanks Toby >> >> >> >> >> mean = (sum xi) / N >> >> variance = (sum (xi - mu) ^ 2) / N >> >> skewness = (sum (xi - mu) ^ 3) / (N sdev ^ 3) >> >> kurtosis = (sum (xi - mu) ^ 4) / (N sdev ^ 4) > > I'm not sure it can be done for multi-moments but it may work out. For > the case of fixing the mean only you have two choices (at least). > > Firstly you can recognise that the appropriate covariance matrix is > singular, work it out by theory, and plug it into some multi-variate > Normal generator, hope that it doesn't fall over because of the > singular matrix, and generate the whole vector at once. > > Otherwise you can procede one element at a time without using singular > matrices, essentially using an iterative expression for the > calculation of the mean (you may be able to use similar recursive > expressions for the k-statistics or sample moments for the more > general case). ... > Once you are part way through, you will know what mean you require
> for the values still to be generated ... write this in terms of the > next value to generate and the mean of the rest ... this gives you a > case where you want X,Y from independent Normals but X+cY=Z=fixed.... > work out the conditional distribution of X given Z and generate the > next value from this distribution. > > I think it falls out from the theory of sufficient statistics that, > for the Normal distribution, the procedure you need does not depend on > the "true" population values for the parameters but you should check > that out when developing the theory you need. Notionally (and for more > general distributions) what you are trying to do is generate a vector > from a population with given parameters but also having given sample > statistics for those parameters, which may well be different. > > David Jones ... the sufficient statistic approach may allow you to do something a little different than the above and be able to match the first two moments. In the case of the Normal distribution, this would justify generating a set of iid Normals and then shfting and rescaling them so that they have the required sample mean and sample variance. David Jones . . ================================================================= Instructions for joining and leaving this list, remarks about the problem of INAPPROPRIATE MESSAGES, and archives are available at: . http://jse.stat.ncsu.edu/ . =================================================================
