Displaying 4 results from an estimated 4 matches for "lnlk".
Did you mean:
lnk
2010 Mar 26
1
how to read this special form of data
Dear R listers,
I have a data file looks like the following:
Testing marker: s_1
---------------------------------------------
Allele df(0) -LnLk(0) df(T) -LnLk(T) ChiSq p
3 7995 29320.30 7994 29311.85 16.90 4e-05 (2229/8000 probands)
Testing marker: s_2
---------------------------------------------
Allele df(0) -LnLk(0) df(T) -LnLk(T) ChiSq p
3 7995 29339.25 7994 29338.31 1.88 0...
2002 Aug 22
3
Symbolic differentiation ("D","deriv", etc.) (PR#1928)
Full_Name: Lyle W. Konigsberg
Version: 1.5.1
OS: Windows
Submission from: (NULL) (160.36.64.99)
I apparently found an error in how "deriv" puts a derivative to the screen
(though the internal representation is correct). Here's what I was doing for a
class example:
> lnlk<-expression(15*log(p)+11*log(1-p))
> p<-15/26
> D(D(lnlk,"p"),"p")
-15 * (1/p^2) + 11 * (1/(1 - p)^2)
> eval(D(D(lnlk,"p"),"p"))
[1] -106.5212
> -15 * (1/p^2) + 11 * (1/(1 - p)^2)
[1] 16.38788
>From S+ I have the following:
> lnlk<...
2012 Apr 16
0
Gompertz-Makeham hazard models---test for significant difference
...#############
GM.naga <- function(x,deaths=naga)
{
a2=x[1]
a3=x[2]
b3=x[3]
shift<-15
nrow<-NROW(deaths)
S.t<-function(t)
{
return(exp(-a2*(t-shift)+a3/b3*(1-exp(b3*(t-shift)))))
}
d<-S.t(deaths[1:nrow,1])-S.t(deaths[1:nrow,2])
obs<-deaths[,3]
lnlk<-as.numeric(crossprod(obs,log(d)))
return(lnlk)
}
optim(c(0.001, 0.01, 0.1),GM.naga,control=list(fnscale=-1))
####################################
And the output:
$par
[1] 0.05486053 0.31290971 -1.87744033
$value
[1] -168.3748
$counts
function gradient
174 NA
$convergence...
2012 Jan 12
2
Function accepted by optim but not mle2 (?)
...h.t<-a3*exp(b3*(t-shift))
S.t<-exp(a3/b3*(1-exp(b3*(t-shift))))
PF<-1-(exp(a3/b3*(1-exp(b3*(data[1]-shift)))))
QF<-1-(exp(a3/b3*(1-exp(b3*(data["length"(data)]-shift)))))
return(S.t*h.t/(QF-PF))
}
## GOMPERTZ - maximum likelihood
gompertz2<-function (x)
{
lnlk<-sum(log(gompertz(x,t=data)))
return(-lnlk)
}
## this works:
A<-optimx(c(0.1,0.1),gompertz2, method=c("Nelder-Mead"),control=list(fnscale=1))
## this doesn't:
A <- mle2(gompertz2(x),start=list(a3=0.03,b3=0.1),data=data)
## Error in gompertz2(x) : object 'x' not foun...