<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>RWebFriend 插件测试博客</title>
	<link>http://wiki.qixianglu.cn</link>
	<description>奇想录支持的实验平台</description>
	<pubDate>Fri, 12 Jun 2009 09:07:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>Rweb demo for base::source(&#8230;)</title>
		<link>http://wiki.qixianglu.cn/sourceusage/</link>
		<comments>http://wiki.qixianglu.cn/sourceusage/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 21:12:49 +0000</pubDate>
		<dc:creator>lixiaoxu</dc:creator>
		
		<category><![CDATA[基础统计]]></category>

		<category><![CDATA[CI]]></category>

		<category><![CDATA[ncp]]></category>

		<guid isPermaLink="false">http://wiki.qixianglu.cn/sourceusage/</guid>
		<description><![CDATA[The original blog article is "Confidence interval of R-square", but, which one?
Its R codes require package MBESS to calculate the confidence interval of  for multiple regression, but visitors can't install packages on Rweb. The function source(...) of package base is the substitution. A source code file MBESS.ciR2.R including relevant functions in pacakge MBESS is [...]]]></description>
			<content:encoded><![CDATA[<p>The original blog article is <a href="http://lixiaoxu.lxxm.com/ci-of-r2/">"Confidence interval of R-square", but, which one?</a></p>
<p>Its R codes require package <a href="http://cran.r-project.org/web/packages/MBESS/index.html">MBESS</a> to calculate the confidence interval of <img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Crho%5E2" class="tex" alt="\rho^2" /> for multiple regression, but visitors can't install packages on Rweb. The function source(...) of package base is the substitution. A source code file <a href="http://ihome.cuhk.edu.hk/~s043115/data/MBESS.ciR2.R">MBESS.ciR2.R</a> including relevant functions in pacakge MBESS is uploaded online.</p>
<p><FORM target=_blank method=post action="http://pbil.univ-lyon1.fr/cgi-bin/Rweb/Rweb.cgi"><br />
<input type=submit value="看结果" >
<input type=reset value="重置" ><BR/><textarea wrap=off cols=""  style="width: 100%;"  rows="15"  name="Rcode">
R2&lt;-.68;    ###### Observed R-square            ######
N &lt;- 150;   ###### Sample size                  ######
p &lt;- 1;     ## Number of IV(s) other than intercept ##
conf.level=.95; ##  Confidence level            ######
## Only when p=1 , CI of R^2 can be calculated. ######
######################################################
##Input R-squared, Sample Size, number of IV(s),   ###
## and  confidence level                           ###
######################################################
## Usually you need not change the following codes ###
######################################################
## Output CIs of \eta^2, \rho^2, vs. R^2           ###
######################################################
##
source("http://ihome.cuhk.edu.hk/~s043115/data/MBESS.ciR2.R");
## substitute "require(MBESS)";
##
###############################
ci.eta2&lt;-c((ci&lt;-ci.R2(conf.level=conf.level,
R2=R2, N=N, p=p,
Random.Predictors=FALSE))$Lower.Conf.Limit.R2
,ci$Upper.Conf.Limit.R2);
ci.rho2&lt;-c((ci&lt;- ci.R2(conf.level=conf.level,
R2=R2, N=N, p=p,
Random.Predictors=TRUE))$Lower.Conf.Limit.R2
,ci$Upper.Conf.Limit.R2);
ci.R2 &lt;- c((
max(0,
tanh(
atanh(sqrt(R2)) -
sqrt(2/(N-3))*qnorm(0.5+conf.level/2)
)
)
)^2 ,(
tanh(
atanh(sqrt(R2)) +
sqrt(2/(N-3))*qnorm(0.5+conf.level/2)
)
)^2);
(ci.R2);
if(p&gt;1) ci.R2[] &lt;- NA;
ci3&lt;-data.frame(c(ci.eta2,ci.rho2,ci.R2)
,rep(c(' eta2',' rho2','Replicated R2'),each=2)
,c(rep(c('Lower','Upper'),3)));
names(ci3)&lt;-c('CI','Type','Direction');
cat('&lt;','h2&gt;&lt;','font color=blue&gt;',sep='');
tapply(ci3$CI,list(ci3$Type,ci3$Direction),mean);
cat('&lt;','/font&gt;&lt;','/h2&gt;',sep='');
##to plot CI bars with boxplot
## let Q1,Q2,Q3 = R2 and Q0,Q4 as CI bounds
ci3.R2&lt;-ci3;ci3.R2$CI[]&lt;-R2;
plot(CI~Type,range=0,
data=rbind(ci3,ci3.R2,ci3.R2),xlab='',
ylab=paste(conf.level,'CI'),
main=paste('R2=',round(R2,4),', N=',N,'\n',p,' predictor(s) other than intercept'),
xlim=c(0,4),ylim=c(0,1));
abline(h=R2);
</textarea><br />
<input type=submit value="看结果" >
<input type=reset value="重置" ></FORM><BR/></p>
<p class="akst_link"><a href="http://wiki.qixianglu.cn/?p=5&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_5" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://wiki.qixianglu.cn/sourceusage/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RMSEA中统计效力和最小样本量的计算</title>
		<link>http://wiki.qixianglu.cn/rmseazhongtongjixiaolihezuixiaoyangbenliangdejisuan/</link>
		<comments>http://wiki.qixianglu.cn/rmseazhongtongjixiaolihezuixiaoyangbenliangdejisuan/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 13:43:12 +0000</pubDate>
		<dc:creator>lichongliang</dc:creator>
		
		<category><![CDATA[多元统计]]></category>

		<guid isPermaLink="false">http://wiki.qixianglu.cn/rmseazhongtongjixiaolihezuixiaoyangbenliangdejisuan/</guid>
		<description><![CDATA[RMSEA是Steiger &#38; Lind(1980, June)提出、Browne &#38; Cudeck(1993)总结的结构方程模型拟合优度的检验量。因为误差的存在，研究者不可能找到与总体完全拟合的简约模型，但是研究者却可以找到一个近似总体的模型。RMSEA就可检验研究者所提出的模型究竟可以被认为拟合总体到什么程度。
RMSEA统计量可由结构方程报告的卡方值计算出

其对应的总体与的ncp参数关系为
 
这意味着RMSEA的总...<p>......</p>]]></description>
			<content:encoded><![CDATA[<p><em>RMSEA</em>是Steiger &amp; Lind(1980, June)提出、Browne &amp; Cudeck(1993)总结的结构方程模型拟合优度的检验量。因为误差的存在，研究者不可能找到与总体完全拟合的简约模型，但是研究者却可以找到一个近似总体的模型。<em>RMSEA</em>就可检验研究者所提出的模型究竟可以被认为拟合总体到什么程度。</p>
<p><em>RMSEA</em>统计量可由结构方程报告的卡方值计算出</p>
<p align="center"><img src="http://www.forkosh.dreamhost.com/mimetex.cgi?RMSEA%3D%5Csqrt%7B%5Cfrac%7Bmax%28%5Cchi%5E2-df%2C0%29%7D%7Bdf%5Ccdot%28N-1%29%7D%7D" class="tex" alt="RMSEA=\sqrt{\frac{max(\chi^2-df,0)}{df\cdot(N-1)}}" /></p>
<p align="left">其对应的总体<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Ctilde%7BRMSEA%7D" class="tex" alt="\tilde{RMSEA}" />与<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Cchi%5E2" class="tex" alt="\chi^2" />的<em>ncp</em>参数关系为</p>
<p align="center"> <img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Ctilde%7BRMSEA%7D%3D%5Csqrt%7B%5Cfrac%7Bncp%7D%7Bdf%5Ccdot%28N-1%29%7D%7D" class="tex" alt="\tilde{RMSEA}=\sqrt{\frac{ncp}{df\cdot(N-1)}}" /></p>
<p align="left">这意味着RMSEA的总体值可在样本收集之后由模型报告的<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Cchi%5E2" class="tex" alt="\chi^2" /><a href="http://mars.wiwi.hu-berlin.de/mediawiki/slides/index.php/Comparison_of_noncentral_and_central_distributions#Confidence_interval_of_standardized_effect_size_by_noncentral_parameters">得到基于<em>ncp</em>的置信区间</a>。</p>
<p>有研究者建议(MacCallum, Browne, &amp; Sugawara, 1996)，当RMSEA在0.05以下，表示模型拟合紧密(close fit)，0.05-0.08间表示拟合程度颇可接受(fair fit)，0.08到0.1间表示拟合得比较一般(mediocre fit)，高于0.1表示拟合程度差(poor fit).。通过RESEA推测统计效力和最小样本量对样本量的权衡有重要的价值，通过<a href="http://www.people.ku.edu/~preacher/rmsea/rmsea.htm">Preacher &amp; Coffman (2006) 的在线Rweb工具</a>可以直接进行统计效力和最小样本量的计算。这个工具目前只提供单点的计算，在实际研究中，研究者更希望看到一个范围内统计效力如何随样本量变化。下面就是对Preach &amp; Coffman代码的简单改写，使其通过Rweb平台作出样本量从少一半到多一倍范围内统计效力的变化图，代码如下。使用者只需按自己设定的数值按注解替换代码中的数值，点击submit即可。<br />
<FORM target=_blank method=post action="http://pbil.univ-lyon1.fr/cgi-bin/Rweb/Rweb.cgi"><br />
<input type=submit value="看结果" >
<input type=reset value="重置" ><BR/><textarea wrap=off cols=""  style="width: 100%;"  rows="15"  name="Rcode">
alpha &lt;- 0.05 #一类错误率
d &lt;- 25 #模型自由度
n &lt;- 300 #预设样本量
rmsea0 &lt;- 0.05 #RMSEA的虚无假设
rmseaa &lt;- 0.01 # RMSEA确信的真实值
##
#####以上数值适合所有用户根据研究改变#####
#####以下代码只适合有经验的用户改进#######
## 代码按GPL派生授权引用自 ###############
## http://www.people.ku.edu/~preacher/  ##
##########################################
##
n0 &lt;- n; n&lt;-round(n/2):(2*n);##此行由 Li,Li,&amp; Wu(2008)加入
ncp0 &lt;- (n-1)*d*rmsea0^2
ncpa &lt;- (n-1)*d*rmseaa^2
#计算统计效力
if(rmsea0&lt;rmseaa) {
cval &lt;- qchisq(alpha,d,ncp=ncp0,lower.tail=F)
pow &lt;- pchisq(cval,d,ncp=ncpa,lower.tail=F)
}
if(rmsea0&gt;rmseaa) {
cval &lt;- qchisq(1-alpha,d,ncp=ncp0,lower.tail=F)
pow &lt;- 1-pchisq(cval,d,ncp=ncpa,lower.tail=F)
}
## 代码按GPL派生授权引用自
## http://www.people.ku.edu/~preacher/
##以下图形命令由 Li,Li,&amp; Wu (2008)加入####
plot(n,pow,pch='o',col='grey',ylim=c(0,1));
abline(v=n0);
</textarea><br />
<input type=submit value="看结果" >
<input type=reset value="重置" ></FORM><BR/></p>
<p class="akst_link"><a href="http://wiki.qixianglu.cn/?p=4&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_4" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://wiki.qixianglu.cn/rmseazhongtongjixiaolihezuixiaoyangbenliangdejisuan/feed/</wfw:commentRss>
		</item>
		<item>
		<title>独立两组等样本t检验，已知Effect Size，求样本量与Power关系</title>
		<link>http://wiki.qixianglu.cn/rwebfriendttest/</link>
		<comments>http://wiki.qixianglu.cn/rwebfriendttest/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 02:46:31 +0000</pubDate>
		<dc:creator>lixiaoxu</dc:creator>
		
		<category><![CDATA[基础统计]]></category>

		<category><![CDATA[t检验]]></category>

		<guid isPermaLink="false">http://wiki.qixianglu.cn/2008/duliliangzudengyangbentjianyanyizhieffectsizeqiuyangbenliangyupowerguanxi/</guid>
		<description><![CDATA[心理统计中，独立同方差两组等样本量正态分布的t检验实验设计许多时候不关心两组之间绝对的差值，只关心用共同的组内标准差标准化之后的差值。因为许多心理量表的得分在标准化之前意义并不明确，不比物理中的研究量有可公度的大小尺度。成为心理统计研究者典型的关注值，学名Cohen's ，是标准化的Effect Size，其点估计为。M、SD是心理统计中样本均值与样本标准差的...<p>......</p>]]></description>
			<content:encoded><![CDATA[<p>心理统计中，独立同方差两组等样本量正态分布的<em>t</em>检验实验设计许多时候不关心两组之间绝对的差值，只关心用共同的组内标准差标准化之后的差值。因为许多心理量表的得分在标准化之前意义并不明确，不比物理中的研究量有可公度的大小尺度。<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Cfrac%7B%5Cmu_2-%5Cmu_1%7D%7B%5Csigma%7D" class="tex" alt="\frac{\mu_2-\mu_1}{\sigma}" />成为心理统计研究者典型的关注值，学名Cohen's <img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Ctilde%7Bd%7D" class="tex" alt="\tilde{d}" />，是标准化的Effect Size，其点估计为<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?d%3D%5Cfrac%7BM_2-M_1%7D%7BSD_%7Bwithin%7D%7D" class="tex" alt="d=\frac{M_2-M_1}{SD_{within}}" />。<em>M</em>、<em>SD</em>是心理统计中样本均值与样本标准差的缩写。</p>
<p>实际的研究问题里，虚无假设<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?H_0" class="tex" alt="H_0" />的<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Ctilde%7Bd%7D" class="tex" alt="\tilde{d}" />许多时候<font color="#ff0000">不应当取为零，应当取为应用上无意义的小效应与应用上有意义的大效应之间的阈值</font>。研究者通常通过预研究和理论研究、经验判断，对<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?%5Ctilde%7Bd%7D" class="tex" alt="\tilde{d}" />的真实值下界有一个“主观的”而确信的判断值。这个判断可能受过去的客观数据与统计研究影响，但绝不会用到当前正式验证研究的任何数据信息。研究者用这些数值可以在实验抽样之前计算出样本量与Power(正式验证研究得到显著结果的概率)的函数。研究者通常依赖这个函数决定样本量大小，直接影响研究经费的预算。</p>
<p>数学原理是， <img src="http://www.forkosh.dreamhost.com/mimetex.cgi?d%5Ctimes%5Csqrt%7Bn%2F2%7D" class="tex" alt="d\times\sqrt{n/2}" />满足<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?df%3D2n-2" class="tex" alt="df=2n-2" />、非中心参数<img src="http://www.forkosh.dreamhost.com/mimetex.cgi?ncp%3D%5Ctilde%7Bd%7D%5Ctimes%5Csqrt%7Bn%2F2%7D" class="tex" alt="ncp=\tilde{d}\times\sqrt{n/2}" />的<em>t</em>分布。在已知只可能有正效应的场合，应该做单尾检验。<font color="#ff0000">值得一提的是</font>，假如检验得到显著的结果，并不足以支持研究者先前判断的Effect Size值为正确，只能支持Effect Size值大于所设定的应用意义临界值。</p>
<p>这个帖子将给出组内样本量<em>n</em>与Power的函数关系图、及给定的<em>n</em>所对应的Power精确数值。</p>
<blockquote><p><FORM target=_blank method=post action="http://pbil.univ-lyon1.fr/cgi-bin/Rweb/Rweb.cgi"><br />
<input type=submit value="看结果" >
<input type=reset value="重置" ><BR/><textarea wrap=off cols=""  style="width: 100%;"  rows="15"  name="Rcode">
alpha= .05;
##设定的一类错误率;
d.null = .01;
##d的总体值大于这个值才有应用意义;
##虚无假设就是“即使有效应也无应用意义”;
d.drudge= .72;
##研究者在未接触正式研究数据之前
##对d总体值下界的断定;
n = 20;
##研究者想知道这个样本下的Power精确值;
##
##
######以上数值适合任何用户设定与更改####;
##
##
##
#####以下代码只适于有经验的用户改进#####;
n.c= max(2,round(n/2)):max(100,n*2);
t.critical = qt(1-alpha,df=n.c*2-2,
ncp=sqrt(n.c/2)*d.null);
power.c = 1-pt(t.critical,df=n.c*2-2,
ncp=sqrt(n.c/2)*d.drudge);
power = power.c[abs(n.c - n)&lt;.01];
##
##
##
######以下为输出、作图部分###########；
##
##
plot(n.c,power.c,col='grey',type='o',ylim=c(0,1),
xlab='sample size within each group',ylab='Power');
points(n,power.c[abs(n.c-n)&lt;.01],col='red');
paste('&lt;','HR/&gt;&lt;','H1 &gt;',
'H0:Effect Size &lt;= ',d.null,'&lt;',
'BR/&gt;Assumed Effect Size=',
d.drudge,'&lt;','BR/&gt;alpha=',
alpha,'&lt;','BR/&gt; n=',n,
', &lt;','font color=red&gt;Power=',round(power,5),
'&lt;/font&gt;&lt;','/H1&gt;',sep='');
</textarea><br />
<input type=submit value="看结果" >
<input type=reset value="重置" ></FORM><BR/></p></blockquote>
<p class="akst_link"><a href="http://wiki.qixianglu.cn/?p=3&amp;akst_action=share-this"  title="可以通过E-mail分享, 用del.icio.us、Google等网络书签收藏！" id="akst_link_3" class="akst_share_link" rel="nofollow">收藏、分享这篇文章!</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://wiki.qixianglu.cn/rwebfriendttest/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

