ZvaluesfrommultinomPlots(clippda)
ZvaluesfrommultinomPlots()所属R语言包:clippda
A generic functon to plot Density of Z values from a simulation from a multinomial population using the balanced and unbalanced studies and a 3D representaion of the Z values
一个普通的functon Z值从从多项式人口的平衡和不平衡的研究和Z值的三维representaion模拟绘制密度
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A functon to plot Density of Z values from a simulation from a multinomial population using the balanced and unbalanced studies and a 3D representaion of the Z values. These plots are useful as visual tools for the confounding effects. The median values are indicated on these plots and these can be used as the consesus values of the effects of covariates in sample size calculations.
,一个functon Z值从从多项式人口的平衡和不平衡的研究和Z值的三维representaion模拟绘制密度。这些图都是有益的影响因子的可视化工具。中位数的值是表示对这些图,这些都可以作为样本大小的计算变项的影响consesus值。
用法----------Usage----------
ZvaluesfrommultinomPlots(nsim,nobs,proposeddesign,balanceddesign,...)
参数----------Arguments----------
参数:nsim
number of simulations to be done
做模拟
参数:nobs
number of multinomial observation
多项观察数
参数:proposeddesign
a numeric vector with four elements indicating the design weights
与四个元素指示设计重量的数字向量
参数:balanceddesign
a numeric vector with all the four elements being one, indicating equal weights
向量与所有四个元素便是一个数字,表示平等权
参数:...
other arguments
其他参数
Details
详情----------Details----------
This function generates saples from a given four cell multinomial populaton then uses the resulting multinomial probabilities in calculating the effect of covariates (Z values). Currently we implement a design arising from a proteomics study in which there is a binary confounder and a binary exposure. The cross-tabulation of the categories of these covariates results into a 4-cell multinomial categories.
此功能从一个给定的四个多项populaton单元产生去极化,然后使用多项式概率计算变项(Z值)的影响。目前我们实现了从蛋白质组学的研究中,有一个二进制的影响因子和二进制曝光产生的设计。这些类别的交叉制表协变量分为4单元的多项类别的结果。
值----------Value----------
参数:density plot
Density plot of the Z values
Z值的密度图
参数:3D plot of Z values
3D plot of the Z values against a two dimensional subspace of the 3-D space of multinomial probabilities
3D绘图的Z值对两维子空间的多项式概率的3-D空间
作者(S)----------Author(s)----------
Stephen Nyangoma
参考文献----------References----------
Billingham LJ: Sample size calculations for planning clinical proteomic profiling studies using mass spectrometry. (Working paper)
参见----------See Also----------
Also see the function f.
也看到了函数f。
举例----------Examples----------
#density plots[密度图]
nsim=10000;nobs=300;proposeddesign=c(1,2,1,7);balanceddesign=c(1,1,1,1)
f=function (x,y,z) {
Z=(1-x-z)*(x+y)/(2*(((1-x-z)*(1-x-y)*(1-y-z))-(1-x-y-z)^2))
Z
}
mul_1=rmultinom(nsim, nobs, prob = proposeddesign)/nobs
mul_1=t(mul_1)
mul_1=data.frame(mul_1)
names(mul_1)=c('x','y','z')
x=mul_1$x
y=mul_1$y
z=mul_1$z
# compute Z values (see Nyangoma et al. 2009)[计算Z值(尼昂戈马等人,2009年)]
Z=f(x,y,z)
x1=x
y1=y
z1=Z
#########################################[########################################]
##### pr=c(1,1,1,1)# balanced design[####PR = C(1,1,1,1)#平衡设计]
#########################################[########################################]
mul_2=rmultinom(nsim, nobs, prob = balanceddesign)/nobs
mul_2=t(mul_2)
mul_2=data.frame(mul_2)
names(mul_2)=c('x','y','z')
x=mul_2$x
y=mul_2$y
z=mul_2$z
Zb=f(x,y,z)
x2=x
y2=y
z2=Zb
#####################################[####################################]
#####################################[####################################]
#summary(Zb)[摘要(ZB)]
pdf('ZvaluesDensityPlots.pdf')
densityZ=density(Z,bw=0.1)
densityZb=density(Zb,bw=0.1)
plot(density(Zb,bw=0.1),xlim=c(min(c(densityZ$x,densityZb$x)),max(c(densityZ$x,densityZb$x))),
ylim=c(min(c(densityZ$y,densityZb$y)),max(c(densityZ$y,densityZb$y))),col='blue',lwd=2,lty=1,xlab='confounding effect - Z values',main='')
lines(density(Z,bw=0.1),lwd=2,xlab='',main='')
abline(v=median(Z),lty=2,col='red')
abline(v=median(Zb),lty=2,col='green')
legend(max(c(densityZ$x,densityZb$x)) - 2, max(c(densityZ$y,densityZb$y)) - 0.2, legend=c("blanced","unblanced"), col = c("blue","black"), lty = 1)
dev.off()
####################################[###################################]
####################################[###################################]
library(lattice)
library(rgl)
library(scatterplot3d)
a=c(x1,x2)
b=c(y1,y2)
Z1=c(z1,z2)
group=c(rep(1,10000),rep(2,10000))
Data=data.frame(a,b,Z=Z1,group)
Data$group=as.factor(Data$group)
Plot3D=cloud(b ~ a*Z,scales = list(arrows = FALSE), data=Data, group=group,screen = list(x = 30, y = -60),ylim=c(0,15),zlim=c(0.05,0.45),xlim=c(0,0.45))
Plot3D
nsim=10000;nobs=300;proposeddesign=c(1,2,1,7);balanceddesign=c(1,1,1,1)
ZvaluesfrommultinomPlots(nsim,nobs,proposeddesign,balanceddesign)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|