Background:
qcauchy(p, location, scale)
is an built-in base R function. In this function, "location" indicates the center and "scale" indicates the speadoutness of a symmetric bell-like curve (just like a normal distribution). "location" can be any number (negative, positive, non-integer etc.). And "scale" can be any number larger than "0". Also, "p" is probability thus 0 <= p <= 1.
Coding Question:
Only as 1 example, suppose I know qcauchy(p = c(.025, .975), location = x, scale = y ) = c(-12.7062, 12.7062 )
, THEN, is there a way I can find out what x and y could reasonably be (i.e., within some margin of error)?
P.S.: As a small possible start, can nlm()
(i.e., non-linear minimazation) help here? Or the fact the most right-hand side [i.e., c(-12.7062, 12.7062 )
], are the same number with opposite signs.
I used a package for solving a system of nonlinear equations nleqslv
.
I tried the following
library(nleqslv)
f <- function(x) {
y <- c(-12.7062, 12.7062) - qcauchy(c(.025,.975), location=x[1], scale=x[2])
y
}
nleqslv(c(1,1), f)
and got this answer
$x
[1] 5.773160e-15 9.999996e-01
$fvec
[1] 1.421085e-14 -1.421085e-14
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1 1
$nfcnt
[1] 1
$njcnt
[1] 1
$iter
[1] 1