Displaying 20 results from an estimated 10000 matches similar to: "simulate from conditional distribution"
2018 Apr 12
3
Bivariate Normal Distribution Plots
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 matrix
Sigma_xy <- matrix(c(sig_x ^ 2, sig_xy, sig_xy, sig_y ^ 2), nrow = 2, ncol = 2)
2010 Jun 18
1
question in R
Dear all,
I am trying to calculate certain critical values from bivariate normal
distribution (please see the
function below).
m <- 10
rho <- 0.1
k <- 2
alpha <- 0.05
## calculate critical constants
cc_z <- numeric(m)
var <- matrix(c(1,rho,rho,1), nrow=2, ncol=2, byrow=T)
for (i in 1:m){
if (i <= k) {cc_z[i] <- qmvnorm((k*(k-1))/(m*(m-1))*alpha,
2011 May 01
2
Question on where samples are grouped in rmvnorm{mvtnorm}
Dear All,
For function: rmvnorm{mvtnorm} in (library mvtnorm, not splus2R), if I generate 2 bivariate normal samples as follows:
> rmvnorm(2,mean=rep(0,2),sigma=diag(2))
[,1] [,2]
[1,] 2.0749459 1.4932752
[2,] -0.9886333 0.3832266
Where is the first sample, it is stored in the first row or the first column?
Does this function store samples row-wise or column-wise?
Thank
2010 Jun 23
2
question about a program
Dear all,
I have the following program for a multiple comparison procedure.
There are two functions for the two steps. First step is to calculate the
critical values,
while the second step is the actual procedure [see below: program with two
functions].
This work fine. However, However I want to put them into one function
for the convenience
of later use [see below: program with one
2002 Oct 02
4
T-Distribution
Dear sir,
I would ask if there are in R some code to generate a random sample
from a mvariate student distribution like that one wich generate the
multivariate normal one i mean( rmvnorm(n, mu, sigma)
Second question : if R can plot density 3Dcurve I don't mean de
histogram but de hole density function(normal for example).
I use a windows version of The R software
Thank you in advance
wiyh
2011 Apr 20
2
question regarding qmvnorm
Dear all,
I wrote the following function previously. It worked fine with the old
mvtnorm package.
Somehow with the updated package, I got a error message when trying to use
the function.
I need some help. It is sort of urgent. Can anyone please take a look. The
function is the following.
Thank you very much!
Hannah
library(mvtnorm)
cc_f <- function(m, rho,
2010 Oct 20
1
Generate variable with Bivariate Normal Distribution
Dear All
I want to generate variable with Bivariate Normal Distribution by
use mean1 = a, variance1 = b, mean2 = c, variance2 = d, rho = e.
How I can do this.
Many Thanks.
IRD
[[alternative HTML version deleted]]
2004 Jun 25
2
Simulating from a Multivariate Normal Distribution Using a Correlation Matrix
Hello,
I would like to simulate randomly from a multivariate normal distribution using a correlation
matrix, rho. I do not have sigma. I have searched the help archive and the R documentation as
well as doing a standard google search. What I have seen is that one can either use rmvnorm in
the package: mvtnorm or mvrnorm in the package: MASS. I believe I read somewhere that the latter
was
2008 Jul 03
1
Problem in applying conditional looping
Respected All,
I hope you are enjoying good health, I am tring to write a program in R but
could not be very sucessful. My program draws random sample form bivariate
normal distribution and then compute a variable PIJ. For certian samples
some entries of variable PIJ is apearing as negative, which result
in negative variance estimator. I want to introduce a loop in my program
that verify the each
2009 Mar 29
1
Quantiles for bivariate normal distribution
Hi,
Does anyone know how to write a R function to solve the quantile c for the
following equation.
P(Z1>1.975, Z2<c)+ P(Z1>c, Z2>c)=0.05/6.
Z1 and Z2 have a bivariate normal distribution with mean 0, variance 1 and
correlation 0.5.
Thanks a lot!
Hannah
[[alternative HTML version deleted]]
2013 Sep 15
1
DataEllipse versus Ellipse Function in R
Hi:
Does Ellipse and dataellipse function in R produce the same ellipse? I
wanted to see how the radius for the Ellipse function in R calculated. Also
what is the var-covariance matrix, if any, assumed for the dataellipse
function? Heres an example of the code where I am generating Multivariate
normal data and creating ellipse using the 2 functions:
library(car)
library(mvtnorm)
mu =
2012 Jul 01
4
geom_boxplot
Also, it is possible to change "ylim" also?
2012/7/1 li li <hannah.hlx@gmail.com>
> Dear all,
> I have a few questions regarding the boxplot output from the
> "geom_boxplot" function.
> Attached is the output I get. Below are my questions:
>
> 1. How can I define the xlab and ylab myself?
> Also I would like to remove
2006 Jul 01
5
generate bi-variate normal data
Dear all,
I would like to generate bi-variate normal data given that the first column
of the data is known. for example:
I first generate a set of data using the command,
x <- rmvnorm(10, c(0, 0), matrix(c(1, 0, 0, 1), 2))
then I would like to sum up the two columns of x:
x.sum <- apply(x, 1, sum)
now with x.sum I would like to generate another column of data, say y, that
makes
2012 Aug 06
4
Overlay Histogram
Dear all,
For two sets of random variables, say, x <- rnorm(1000, 10, 10) and y
<- rnorm(1000. 3, 20).
Is there any way to overlay the histograms (and density curves) of x and y
on the plot of y vs. x?
The histogram of x is on the x axis and that of y is on the y axis.
The density curve here is to approximate the shape of the distribution
and does not have to have area 1.
Thank you
2004 May 04
2
Sampling 1000 times from a bivariate normal distibution
Dear expert,
I have two coefficients and covariance matrix.
My objective is sampling 1000 times from the mean and covariance matrix.
In order to get that, what kind of commend should I use?
If you do not mind, could you tell me the comment in detail about
parameter used in that commend also?
Thank you.
Sung.
[[alternative HTML version deleted]]
2005 Dec 15
5
How to simulate correlated data
Hello there,
I would like to simulate X --Normal (20, 5)
Y-- Normal (40, 10)
and the correlation between X and Y is 0.6. How do I do it in R?
Thank you very much
Lisa Wang Msc.
Princess Margaret Hospital
Toronto, Ca
2007 Feb 13
4
Generating MVN Data
Dear All
I want to generate multivariate normal data in R for a given covariance
matrix, i.e. my generated data must have the given covariance matrix. I
know the rmvnorm command is to be used but may be I am failing to
properly assign the covariance matrix.
Any help will be greatly appreciated
thanks.
M. R. Ahmad
2012 Aug 07
2
Rcolorbrewer Package
Hi all,
I am trying to download the Rcolorbrewer package from Cran
http://cran.r-project.org/web/packages/RColorBrewer//index.html
It seems the files have been removed. Does anyone know where can
I download the package?
Thanks.
Hannah
[[alternative HTML version deleted]]
2010 Jul 23
3
Figures in Latex
Hi all,
I want to add 6 plots in the format of 2 columns and 3 rows as one
figure in latex. The plots are in .eps file.
I know how to add 2 plots side by side, but could not figure out how to do
multiple rows.
I know this may not be the right place to ask such a question. But I do
not know who to ask, so just try my
luck here.
Thank you in advance.
2008 Jul 17
2
Sampling distribution (PDF & CDF) of correlation
Hi all,
I'm looking for an analytic method to obtain the PDF & CDF of the
sampling distribution of a given correlation (rho) at a given sample
size (N).
I've attached code describing a monte carlo method of achieving this,
and while it is relatively fast, an analytic solution would obviously
be optimal.
get.cors <- function(i, x, y, N){
end=i*N