1 | logreg.plot(x, y, MLE = FALSE, ROB = TRUE, xlab = "X", ylab = "P(X)")
|
x |
|
y |
|
MLE |
|
ROB |
|
xlab |
|
ylab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, y, MLE = FALSE, ROB = TRUE, xlab = "X", ylab = "P(X)")
{
if (is.matrix(x))
x = x[, 1]
xord = order(x)
xx = x[xord]
yy = y[xord]
est1 = logreg(xx, yy)[1:2, 1]
plot(xx, yy, xlab = xlab, ylab = ylab)
phat = exp(est1[1] + est1[2] * xx)/(1 + exp(est1[1] + est1[2] *
xx))
if (MLE)
lines(xx, phat)
if (ROB) {
est2 = wlogreg(xx, yy)$coef[1:2]
phat2 = exp(est2[1] + est2[2] * xx)/(1 + exp(est2[1] +
est2[2] * xx))
lines(xx, phat2, lty = 2)
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.