Displaying 3 results from an estimated 3 matches for "lgtreg".
Did you mean:
greg
2008 Sep 28
0
constrained logistic regression: Error in optim() with method = "L-BFGS-B"
...orks #
#------------------#
glm(y~x, family = binomial)$coefficients
# summary(glm(y~x, family = binomial))
#------------------#
# Method 2 - Works #
#------------------#
library(Design)
lrm(y ~ x)$coef
#-------------------#
# Method 3 - Works #
#-------------------#
lgtreg <- function(beta, x, y)
{
eta <- exp(beta[1] + beta[2]*x)
p <- eta/(1+eta)
return(-sum(ifelse(y,log(p),log(1-p)))) # This is the log-likelihood
}
optim(c(0,0), lgtreg, x = x, y = y, method = "BFGS", hessian =
TRUE)$par
#-----------------------------------...
2008 Sep 29
0
Logistic Regression using optim() give "L-BFGS-B" error, please help
...Method 1 - Works #
#------------------#
glm(y~x, family = binomial)$coefficients
# summary(glm(y~x, family = binomial))
#------------------#
# Method 2 - Works #
#------------------#
library(Design)
lrm(y ~ x)$coef
#-------------------#
# Method 3 - Works #
#-------------------#
lgtreg <- function(beta, x, y)
{
eta <- exp(beta[1] + beta[2]*x)
p <- eta/(1+eta)
return(-sum(ifelse(y,log(p),log(1-p)))) # This is the log-likelihood
}
optim(c(0,0), lgtreg, x = x, y = y, method = "BFGS", hessian = TRUE)$par
#------------------------------...
2008 Oct 15
0
R-help Digest, Vol 67, Issue 31
...Method 1 - Works #
#------------------#
glm(y~x, family = binomial)$coefficients
# summary(glm(y~x, family = binomial))
#------------------#
# Method 2 - Works #
#------------------#
library(Design)
lrm(y ~ x)$coef
#-------------------#
# Method 3 - Works #
#-------------------#
lgtreg <- function(beta, x, y)
{
eta <- exp(beta[1] + beta[2]*x)
p <- eta/(1+eta)
return(-sum(ifelse(y,log(p),log(1-p)))) # This is the log-likelihood
}
optim(c(0,0), lgtreg, x = x, y = y, method = "BFGS", hessian = TRUE)$par
#------------------------------...