-1

I've been trying to make a manual t test of a statistic that I calculated in r. I've seen some people recommend to use the function dt but that had not worked. I know because I'm comparing my results of R with my results in STATA (the last ones I'm sure I've got them correct). This is the code with which I'm trying to do this

pvalue<-dt(3.141523, df=8)

Where 3.141523 is my calculated t statistic and df is degrees of freedom. Thank you for your help!

  • You should include some sort of [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). What exactly is the test you ran in STATA? Was it one-sided? two-sided? paired? What did your data look like? How different are the two values you are getting? – MrFlick Sep 11 '17 at 19:34

1 Answers1

0

I think you want to use the pt() function instead of dt(). dt() is the density while pt() is the distribution.

> pt(3.141523, df = 8)
[1] 0.9931132
Andrew
  • 743
  • 6
  • 17
  • If it's a p-value it could happen that the OP wants or needs `lower.tail = FALSE`, but it's really impossible to know. – Rui Barradas Sep 11 '17 at 20:02