Displaying 20 results from an estimated 9000 matches similar to: "Generation of correlated variables"
2013 Mar 05
3
Simulate binary correlated data
Dear R experts,
I am trying to simulate correlated binary data and have stumbled upon the
following problem:
With the help of "binarySimCLF" or "mvpBinaryEp" I have been able to
simulate correlating binary vectors given certain mean values and a desired
correlation. My problem is that these procedures do not allow you to specify
the exact vector for which you want to generate
2006 Dec 01
3
error in hetcor function (polycor package)?
I have been using the hetcor function in the polycor package. When I
don't specify the use option everything runs smoothly. However, when I
specify use either as "pairwise.complete.obs" or "complete.obs" I get
this error
Error in optim(rho, f, control = control, hessian = TRUE, method =
"BFGS") :
non-finite value supplied by optim
Is this an error in
2011 Feb 20
8
Generating uniformly distributed correlated data.
I wish to generate a vector of uniformly distributed data with a
defined correlation to another vector
The only function I have been able to find doing something similar is
corgen from the library ecodist.
The following code generates data with the desired correlation to the
vector x but the resulting vector y is normal and not uniform
distributed
library(ecodist)
x <- runif(10^5)
y
2007 Oct 17
1
correlated data
Hi!!
I am trying to generate data with specific correlation using corgen method from the ecodist package. It does not seem to generate the data properly. I am listing the code below. Secondly, when I put the code given below all in one file and source it, it is unable to complete the task. But when I execute it one at a time it is able to complete it. Can someone point out any mistake that I may
2007 Jul 03
3
generating correlated Bernoulli random variables
Hi all,
I was wondering how to generate samples for two RVs X1 and X2.
X1 ~ Bernoulli (p1)
X2 ~ Bernoulli (p2)
Also, X1 and X2 are correlated with correlation \rho.
Regards,
Vineet
[[alternative HTML version deleted]]
2011 Aug 05
1
Simulacion matrices de varianza-covarianza
Hola!
Para simular matrices de datos normales multivariados con la sentencia
rmvnorm (dentro del paquete mvtnorm) se necesita, entre otras cosas, el
número de vectores a simular, el vector de parámetros-medias correspondiente
a cada variable y su respectiva matriz de Varianza-Covarianza. En este
último punto, tengo problemas.
En lugar de ingresar una matriz sigma creada por mi, necesito simular
2011 Jun 02
4
generating random covariance matrices (with a uniform distribution of correlations)
List members,
Via searches I've seen similar discussion of this topic but have not seen
resolution of the particular issue I am experiencing. If my search on this
topic failed, I apologize for the redundancy. I am attempting to generate
random covariance matrices but would like the corresponding correlations to
be uniformly distributed between -1 and 1.
The approach I have been using is:
2007 Jun 12
4
Generating artificial datasets with a specific correlation coefficient.
I need to create artificial datasets with specific correlation
coefficients (i.e. a dataset that returns r = 0.30, etc.) as examples
for a lab I am teaching this summer. Is there a way to do that in R?
Thanks.
Jim Milks
Graduate Student
Environmental Sciences Ph.D. Program
136 Biological Sciences
Wright State University
3640 Colonel Glenn Hwy
Dayton, OH 45435
[[alternative HTML version
2006 Aug 24
2
Why are lagged correlations typically negative?
Recently, I was working with some lagged designs where a vector of
observations at one time was used to predict a vector of observations at
another time using a lag 1 design. In the work, I noticed a lot of
negative correlations, so I ran a simple simulation with 2 matched
points. The crude simulation example below shows that the correlation
can be -1 or +1, but interestingly if you do this
2006 Apr 23
2
distribution of the product of two correlated normal
Hi,
Does anyone know what the distribution for the product of two correlated
normal? Say I have X~N(a, \sigma1^2) and Y~N(b, \sigma2^2), and the
\rou(X,Y) is not equal to 0, I want to know the pdf or cdf of XY. Thanks
a lot in advance.
yu
[[alternative HTML version deleted]]
2005 Jul 01
5
Generating correlated data from uniform distribution
Dear R users,
I want to generate two random variables (X1, X2) from uniform
distribution (-0.5, 0.5) with a specified correlation coefficient r.
Does anyone know how to do it in R?
Many thanks!
Menghui
2006 Sep 27
1
Testing the equality of correlations
Dear All,
I wonder if there is any implemented statistical test in R to test the equality between many correlations. As an example, let X1, X2, X3 X4 be four random variables. let
Phi(X1,X2) , Phi(X1,X3) and Phi(X1,X4) be the corresponding correlations.
How to test Phi(X1,X2) = Phi(X1,X3) = P(X1,X4)?
Many thanks in advance,
Bernard
2007 Oct 06
1
Tricky vectorization problem
Hi all,
I'm using the code below within a loop that I run thousands of times
and even with the super-computing resources at my disposal this is
just too slow. The snippet below takes about 10s on my machines,
which is an order of magnitude or two slower than would be
preferable; in the end I'd like to set the number of monte carlo
experiments to 1e4 or even 1e5 to ensure stable
2013 Sep 18
2
cov2cor exp
Ok, Thanks foe the answer, Ken:
*1L, 2L etc are integers. (That is, identical to as.integer(1) ,
as.integer(2) etc)
Using integers (instead of "numeric" type) is more efficient as here they're
used as indexes and would be converted to integer anyway.
Compare
> is(1)
... and
> is(1L)
1L:p is the sequence 1, 2, 3, ..., p (just like 1:p)
Just for curiosity, what is
2004 Oct 22
1
cor, cov, method "pairwise.complete.obs"
Hi UseRs,
I don't want to die beeing idiot...
I dont understand the different results between:
cor() and cov2cov(cov()).
See this little example:
> x=matrix(c(0.5,0.2,0.3,0.1,0.4,NA,0.7,0.2,0.6,0.1,0.4,0.9),ncol=3)
> cov2cor(cov(x,use="pairwise.complete.obs"))
[,1] [,2] [,3]
[1,] 1.0000000 0.4653400 -0.1159542
[2,] 0.4653400 1.0000000
2007 Mar 17
1
Correlated random effects in lme
Hello,
I am interested in estimating this type of random effects panel:
y_it = x'_it * beta + u_it + e_it
u_it = rho * u_it-1 + d_it rho belongs to (-1, 1)
where:
u and e are independently normally zero-mean distributed.
d is also independently normally zero-mean distributed.
So, I want random effects for group i to be correlated in t, following an
AR(1) process.
Any idea of how
2011 Aug 11
5
generate two sets of random numbers that are correlated
Dear R users
I'd like to generate two sets of random numbers with a fixed correlation
coefficient, say .4, using R.
Any suggestion will be greatly appreciated.
Regards,
Kathryn Lord
--
View this message in context: http://r.789695.n4.nabble.com/generate-two-sets-of-random-numbers-that-are-correlated-tp3735695p3735695.html
Sent from the R help mailing list archive at Nabble.com.
2012 Aug 09
4
debug vs regular mode
Dear all,
I had a R segmentation fault, and then invoked debug mode and ran step
by step.
When I reached "terms(Y~X1*X2*...*X16)", I would then have
"segmentation" fault. However, if I just ran this under regular "R
interactive" mode, it would be fine though taking long time.
My questions are:
1. Is there a known limit of terms for a formula?
2. Why does the
2012 Aug 09
4
debug vs regular mode
Dear all,
I had a R segmentation fault, and then invoked debug mode and ran step
by step.
When I reached "terms(Y~X1*X2*...*X16)", I would then have
"segmentation" fault. However, if I just ran this under regular "R
interactive" mode, it would be fine though taking long time.
My questions are:
1. Is there a known limit of terms for a formula?
2. Why does the
2006 Dec 05
1
Spearman correlation ties and discrepancies
Hi. I am currently trying to run some Spearman correlations, and have
encountered two issues.
1) When using cor.test() with a variable that includes ties, I get the
"Cannot compute exact p-values with ties" error. I have read that this
function now uses an asymptotic formula that allows for ties, so do not
understand why I am getting this error. (I am running version 2.4.0.)
I