各位大侠,小妹刚刚接触R的,别人给了我一个函数,可是不知道怎么用。可否烦请大家指点一下。先谢谢了哦 :-P推荐一下R的入门教材也可以。
它说按下面的方法使,可是我完全 不懂。5555555555555555
To illustrate and check the above code,the following command may be executed at the R prompt:
pars = get.vaTer(.802,.112,.723)
Typing“pars”at the R prompt will then display the following:
函数为:
get.vaTer = function(Pc,VRT,MRT,s=0.1)
{
s2=s^2
#The default value for the scaling parameter s equals 0.1
if(Pc == 0)
cat(“Oops,Pc == 0!\n”)
if(Pc == 0.5)
cat(“Oops,Pc ==.5!\n”)
if(Pc == 1)
cat(“Oops,Pc == 1!\n”)
#If Pc equals 0,.5,or 1,the method will not work,and
#an edge correction is required.
L = qlogis(Pc)
#The function“qlogis”calculates the logit.
x = L*(L*Pc^2-L*Pc + Pc-.5)/VRT
v = sign(Pc-.5)*s*x^(1/4)
#This gives drift rate.
a = s2*qlogis(Pc)/v
#This gives boundary separation.
y =-v*a/s2
MDT =(a/(2*v))*(1-exp(y))/(1+exp(y))
Ter = MRT-MDT
#This gives nondecision time.
return(list(v,a,Ter))
}


雷达卡


京公网安备 11010802022788号







