[R] Student Distribution and Funtion qt

From: Antje Schafföner <AS-maus_at_gmx.de>
Date: Mon, 09 Jun 2008 15:14:02 +0200


 Hello,
 I am trying to calculate and plot mean and confidence intervall for a set of data. This is the code that I am currently using:

 means <- sapply(data, mean, na.rm=TRUE)  n <- sapply(data,length)
 stdev <- sqrt(sapply(data, var, na.rm=TRUE))  ciw <- qt(0.98, n) * stdev / sqrt(n)
 par(mgp=c(2,0.6,0), las=2, fin=c(7,3), mai=c(1,0.5,0.2,0.2), cex=0.8)  plotCI(x=means, uiw=ciw, ylim=c(0,100), col="red",col.axis="black",add=F)

 The code works fine, just the results are not as expected. I compared the results that R calculates for my variable ciw and noticed differences compared to other calculations. I suppose that the reason can be found in the value that qt(0.98, n) calculates.

 I compared the results of qt with the values I would expect and found out that it returns the values of the student distribution for a one-sided question (eg. qt(0.99, 10) = 2.76). Is there a way to use qt to calcute the quantiles for a two-sided problem? Or is there a different function I could use in a similar way as qt?

 Thanx, Antje  

-- 

Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 09 Jun 2008 - 13:26:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 09 Jun 2008 - 14:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive