Dear All,
Please, is there any package in R that has implemented ridge regression for beta
and gamma models?
If not, kindly help me to adjust my model below for the beta regression so as to
accommodate ridge
penalty. Thanks.
lbeta <- function(par,y,X){
n <-length(y)
k <- ncol(X)
beta <- par[1:k]
phi <- par[k+1]
if(phi < 0)return(NA)
mu <- X%*%beta
val <- vector()
mu <- X%*%beta
mul <- exp(mu)/(1+exp(mu))
p <- phi*mul; q <- phi*(1-mul)
for(i in 1:n) val[i] <- dbeta(y[i],p[i,],q[i,],log=TRUE)
return(-sum(val))
}
James
[[alternative HTML version deleted]]