The following SPSS syntax show hows to generate a sample with any  mean 
  and sd  and then rescale to a given mean and sd.
I just tried 3 kind of random variable functions from a couple dozen or 
so that are available in SPSS

I can't think offhand how to adjust for skewness and kurtosis.
Why do you want to do this?

* generate a sample with arbitrary  mean and sd to given mean and sd.
new file.
set seed= 20030402.
input program.
loop #i = 1 to 50.
compute x1 = rnd(rv.uniform(2,4)).
compute x2 = rnd(rv.normal(2,4)).
compute x3 = rnd(rv.lnormal(2,4)).
end case.
end loop.
end file.
end input program.
* get a z-score  .
descriptives vars= x1 x2 x3
  / statistics = mean stddev kurtosis skewness
  /save.
compute y1 = 50 + (zx1*10).
compute y2 = 50 + (zx2*10).
compute y3 = 50 + (zx3*10).
descriptives vars = x1 x2 x3 y1 y2 y3 zx1 zx2 zx3
  /stats = mean stddev kurtosis skewness.

Hope this helps.

Art
[EMAIL PROTECTED]
Social Research Consultants
University Park, MD USA
(301) 864-5570


[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)

.
.
=================================================================
Instructions for joining and leaving this list, remarks about the
problem of INAPPROPRIATE MESSAGES, and archives are available at:
.                  http://jse.stat.ncsu.edu/                    .
=================================================================

Reply via email to