x=c(1.2, 3.0, 2.2, 4.0, 2.5, 3.0)
y=c(3,4.2,4,6,7,5.9)
calculatePhat(x,y)
# $test.stat
# [1] 6.381249
# $phat
# [1] 0.9305556
# $dhat
# [1] 0.8611111
# $sig.level
# [1] 0.0001191725
# $s.e.
# [1] 0.06747199
# $ci.p
# [1] 0.7783001 1.0000000
# $df
# [1] 9.148489
# Another example:
z=c(1,2,3,4)
y=c(5,6,7,8)
calculatePhat(z,y)
# $test.stat
# [1] 10.6066
# $phat
# [1] 1
# $dhat
# [1] 1
# $sig.level
# [1] 4.135921e-05
# $s.e.
# [1] 0.04419417
# $ci.p
# [1] 0.8918608 1.0000000
# $df
# [1] 6
Run the code above in your browser using DataLab