Displaying 8 results from an estimated 8 matches for "llk".
Did you mean:
blk
2010 Sep 09
5
Help on simple problem with optim
...is in the following and the data is in the attachment.
da <- read.table("da.txt",header=TRUE)
# fit with linear regression using log transformation of the response variable
fit <- lm(log(yp) ~ as.factor(ay)+as.factor(lag),data=da)
# define the log likelihood to be maximized over
llk.mar <- function(parm,y,x){
# parm is the vector of parameters
# the last element is sigma
# y is the response
# x is the design matrix
l <- length(parm)
beta <- parm[-l]
sigma <- parm[l]
x <- as.matrix(x)
mu <...
2008 Jan 27
2
Likelihood optimization numerically
...tical Inference by George Casella, 2nd
Edition Casella and Berger, Roger L. Berger (2002, pp. 355, ex. 7.4 # 7.2.b):
data = x = c(20.0, 23.9, 20.9, 23.8, 25.0, 24.0, 21.7, 23.8, 22.8, 23.1, 23.1, 23.5, 23.0, 23.0)
n <- length(x)
# likelihood from a 2 parameter Gamma(alpha, beta), both unknown
llk = -n*log(gamma(alpha)) - n*alpha*log(beta) + (alpha - 1)*(sum(log(x))) - (sum(x))/beta
# analytic 1st derivative solution w.r.t alpha, assuming beta known
# by putting MLE of beta = sum(x)/(n*alpha)
# (to simplify as far as possible analytically)
llk.1st = - n*digamma(alpha) -n*(log(sum(x)/(n*alp...
2012 Oct 02
2
Questions on converting to ConfBridge
I'm looking at what would be involved in converting from MeetMe to
ConfBridge and there seems to be a lot of missing administrative things,
but I hope I'm just missing it. We all know about the missing realtime
linkage. That's a major nuisance, but can be worked around.
More serious is that the CLI command to display users in a ConfBridge
don't show the caller ID information, so
2005 Mar 02
1
Warning: number of items to replace is not a multiple of replacement length
...1380187,0.3720293)
beta<-c(0,0)
alpha1<-c(0,0)
alpha2<-c(0,0)
beta[1]<-xpars[1]
alpha1[1]<-xpars[2]
alpha2[1]<-xpars[3]
beta[2]<-xpars[4]
alpha1[2]<-xpars[5]
alpha2[2]<-xpars[6]
corr<-matrix(rep(0,4),nc=2)
corr[1,1]=1
corr[2,2]=1
corr[1,2]=xpars[7]
corr[2,1]=corr[1,2]
LLK<-0
L<-c(0,0)
R<-c(0,0)
for(j in 1:2){
if(indic[j]==1){
L[j]<--Inf
R[j]<-alpha1[j]-beta[j]*lage}
if(indic[j]==2){
L[j]<-alpha1[j]-beta[j]*lage
R[j]<-alpha2[j]-beta[j]*lage}
if(indic[j]==3){
L[j]<-alpha2[j]-beta[j]*lage
R[j]<-Inf}
}...
2007 May 24
3
Problem with numerical integration and optimization with BFGS
...pper = some finite number (details can be found in the code below)
My problem is the following: when I try to maximize the log-likelihood
function using "optim" with method "BFGS", I get the following error
message (about the second integral):
> out <- optim(alpha.start, LLK, gr=NULL, method="BFGS", y=urate$y)
Error in integrate(f3, lower = -Inf, upper = upr2) :
the integral is probably divergent
Since I know that all the three integrals are convergent, I do not
understand why I am getting this error message. My first question: can
someone explain wh...
2003 Jul 09
2
A problem with using the "outer" function
...uot; to
work on one of my functions. Here is a simple example illustrating my
problem:
> b1 <- c(1.2,2.3)
> b2 <- c(0.5,0.6)
> x <- c(3e+01, 1e+02, 3e+02, 5e+02, 1e+03, 1e+04, 1e+05, 1e+06)
> y <- c(2,4,2,5,2,3,1,1)
> n <- c(5,8,3,6,2,3,1,1)
> outer(b1,b2,FUN=bpllkd,x,y,n)
[,1] [,2]
[1,] 17.78031 17.78031
[2,] 17.78031 17.78031
These values should all be different. What is the problem here?
The function "bpllkd" is given below:
thanks for any help,
Ravi.
> bpllkd
function(t1,t2,x,y,n){
p <- 1 - (1+x/10^t1)^(-t2)
keep <- !((...
2012 Nov 12
1
Invalid 'times' argument three-category ordered probit with maximum likelihood
...an). Here is the code I used:
setwd("C:/Users/Terry/Desktop/Terry/School/Fall 2012/ML/HW")
#Load Libraries
library(MASS)
library(tile)
library(simcf)
#Load Data
econrate <- read.csv("hw4econ3.csv", header=TRUE, sep=",")
attach(econrate)
#Ordered Probit Liklihood
llk.oprobit3 <- function(param, x, y) {
os <- rep(1, nrow(x))
x <- cbind(os, x)
b <- param[1:ncol(x)]
t2 <- param[(ncol(x)+1)]
xb <- x%*%b
p1 <- log(pnorm(-xb))
if (t2<=0) p2 <- -(abs(t2)*10000)
else p2 <- log(pnorm(t2-xb)-pnorm(-xb))
p3 <- log(1-pnor...
2009 Jul 23
1
[PATCH server] changes required for fedora rawhide inclusion.
...VRZxV`A?jQY*E5JWV6X5Flm%EyPt+_X0gn
zn^~r#^OjCo4{>z@=Y><jB$J+M*LyKco1s(y&HRNT-t4#gkZARzShzk$_ifC9xQEtJ
zo!++8Ra-fAWJyrYe^eOM+mh*~YF23BTxqzPO#VL`G$$Hql>n(>`KXHBRr4 at DF9j)n
z1vSs^k9QvcxNIl1?UzjL-#5iWYZa&wJtGPsh+;(#3a<lpmw=F3|Kli1V!wgxYjS@*
z5I^gvG|$Gl{_H=3wgbS=*JE!in;*qG*TGkllkHy!(tb>t>$jSG9xU=}aLx=FW~y|%
z_RSK_JieDE?2jh5ANZ9vsG}Ru5b4L!Lgl*ze79av2tiJhE;i3Iw~rTU4$cC^J6A{&
zBP(a&OXp_vmqzOe>m+R>H8O+EhnL?CZ-+0?AfZaPRVsNa?oSoJu2;{&E9qZ`I&-ym
zOY#uPFjX07Qm3{ch1~>GQb0yYgJVgI<yvAT7o!UK3V9<Iq8Gl01s|SOxP}MNk|6+n
zBUG7iDm>}}OOp^~CqAv8E2<&am...