[R] Help with a simple subroutine

Ivan Krylov
Fri, 09 Sep 2022 09:03:11 -0000

? Fri, 9 Sep 2022 16:46:00 +0800
"Steven T. Yen" <styen at ntu.edu.tw> ?????:

> I am expecting the line? t<-gamma/sgamma to produce two different
> values. But I confirm that it is doing
> tt<-gamma[1]/sgamma[1]

No, it just happens that gamma[1]/sgamma[1] is the same as
gamma[2]/sgamma[2], subject to rounding errors:

> +?? gamma<-exp(b)
> +?? vgamma<-gamma^2*v[2,2]
> +?? sgamma<-sqrt(vgamma)
> +?? t<-gamma/sgamma

t = gamma / sgamma = gamma / sqrt(gamma^2 * v[2,2])   = gamma / (abs(gamma) *
sqrt(v[2,2])) (given gamma = exp(b) > 0)
  = 1 / sqrt(v[2,2]).

--
Best regards,
Ivan