Displaying 20 results from an estimated 7000 matches similar to: "What to do with positive likelihoods"
2004 Mar 03
1
partial autocorrelation for Rt vs. Nt-1, ......., Nt-h
Dear list, following a previous querry we are still stuck!
As pointed out by Erin Hodges the "ts" library includes a PACF function
which reports the partial correlation of population density at time t
against lagged population density.
However, what we are trying to calculate is the partial correlation between
rate of population change, Rt=log Nt/Nt-1, against lagged population
2004 Jan 16
2
individual likelihoods
Dear all,
is there a way to extract individual likelihoods from a glm/lrm object?
By individual likelihoods, I mean the likelihoods whose product give the
overall likelihood of the model.
I guess the code in the base package, used to compute the Akaike Information
Criterion may help me.
However, I couldn't figure it out, probably because I'm rather new to
likelihood theory and ML
2010 Mar 11
1
Append to outfile in R CMD BATCH mode
Is there a way to append to the outfile when using R CMD BATCH? My code, right now, is:
R CMD BATCH --slave --vanilla '--args place .2 -.1 .9 .6' StratificationSimulation example.output
Everything else is working the way I'd like it. The first few lines of code of my script file are:
options(echo=FALSE)
cmd_args = commandArgs()
print (cmd_args)
#d <-
2007 Apr 18
3
Problems in programming a simple likelihood
As part of carrying out a complicated maximum likelihood estimation, I
am trying to learn to program likelihoods in R. I started with a simple
probit model but am unable to get the code to work. Any help or
suggestions are most welcome. I give my code below:
************************************
mlogl <- function(mu, y, X) {
n <- nrow(X)
zeta <- X%*%mu
llik <- 0
for (i in 1:n) {
if
2005 Feb 16
2
Positive log-likelihood in lme
Kia ora
I'm a using lme (from nlme package) with data similar to the Orthodont dataset and am getting positive log-likelihoods (>100). This seems usual and I wondered if someone could offer a possible explanation.
I can supply a sample dataset if requested, but I feel almost certain that this question has been asked and answered recently. However, I can find no trace of it in the mail
2006 Jul 02
1
workaround for numeric problems
Dear R-people,
I have to compute
C - -(pnorm(B)*dnorm(B)*B + dnorm(B)^2)/pnorm(B)^2
This expression seems to be converging to -1 if B approaches to -Inf
(although I am unable to prove it). R has no problems until B equals
around -28 or less, where both numerator and denominator go to 0 and
you get NaN. A simple workaround I did was
C <- ifelse(B > -25,
-(pnorm(B)*dnorm(B)*B
2007 Sep 13
2
Reciprocal Mill's Ratio
I believe that this may be more appropriate here in r-devel than in r-help.
The normal hazard function, or reciprocal Mill's Ratio, may be obtained
in R as dnorm(z)/(1 - pnorm(z)) or, better, as dnorm(z)/pnorm(-z) for
small values of z. The latter formula breaks dowm numerically for me
(running R 2.4.1 under Windows XP 5.1 SP 2) for values of z near 37.4
or greater.
Looking at the pnorm
2013 Apr 22
0
Copula fitMdvc:
Hello,
I am trying to do a fit a loglikelihood function with Multivariate
distribution via copulas with fitMdvc. The problem is that it
doesn't recognize that my beta is a vector of km parameter and when I try
to run it it say that the length of my initial values is not the same as
the parameter.
Can somebody guide me where my mistake is.
Thanks,
Elisa.
#################################
2004 Jul 08
1
(PR#7070)
> version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
minor 7.1
year 2003
month 06
day 16
language R
Bug:
integrate(f,lower,upper,extra_args)
where
f <- function(x,extra_args)
{
body
}
integrate doesn't pass the extra arguments when calling f.
As a first check of this finding I integrated dnorm from
2010 Jun 13
2
help with R
Hi all,
I want to solve the following equation for x with rho <- 0.5
pnorm(-x)*pnorm((rho*dnorm(x)/pnorm(x)-x)/sqrt(1-rho^2))==0.05
Is there a function in R to do this?
Thank you very much!
Hannah
[[alternative HTML version deleted]]
2001 Jan 09
3
log(0) problem in max likelihood estimation
This practical problem in maximum likelihood estimation must be
encountered quite a bit. What do you do when a data point has a
probability that comes out in numerical evaluation to zero? In calculating
the log likelihood you then have a log(0) problem.
Here is a simple example (probit) which illustrates the problem:
x<-c(1,2,3,4,100)
ntrials<-100
yes<-round(ntrials*pnorm((x-3)/1))
2002 Feb 13
3
pnorm, relative accuracy in the tails
Dear R people
The function below should be decreasing, convex, and tend to zero when x
tends to infinity.
curve((1-pnorm(x))/dnorm(x),from=0, to=9)
>From the plot we see that for x between 8.0 and 8.3 the function is
fluctuating.
As far as I understand, this is due to the function pnorm() not being
sufficiently accurate in the tails.
I am using pnorm() in a way that has probably not been
2009 May 16
1
maxLik pakage
Hi all;
I recently have been used 'maxLik' function for maximizing G2StNV178 function with gradient function gradlik; for receiving this goal, I write the following program; but I have been seen an error in calling gradient function;
The maxLik function can't enter gradlik function (definition of gradient function); I guess my mistake is in line ******** ,that the vector ‘h’ is
2013 Jan 30
2
Integration of mixed normal distribution
Hi,
I already found a conversation on the integration of a normal
distribution and two
suggested solutions
(https://stat.ethz.ch/pipermail/r-help/2007-January/124008.html):
1) integrate(dnorm, 0,1, mean = 0, sd = 1.2)
and
2) pnorm(1, mean = 0, sd = 1.2) - pnorm(0, mean = 0, sd = 1.2)
where the pnorm-approach is supposed to be faster and with higher precision.
I want to integrate a mixed
2004 Jul 08
0
a not-a-bug report on integrate (PR#7070)
Rembert.DeBlander@econ.kuleuven.ac.be wrote:
>>version
>
PLEASE:
a) Use a sensible subject line
b) Please post only post bug reports if you are sure it is a bug (and
here it is not a bug!)
c) Check the recent R version (1.9.1) if posting bugs, not an outdated one!
d) Only named arguments are passed through the ... argument:
integrate(dnorm, lower=-Inf, upper=3, mean=-1, sd=7)
Uwe
2011 Nov 23
2
How to increase precision to handle very low P-values
Hello, Rlisters
I have to compute p-values that are on the tail of the distribution,
P-values < 10^-20.
However, my current implementations enable one to estimate P-values up to
10^-12, or so.
A typical example is found below, where t is my critical value.
########### example - code adapted from Rassoc #######################
rho01 = 0.5
rho105 = 0.5
rho005 = 0.5
t = 8
z = 2
2003 Nov 21
1
glmmPQL, log-likelihoods issue
Greetings-
a reviewer for a paper of mine noted an anomaly in some models I ran using
glmmPQL (from the MASS package). Specifically, the models are three-level
hierarchical probit models estimated using PQL under R. The anomaly is
that the log-likelihoods decrease (or, alternatively -2logLik increases)
as variables are added to the null model. This is unusual, and I'm trying
to figure out
2009 Jul 14
1
How does logLik(lm(...)) find the maximum log likelihoods
Hi. Thanks for your help with my previous question (comparing two lm() models with a maximum likelihood ratio test)
I had a look at lrtest from the package lmtest as it has been suggested to me, but I am not 100% sure if that is the right thing to do ...
lrtest uses the same log likelihoods as you can extract by hand from lm() with logLik - are this the maximum log likelihoods? How does R
2002 Jul 01
1
Defining own variance function / quasi-likelihood in a GLM
Hello,
I've been looking in the on-line manuals and searching past posts but
can't find an answer to this question.
I'd like to define my own variance function in a GLM.
The function glm(formula, family=quasi(var="var function"))
lets me choose from a selection of built in variances, but I want to
define my own function for the variance.
Is there an S-plus
2004 May 05
4
Discontinuities in a simple graph (machine precision?)
Hi,
I've got an ugly but fairly simple function:
mdevstdev <- function(a){
l <- dnorm(a)/(1-pnorm(a))
integrand <- function(z)(abs(z-l)*dnorm(z))
inted <- integrate(integrand, a, Inf)
inted[[1]]/((1- pnorm(a))*sqrt((1 + a*l - l^2)))
}
I wanted to quickly produce a graph of this over the range [-3,3] so I
used:
plotit <-function(x=seq(-3,3,0.01),...){