The R Project SVN R

Rev

Rev 68948 | Rev 82561 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68948 Rev 74363
Line 121... Line 121...
121
 
121
 
122
## the density of the square of a t_m is 2*dt(x, m)/(2*x)
122
## the density of the square of a t_m is 2*dt(x, m)/(2*x)
123
# check this is the same as the density of F_{1,m}
123
# check this is the same as the density of F_{1,m}
124
all.equal(df(x^2, 1, 5), dt(x, 5)/x)
124
all.equal(df(x^2, 1, 5), dt(x, 5)/x)
125
 
125
 
126
## Identity:  qf(2*p - 1, 1, df)) == qt(p, df)^2)  for  p >= 1/2
126
## Identity:  qf(2*p - 1, 1, df) == qt(p, df)^2  for  p >= 1/2
127
p <- seq(1/2, .99, length = 50); df <- 10
127
p <- seq(1/2, .99, length = 50); df <- 10
128
rel.err <- function(x, y) ifelse(x == y, 0, abs(x-y)/mean(abs(c(x,y))))
128
rel.err <- function(x, y) ifelse(x == y, 0, abs(x-y)/mean(abs(c(x,y))))
129
\donttest{quantile(rel.err(qf(2*p - 1, df1 = 1, df2 = df), qt(p, df)^2), .90)  # ~= 7e-9}
129
\donttest{quantile(rel.err(qf(2*p - 1, df1 = 1, df2 = df), qt(p, df)^2), .90)  # ~= 7e-9}
130
}
130
}
131
\keyword{distribution}
131
\keyword{distribution}