Displaying 20 results from an estimated 8000 matches similar to: "Data Simulation"
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
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 11
3
Problem when creating matrix of values based on covariance matrix
Hi,
I want to simulate a data set with similar covariance structure as my
observed data, and have calculated a covariance matrix (dimensions
8368*8368). So far I've tried two approaches to simulating data:
rmvnorm from the mvtnorm package, and by using the Cholesky
decomposition (http://www.cerebralmastication.com/2010/09/cholesk-post-on-correlated-random-normal-generation/).
The problem is
2011 Sep 03
1
Bootstrapping a covariance matrix
Dear all I am a bit new to R so please keep your swords sheathed!
I would simply like to bootstrap a covariance matrix from a multivariate
gaussian density. At face value that seemed like a very straightforward
problem to solve but I somehow could not get the boot package to work and
did not really understand the documentation so I tried to do the bootstrap
manually. Hence:
x<-rmvnorm(n = 5,
2010 Aug 24
3
generate random numbers from a multivariate distribution with specified correlation matrix
Hi all,
rmvnorm()can be used to generate the random numbers from a multivariate
normal distribution with specified means and covariance matrix, but i want
to specify the correlation matrix instead of covariance matrix for the
multivariate
normal distribution.
Does anybody know how to generate the random numbers from a multivariate
normal distribution with specified correlation matrix? What about
2008 Oct 22
3
Help finding the proper function
This might not be the correct forum for this question for there might be some
flaws in my logic so the R function I'm looking for might not be the
correct, but I know there?s a lot of smart people in this forum so please
correct me if I'm wrong. I have been googling and searching in this forum
for something useful but so far I'm out of luck.
This is the background to my problem. I
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)
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
2006 Nov 30
1
data.frame within a function (PR#9294) (cont'd)
This continues the message "data.frame within a function (PR#9294)" that
was posted on 2006/10/12. Duncan Murdoch kindly replied. I'm using the
current version R 2.4.0, but the same issue exists. Just copy and paste
the following code under R, and compare the output of f1() and f2() and
the output of f3() and f4(). Does anybody have any idea? Thanks.
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
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 =
2007 May 26
1
Why ?rmvnorm not working
Hi,
My R version is 2.4.1 and I installed the the packages MASS and run
command library("MASS"),
however when I type ?rmvnorm, no help topic found, it worked before.
I tried to ype ?rinvgamma from "MCMCpack" which works great.
Anybody have idea? I also reinstalled MASS package, but when I try to type
rmvnorm(), no functions found.
Pat
2010 Dec 27
1
R-code to generate random rotation matrix for rotation testing
Dear list,
I am looking for an implementation of random rotation matrix generation in R to do a rotation test: I want to use the matrices to create random multivariate normal matrices with common covariance structure and mean based on an observed data matrix.
The rRotationMatrix-function in the mixAK-package is an option, but as far as I can tell I need to draw rotation matrices with determinant
2007 Mar 16
1
error code 5 from Lapack routine 'dsyevr'
While using the rmvnorm function, I get the error:
Error in eigen(sigma, sym = TRUE) : error code 5 from Lapack routine
'dsyevr'
The same thing happens when I try the eigen() function on my covariance
matrix. The matrix is a symmetric 111x111 matrix. Well, it is almost
symmetric; there are slight deviations from symmetry (the largest is
3e-18). I have this in an MCMC loop, and it
2012 Sep 27
2
Generating an autocorrelated binary variable
Hi R-fellows,
I am trying to simulate a multivariate correlated sample via the Gaussian copula method. One variable is a binary variable, that should be autocorrelated. The autocorrelation should be rho = 0.2. Furthermore, the overall probability to get either outcome of the binary variable should be 0.5.
Below you can see the R code (I use for simplicity a diagonal matrix in rmvnorm even if it
2012 Apr 25
1
pca biplot.princomp has a bug?
x=rmvnorm(2000, rep(0, 6), diag(c(5, rep(1,5))))
x=scale(x, center=T, scale=F)
pc <- princomp(x)
biplot(pc)
There are a bunch of red arrows plotted, what do they mean? I knew that the
first arrow labelled with "Var1" should be pointing the most varying
direction of the data-set (if we think them as 2000 data points, each being
a vector of size 6). I also read from
2008 Aug 11
2
generating a random signal with a known correlation
Hi,
How can I generate a random signal that's correlated with a given signal at
a given correlation (say 0.7)?
I've been looking at rmvnorm etc but don't seem to figure it out. Thanks
-----
Yasir H. Kaheil
Columbia University
--
View this message in context: http://www.nabble.com/generating-a-random-signal-with-a-known-correlation-tp18932541p18932541.html
Sent from the R help
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
2010 May 10
1
Random walk
Hi everybody,
I am trying to generate two random walks with an specific correlation,
for example, two random walks of 200 time steps with a correlation 0.7.
I built the random walks with:
x<-cumsum(rnorm(200, mean=0,sd=1))
y<-cumsum(rnorm(200, mean=0,sd=1))
but I don't know how to fix the correlation between them.
With white noise is easy to fix the correlation using the function