S*****U 发帖数: 99 | 1 谢谢你回复, 能具体一点吗, 我其实只有y值,x-axis是两个category,
但是points要求points(x, y)? 下面的code能做boxplot, 但不是点的形式
disease=rpois(10000, lambda=5)
control=rpois(10000, lambda=2)
boxplot(disease, control) |
|
S*****U 发帖数: 99 | 2 如何操作, 请用前面random sample做一个好吗?
disease=rpois(10000, lambda=5)
control=rpois(10000, lambda=2)
请不吝赐教 |
|
z**k 发帖数: 378 | 3 Err,现在人给包子太快了。。。
disease=rpois(100, lambda=5)
control=rpois(100, lambda=2)
plot(jitter(rep(1:2,times=100)), c(disease,control),
axes=F, ann=F, pch=rep(c(1,16),times=100))
abline(2,0)
box()
opar <- par(cex=2)
axis(side=1, at=1:2, labels=c("disease", "control"))
par(opar)
opar <- par(las=2)
axis(side=2)
par(opar)
mtext(side=2, text="response", line=2.5, cex=2)
mtext(side=2, text="response", line=2.5, cex=2)
我按照你那个copy的,不知道这样可不可以 |
|
C******t 发帖数: 72 | 4 There are a family of functions for this purpose in R:
rnorm for Gaussian
rexp for exponential
rgamma for gamma
rpois for Poisson
rweibull for Weibull
rcauchy for Cauchy
rt for t
rbeta, rbinom, rgeom, rhyper,......... |
|
z**********i 发帖数: 12276 | 5 还没等我明白,已经给出答案了。两个方法如下:
m.hosp <- exp( rnorm( n=1000, mean=1, sd = 1.5 ) ) # lognormal hospital
means for 1000 hospitals
n.hosp <- rpois( n=1000, lambda=m.hosp ) + 1 # number of pts per
hospital for 1000 hospitals
p <- 0.10 # probability of outcome
r.hosp <- rbinom( 1000, n.hosp, p ) # number of pts per
hospital with outcome
rate <- r.hosp / n.hosp # rate at each hospital
hist( rate, breaks=100 )
m.hosp |
|
o****o 发帖数: 8077 | 6 here is a SAS questions someone asked:
Given a symmetric matrix A (NxN), the value of each cell is some integer
number, for each row (with row ID=1 to N), he wants to count which other
rows in A contains a number equals to the row ID.
For example, for row=4, this guy wants to find out in row [-4,:], which ones
also contains a value=4 in their rows [, 1:N].
In SAS, typically you will transpose it to a vector, and output only those
rows=ID. Or you can sweep each row from diagonal term to the end a... 阅读全帖 |
|