Your line does show up, but the x values start at ~6 and the y values are
incredibly small, so it is masked by the y=0 line. You probably have to check
your calculations!
--- Dimitri Liakhovitski schrieb am Mo,
24.5.2010:
> Von: Dimitri Liakhovitski
> Betreff: [R] adding one line to
Thanks a lot, Peter, that's exactly what I was looking for:
plot(density(tstat),xlim=c(-5,8),ylim=c(0,.4),lwd=2,col='red')
z <- tstat[order(tstat)]
lines(z,dt(z,df=18),col='blue')
legend(4,.3,c("exact","t(18)"),lwd=c(2,1),col=c('red','blue'))
Dimitri
On Mon, May 24, 2010 at 1:26 PM, Peter Ehler
On 2010-05-24 10:50, Dimitri Liakhovitski wrote:
Hello!
I am running a very simple mini Monte-Carlo below using the function
tstatistic (right below this sentence):
tstatistic = function(x,y){
m=length(x)
n=length(y)
sp=sqrt( ((m-1)*sd(x)^2 + (n-1)*sd(y)^2)/(m+n-2) )
Hello!
I am running a very simple mini Monte-Carlo below using the function
tstatistic (right below this sentence):
tstatistic = function(x,y){
m=length(x)
n=length(y)
sp=sqrt( ((m-1)*sd(x)^2 + (n-1)*sd(y)^2)/(m+n-2) )
t=(mean(x)-mean(y))/(sp*sqrt(1/m+1/n))
4 matches
Mail list logo