[R] Warning - Naive Question Alert
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Sat Aug 26 21:16:30 CEST 2000
"Marc R. Feldesman" <feldesmanm at pdx.edu> writes:
> With that as background and assuming that the data really are normal, is
> there any way in R (or any of the S engines) to generate a data set that
> mimics exactly the summary properties reported in a published paper? I
> know I can use rnorm() and mvrnorm() for this, but neither function will
> necessarily or very likely return a sample that has the *same* properties
> as the given population. At best, I can sift though replicates until I
> find the one closest to the "original". This approach doesn't seem very
> efficient or valid. Is there another way to do this?
I've been using the following for a case where data were given in the
form of means and sd:
fake.trypsin<-local({
xrnorm<-function(n,xbar,s){
t<-rnorm(n);t<-(t-mean(t))/sd(t);xbar+s*t}
g.1<-xrnorm(32,128,50.9)
g.2<-xrnorm(137,152,58.5)
g.3<-xrnorm(38,194,49.3)
g.4<-xrnorm(44,207,66.3)
g.5<-xrnorm(16,215,60)
g.6<-xrnorm(4,218,14)
trypsin<-c(g.1,g.2,g.3,g.4,g.5,g.6)
grp<-rep(1:6,c(32,137,38,44,16,4))
grpf<-factor(grp)
data.frame(trypsin,grp,grpf)})
The xrnorm function would seem to be something like what you're
getting at?
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list