Displaying 20 results from an estimated 3000 matches similar to: "big difference in estimate between dmvnorm and dnorm, how come?"
2007 Feb 26
3
returns from dnorm and dmvnorm
Hi All,
Why would calls to dnorm and dmvnorm return values that are above 1? For
example,
> dnorm(0.00003,mean=0, sd=0.1)
[1] 3.989423
This is happening on two different installations of R that I have.
Thank you.
Hailu
[[alternative HTML version deleted]]
2004 Oct 31
3
strange results with dmvnorm
I am experiencing strange results using dmvnorm. I define a scaled distance
matrix from the coordinates bellow and then calculate a covariance matrix using
a spherical correlation function. Then with certain combinations of
range and sill parameters dmvnorm is returning values greater than 1. Surely
the results of dmvnorm should be in the interval 0:1 (or do I just nead a
holiday?). In addition
2013 Jun 06
1
dmvnorm
Summary:
+ I am writing an R extension that needs to call dmvnorm more than
10,000 times during a model fitting computation.
+ My extension uses openmp for parallel execution.
+ As of R 3.0, it is no longer permitted for threads to call the R
interpreter because there is a stack overflow check that always trips
because the thread's stack is different from what R is expecting.
+
2010 Jun 23
3
integrate dmvtnorm
Hello, everyone,
I have a question about integration of product of two densities.
Here is the sample code; however the mean of first density is a function of
another random variable, which is to be integrated.
##
f=function(x) {dmvnorm(c(0.6, 0.8), mean=c(0.75, 0.75/x))*dnorm(x, mean=0.6,
sd=0.15)}
integrate(f, lower=-Inf, upper=Inf)
## error message
Error in dmvnorm(c(0.6, 0.8), mean = c(0.75,
2010 Mar 13
2
dmvnorm masked by emdbook
I am using curve3d in the emdbook package to graph a gaussian copula density
function generated via the copula package. Unfortunately, it appears that
emdbook masks dmvnorm from the package mvtnorm in a way that prohibits
copula from generating the gaussian copula. (Sounds very confusing!) For
example,
> library(copula)
> f<-function(x,y) dcopula(normalCopula(0),c(x,y))
>
2013 Oct 20
5
nlminb() - how do I constrain the parameter vector properly?
Greets,
I'm trying to use nlminb() to estimate the parameters of a bivariate normal sample and during one of the iterations it passes a parameter vector to the likelihood function resulting in an invalid covariance matrix that causes dmvnorm() to throw an error. Thus, it seems I need to somehow communicate to nlminb() that the final three parameters in my parameter vector are used to
2009 Nov 18
2
Error "system is computationally singular" by using function dmvnorm
Dear R users,
i try to use function dmvnorm(x, mean, sigma, log=FALSE)
from R package mvtnorm to calculate the probability of x
under the multivariate normal distribution with mean equal
to mean and covariance matrix sigma.
I become the following
Error in solve.default(cov, ...) :
system is computationally singular: reciprocal condition
number = 1.81093e-19
What could be the reason of it?
2006 Mar 24
1
how to add list to a list in iterative manner without mixing content
I have a function that generated list and then from those I need to
do some repeated calculation. So I was thinking to put them in
another list and call them one after the other. Given that I have 20
of those it was a bit annoying to typing all of them in one command.
So I need something to do a recursive addition of a list objet to a
list
here a small size example
A<-list()
2008 Oct 01
2
Bivariate normal
Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute
Pr(X=x,Y=y) and Pr(X<x,Y<y) for a bivariate normal.
Are there functions that would compute Pr(X<x,Y=y)?
I'm currently using "integrate" with dmvnorm but it is too slow.
2011 Aug 30
2
Multivariate Normal: Help wanted!
I have the following function, a MSE calc based on some Multivariate normals:
MV.MSE<-function(n,EP,X,S){
(dmvnorm(X,mean=rep(0,2),I+S+EP)-dmvnorm(X,mean=rep(0,2),I+S))^2
+
1/n*(dmvnorm(X,mean=rep(0,2),1+S+EP/2)*det(4*pi*EP)^-.5-
(dmvnorm(X,mean=rep(0,2),I+S+EP ))^2)}
I can get the MV.MSE for given values of the function e.g
2001 Aug 30
1
MCMC coding problem
Dear All,
I am trying to convert some S-plus code that I have to run MCMC into
R-code. The program works in S-plus, but runs slowly.
I have managed to source the program into R. R recognizes that the program
is there; for example, it will display the code when I type the function
name at the prompt. However, the program will not run. When I try to run
the program, I get the following error
2012 Apr 25
2
comparison of bivariate normal distributions
sorry for cross-posting
Dear all,
I have tow (several) bivariate distributions with a known mean and variance-covariance structure (hence a known density function) that I would like to compare in order to get an intersect that tells me something about "how different" these distributions are (as t-statistics for univariate distributions).
In order to visualize what I mean hear a little
2008 Mar 23
2
problem with 'install.packages'
Hi, All:
Is there a way to identify whether any users are using a
particular package in a shared network R installation?
I ask, because we have such a multiple-user installation and when
I tried to install a package using Rgui that was in use by Rterm on a
single-user installation, 'install.packages' deleted the existing
package but failed to install the new version;
2008 Mar 22
1
Vectorization Problem
I have the code for the bivariate Gaussian copula. It is written with
for-loops, it works, but I wonder if there is a way to vectorize the
function.
I don't see how outer() can be used in this case, but maybe one can
use mapply() or Vectorize() in some way? Could anyone help me, please?
## Density of Gauss Copula
rho <- 0.5 #corr
R <- rbind(c(1,rho),c(rho,1)) #vcov matrix
id <-
2006 May 15
1
Fitting usual distributions.
Hello,
I am currently writing a program whose goal is to fit usual
distributions (estimating parameters and confidence intervals for a
given distribution).
After some research in R, R-help and google I have found most of what I
was looking for (especially thanks to MASS - fitdistr() ), however there
are still a few distributions I could not find R code for: Multinormal,
Truncated normal,
2013 Jan 28
1
Adding 95% contours around scatterplot points with ggplot2
Hi all,
I have been looking for means of add a contour around some points in a
scatterplot as a means of representing the center of density for of the
data. I'm imagining something like a 95% confidence estimate drawn around
the data.
So far I have found some code for drawing polygons around the data. These
look nice, but in some cases the polygons are strongly influenced by
outlying points.
2020 Jun 04
2
mclust package installation is preparing for lazy loading and never finishes
Hi,
After loading R 4.0.0 on Ubuntu 20.04.
R version 4.0.0 (2020-04-24) -- "Arbor Day"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()'
2009 Jun 22
1
The gradient of a multivariate normal density with respect to its parameters
Does anybody know of a function that implements the derivative (gradient) of
the multivariate normal density with respect to the *parameters*?
It?s easy enough to implement myself, but I?d like to avoid reinventing the
wheel (with some bugs) if possible. Here?s a simple example of the result
I?d like, using numerical differentiation:
library(mvtnorm)
library(numDeriv)
f=function(pars, xx, yy)
2008 Aug 01
2
contour lines in windows device but neither in pdf nor in postscript
library(mvtnorm)
x = seq(-4,4,length=201)
xy = expand.grid(x,x)
sigma = (diag(c(1,1))+1)/2
d2 = matrix(dmvnorm(xy,sigma=sigma),201)
xsamp = rmvnorm(200,sigma=sigma)
contour(x,x,d2)
points(xsamp,col=3,pch=16)
pdf("pdftry.pdf")
contour(x,x,d2)
points(xsamp,col=3,pch=16)
dev.off()
postscript("pstry.ps")
contour(x,x,d2)
points(xsamp,col=3,pch=16)
dev.off()
# I can see
2003 Jan 11
2
any plot ?
Dear R-ers:
I'm sorry to disturb you, I want just ask if R can plot a given
complicated density function. I mean if we have the expression of the
density en we want to see how it's look like? and this is a density
with two variables thus it's a 3D plot
Thank you very much
Hicham Amsterdam