Displaying 20 results from an estimated 10000 matches similar to: "How to simulate correlated data"
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
2012 Dec 02
2
finding index of maximum value in vector
I found:
max.col(matrix(c(1,3,2),nrow=1))
Is there a more concise/elegant way?
Thanks,
-----
TO GET MORE DETAILS CLICK HERE
--
View this message in context: http://r.789695.n4.nabble.com/finding-index-of-maximum-value-in-vector-tp4651663.html
Sent from the R help mailing list archive at Nabble.com.
2008 Nov 11
1
simulate data with binary outcome and correlated predictors
Hi,
I would like to simulate data with a binary outcome and a set of predictors that are correlated. I want to be able to fix the number of event (Y=1) vs. non-event (Y=0). Thus, I fix this and then simulate the predictors. I have 2 questions:
1. When the predictors are continuous, I can use mvrnorm(). However, if I have continuous, ordinal and binary predictors, I'm not sure how to simulate
2005 Dec 01
1
Simulate Correlated data from complex sample
Dear List:
I have created some code to simulate data from a complex sample where
5000 students are nested in 50 schools. My code returns a dataframe with
a variable representing student achievement at a single time point. My
actual code for creating this is below.
What I would like to do is generate a second column of data that is
correlated with the first at .8 and has the same means within
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
2012 Dec 02
1
Linking C/C++ GUI to R.dll
Hi,
I am in the process of linking a C/C++ application to the R.dll
directly. I have obtained the R source code and compiled it
successfully. I have also successfully linked the R.dll directly into
our application and have made calls successfully into the R.dll that are
included in the sample rtest.c and in the "Writing R Extensions - The R
API".
The R functionality that we
2003 Dec 03
1
Simulating correlated distributions
Hi
How can one simulate correlated distributions in R for windows?
Coomaren P. Vencatasawmy
---------------------------------
Download Yahoo! Messenger now for a chance to WIN Robbie Williams "Live At Knebworth DVD"
[[alternative HTML version deleted]]
2006 Jun 28
1
Simulate dichotomous correlation matrix
Newsgroup members,
Does anyone have a clever way to simulate a correlation matrix such that
each column contains dichotomous variables (0,1) and where each column
has different prevalence rates.
For instance, I would like to simulate the following correlation matrix:
> CORMAT[1:4,1:4]
PUREPT PTCUT2 PHQCUT2T ALCCUTT2
PUREPT 1.0000000 0.5141552 0.1913139 0.1917923
PTCUT2
2005 Sep 09
2
Simulate phi-coefficient
Looking for help with the following problem.
Given a sample of zeros and ones, for example:
> VECTOR1<-rep(c(1,0),c(15,10))
> VECTOR1
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
How would I create a new sample (VECTOR2) also containing zeros and
ones, in which the phi-coefficient between the two sample vectors was
drawn from a population with a known
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 Aug 13
1
simulate data from multivariate normal with pre-specified correlation matrix
For example, the correlation matrix is 3x3 and looks like
1 0.75 0 0 0
0.75 1 0 0 0
0 0 0 0 0
Can I write the code like this?
p<- 3 # number of variables per observation
N<- 10 # number of samples
# define population correlation matrix sigma
sigma<-matrix(0,p,p) #creates a px p matrix of 0
rank<-2
for (i in 1:rank){
for (j in 1:rank){
rho<-0.75
2007 Sep 17
1
Create correlated data with skew
Hi all,
I understand that it is simple to create data with a specific
correlation (say, .5) using mvrnorm from the MASS library:
> library(MASS)
> set.seed(1)
>
> a=mvrnorm(
+ n=10
+ ,mu=rep(0,2)
+ ,Sigma=matrix(c(1,.5,.5,1),2,2)
+ ,empirical=T
+ )
> a
[,1] [,2]
[1,] -1.0008380 -1.233467875
[2,] -0.1588633 -0.003410001
[3,] 1.2054727 -0.620558768
2003 May 09
1
generate correlated dataset
Hi,I want to generate a dataset, which have more than one clusters (say 2) and the elements in each cluster have high correlation (say 0.85) andelements among different clusters have low (say 0.1) or zero correlation.The correlation structure of final dataset should have a block-diagonal structure, that likes 0.85 0.85 .. 0.85 0 0 0 0 ...0 0 0...0 0 0
2008 May 09
1
Multivariate simulation
Dear everyone, I am having problem simulating multivariate data. Though I was able to simulate the data, but finding the variance-covariance matrix of simulated data did not give exact covariance matrix used in simulating the data. Unlike some other packages, like stata, using command "corr2data" will simulate data having the covariance matrix exactly with the specified covariance
2011 Jul 06
1
Create simulated data's using mvrnorm
Hi All
This might be something very trivial but I seem to miss something in the
syntax or logic which makes me keep wandering around the problem without
arriving at a solution.
What I want to do is to simulate a sample data for performing cluster
analysis. I tried to use
x1= mvrnorm(10,rep(0.8,3),diag(3))
x2= mvrnorm(10,rep(0,3),diag(3))
x3= mvrnorm(10,rep(-0.5,3),diag(3))
x=rbind(x1,x2,x3)
2010 Jan 21
1
correlation significance testing with multiple factor levels
[Apologies in advance if this is too "statistics" and not enough "R".]
I've got an experiment with two sets of treatments. Each subject either received
all treatments from set A or all treatments from set B.
I can compute the N pairwise correlations for all treatments in either set using
cor(). If I take the mean of these N pairwise correlations, I see that the
effects
2012 Jul 04
2
How to generate a correlated binary data set?
Hi.
I am trying to generate a correlated binary data set.
I've tried to use mvtBinaryEP, binarySimCLF, and bindata packages but none
of them works in R version 2.15.1.
Do you know any package to generate correlated binary covariates and work
in R version 2.15.1, or how to generate it?
Thanks,
[[alternative HTML version deleted]]
2009 Nov 12
2
simulated correlated vectors
Hi,
Having a vector x of float type without any assumption of its distribution (mean, variance etc), how to generate another vector that is correlated with x? Extensibility: how to simulate more than two correlated vectors (again float type and no preference for their distribution and without having vector x)?
Cheers,
Carol
2010 Feb 28
1
Gradient Boosting Trees with correlated predictors in gbm
Dear R users,
I’m trying to understand how correlated predictors impact the Relative
Importance measure in Stochastic Boosting Trees (J. Friedman). As Friedman
described “ …with single decision trees (referring to Brieman’s CART
algorithm), the relative importance measure is augmented by a strategy
involving surrogate splits intended to uncover the masking of influential
variables by others
2002 Jan 23
6
multivariate simulation
To whom it may concern,
I try to simulate a non-normal multivariate distribution. The MASS package
allows by mean of "mvrnorm" command to perform a multivariate normal
simulation. Is there an equivalent command for an arbitrary multivariate
distribution available in the R-language?
Thank you in advance.
Bernard Colin
Colin Bernard
Professeur titulaire
D?partement de Math?matiques et