student_trnd Function

function student_trnd(dof) result(ans)

Arguments

Type IntentOptional Attributes Name
real(kind=8) :: dof

Return Value real(kind=8)


Calls

proc~~student_trnd~~CallsGraph proc~student_trnd student_trnd chi_squarernd chi_squarernd proc~student_trnd->chi_squarernd normalrnd normalrnd proc~student_trnd->normalrnd

Source Code

function student_trnd(dof) result(ans)
  real(8) :: ans,dof,y1,y2
  if (dof <= 0.d0) then
     write(*,*) "STUDENT_TRND: Degrees of freedom must be positive"
  end if
  !
  ! ## See Seminumerical Algorithms by Knuth
  y1 = normalrnd(0d0,1d0)
  y2 = chi_squarernd(dof)
  ans= y1 / (y2 / dof)**0.5d0
  !
end function student_trnd