Try this code:
# Standard deviations and correlation
sig_x <- 1
sig_y <- 2
rho_xy <- 0.7
# Covariance between X and Y
sig_xy <- rho_xy * sig_x *sig_y
# Covariance matrix
Sigma_xy <- matrix(c(sig_x ^ 2, sig_xy, sig_xy, sig_y ^ 2), nrow = 2,
ncol = 2)
# Load the mvtnorm package
library("mvtnor
Please look at my book
Statistical Analysis and Data Display
https://www.springer.com/us/book/9781493921218
Figures 3.8, 3.9, 3.10
The code for these figures is available in the HH package
install.packages("HH")
library(HH)
HHscriptnames(3) ## this gives the filename on your computer containing
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of JEFFERY
> REICHMAN
> # Standard deviations and correlation
> sig_x <- 1
> sig_y <- 1
> rho_xy <- 0.0
>
> # Covariance between X and Y
> sig_xy <- rho_xy * sig_x *sig_y
>
> # Covariance matrix
> Sig
R-Help
I am attempting to create a series of bivariate normal distributions. So using
the mvtnorm library I have created the following code ...
# Standard deviations and correlation
sig_x <- 1
sig_y <- 1
rho_xy <- 0.0
# Covariance between X and Y
sig_xy <- rho_xy * sig_x *sig_y
# Covariance m
Hello,
The package pbivnorm will solve your problem.
http://cran.r-project.org/web/packages/pbivnorm/index.html
--
View this message in context:
http://r.789695.n4.nabble.com/bivariate-normal-tp4638159p4639048.html
Sent from the R help mailing list archive at Nabble.com.
___
The package pbivnorm will certainly solve your problem.
It allows a vectorized call to the cdf of the bivariate normal distribution.
--
View this message in context:
http://r.789695.n4.nabble.com/Bivariate-normal-integral-tp4571018p4639041.html
Sent from the R help mailing list archive at Nabbl
On Jul 27, 2012, at 10:45 AM, Anders Holm wrote:
Dear list members
I need a function that calculates the bivariate normal distribution
for each observation. It is part of a likelihood function and I have
1000's of cases. As I understand it I cannot use packages like
"mvtnorm" because i
On 28/07/12 05:45, Anders Holm wrote:
Dear list members
I need a function that calculates the bivariate normal distribution for each observation.
It is part of a likelihood function and I have 1000's of cases. As I understand it I
cannot use packages like "mvtnorm" because it requres a covar
Dear list members
I need a function that calculates the bivariate normal distribution for each
observation. It is part of a likelihood function and I have 1000's of cases. As
I understand it I cannot use packages like "mvtnorm" because it requres a
covariance matrix of the same dimension as t
On Apr 19, 2012, at 16:08 , juliane0212 wrote:
> hello,
>
> I'm trying to improve the speed of my calculation but didn't get to a
> satisfying result.
>
> It's about the numerical Integration of a bivariate normal distribution.
>
> The code I'm currently using
>
> x <-
> qnorm(seq(.
I also tried:
m1 <- length(x)-1
X1<- cbind(x[1:m1],x1[2:length(x)])
X2<- cbind(x[1:m1],x1[2:length(x)])
integral <- function(rho){
m1 <- length(x1)-1
integral <- apply(X2,1,function(y)
apply(X1,1,function(x) pmvno
hello,
I'm trying to improve the speed of my calculation but didn't get to a
satisfying result.
It's about the numerical Integration of a bivariate normal distribution.
The code I'm currently using
x <-
qnorm(seq(.Machine$double.xmin,c(1-2*.Machine$double.eps),by=0.01),
mean=0,sd=1)
---
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Dimitris Rizopoulos
> Sent: Thursday, August 25, 2011 20:28
> To: DHIMAN BHADRA
> Cc: r-help@r-project.org
> Subject: Re: [R] Bivariate normal regression in R
>
> One possibility is func
One possibility is function gls() from package nlme.
Best,
Dimitris
On 8/25/2011 8:22 PM, DHIMAN BHADRA wrote:
Hello everyone,
I need to fit a bivariate normal regression model to a dataset where the
same covariate (say, X) influences two separate but correlated responses
(say, Y1 and Y2). So
Hello everyone,
I need to fit a bivariate normal regression model to a dataset where the
same covariate (say, X) influences two separate but correlated responses
(say, Y1 and Y2). So, the bivariate
model would look like :
Y1 = a1 + b1*X + e1
Y2 = a2 + b2*X + e2
where e1 and e2 are error terms wh
Hi,
Let f(rho) = E[F_1(x) F_2(y)], i.e f(rho) is the expectation of
F(x) * F(y) with respect to the bivariate Gaussian density with mean 0
and covariance matrix [1 rho; rho 1].
Moreover, assume F_1(x) and F_2(y) to be increasing functions of x and y
respectively.
I was wondering if it was true th
sha Pustota
Cc: [EMAIL PROTECTED]
Subject: Re: [R] Bivariate normal
On 2/10/2008, at 4:43 AM, Sasha Pustota wrote:
> Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute
> Pr(X=x,Y=y) and Pr(X
> Are there functions that would compute Pr(X I'm currently using "i
On 2/10/2008, at 11:02 AM, Ravi Varadhan wrote:
I think it is meaningful to ask for a non-trivial Pr (X < x, Y=y)
when you
are writing down the likelihood for parameter estimation. This is
commonly
the case in likelihood estimation in bivariate failure time
models. If one
interprets P
On 2/10/2008, at 4:43 AM, Sasha Pustota wrote:
Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute
Pr(X=x,Y=y) and Pr(X
Yes:
foo <- function(x,y) {
0
}
I'm currently using "integrate" with dmvnorm but it is too slow.
Words fail me
P.S. just "pnorm(x, mean=m, sd=s)", not "1-pnorm(x, mean=m, sd=s) +
pnorm(-x, mean=m, sd=s)"
On Wed, Oct 1, 2008 at 2:04 PM, Sasha Pustota <[EMAIL PROTECTED]> wrote:
> Thanks Jay. I realized that I was doing it a silly way shortly after I
> posted and that the answer i was looking for is simply
>
Thanks Jay. I realized that I was doing it a silly way shortly after I
posted and that the answer i was looking for is simply
condXY(y, x, my, mx, r) * dnorm(y, my)
condXY <- function(y, x, my, mx, r) {
m <- mx + r*(y - my)
s <- sqrt(1-r^2)
p <- 1 - pnorm(x, mean=m, sd=s) + pnorm(-x, mean=m
Dear Sasha,
On Wed, Oct 1, 2008 at 11:43 AM, Sasha Pustota <[EMAIL PROTECTED]> wrote:
> Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute
> Pr(X=x,Y=y) and Pr(X
> Are there functions that would compute Pr(X I'm currently using "integrate" with dmvnorm but it is too slow.
Stri
Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute
Pr(X=x,Y=y) and Pr(Xhttps://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Good morning and I appreciate the availability of a help-list. I am a
professional hydrologist, but not a professional statistician. Yet I
find myself using statistical tools at least part of the time. My
discovery of the R-project through a friend has been most helpful.
Here is my problem:
24 matches
Mail list logo