similar to: How to generate a matrix with a specific correlation (matrix)

Displaying 20 results from an estimated 10000 matches similar to: "How to generate a matrix with a specific correlation (matrix)"

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
2007 Apr 05
1
Generate a serie of new vars that correlate with existingvar
Hello, list why not add the smart proposal by Greg Snow as a built-in function in {stats}, just changing the "x234" and "newc" lines to allow for more distributions to be generated ? Or do I miss an already existing function to do that ? Regards. Olivier # slight modification of the original code by Greg Snow [mailto:Greg.Snow at intermountainmail.org] # on April 04, 2007
2009 Jul 07
6
Uncorrelated random vectors
Hello, is it possible to create two uncorrelated random vectors for a given distribution. In fact, I would like to have something like the function "rnorm" or "rlogis" with the extra property that they are uncorrelated. Thanks for your help, Luba [[alternative HTML version deleted]]
2008 Sep 18
2
Difficulty understanding sem errors / failed confirmatory factor analysis
Hello, I'm trying to fit a pretty simple confirmatory factor analysis using the sem package. There's a CFA example in the examples, which is helpful, but the output for my (failing) model is hard to understand. I'd be interested in any other ways to do a CFA in R, if this proves troublesome. The CFA is replicating a 5 uncorrelated-factor structure (for those interested, it is a
2003 Jun 13
5
covariate data errors
Greetings, I would like to fit a multiple linear regression model in which the residuals are expected to follow a multivariate normal distribution, using weighted least squares. I know that the data in question have biases that would result in correlated residuals, and I have a means for quantifying those biases as a covariance matrix. I cannot, unfortunately, correct the data for these biases.
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
2012 Mar 19
2
hypergeometric function in ‘ mvtnorm’
Is there any way to know how the "dmvt" function computes the hypergeometric function needed in the calculation for the density of multivariate t distribution? -- View this message in context: http://r.789695.n4.nabble.com/hypergeometric-function-in-mvtnorm-tp4483730p4483730.html Sent from the R help mailing list archive at Nabble.com.
2011 Aug 12
1
Which Durbin-Watson is correct? (weights involved) - using durbinWatsonTest and dwtest (packages car and lmtest)
Hello! I have a data frame mysample (sorry for a long way of creating it below - but I need it in this form, and it works). I regress Y onto X1 through X11 - first without weights, then with weights: regtest1<-lm(Y~., data=mysample[-13])) regtest2<-lm(Y~., data=mysample[-13]),weights=mysample$weight) summary(regtest1) summary(regtest2) Then I calculate Durbin-Watson for both regressions
2008 Aug 04
1
simulate data based on partial correlation matrix
Given four known and fixed vectors, x1,x2,x3,x4, I am trying to generate a fifth vector,z, with specified known and fixed partial correlations. How can I do this? In the past I have used the following (thanks to Greg Snow) to generate a fifth vector based on zero order correlations---however I'd like to modify it so that it can generate a fifth vector with specific partial
2002 Mar 08
1
Random data with correlation
Hello all. First of all, I have only been using are a short time and I'm not an expert in statistics either. I have the following problem. I'm working with measurements of physical samples, each measurement has about 4000 variables. I have 33 of those samples. From those 400 variables I deduced through non-statiscal means that I needed about 200 of them. I read those into a data.frame
2001 Aug 19
2
error message in chol() (PR#1061)
Full_Name: Jerome Asselin Version: 1.3.0 OS: Windows 98 Submission from: (NULL) (24.77.112.193) I am having accuracy problems involving the computation of inverse of nonnegative definite matrices with solve(). I also have to compute the Choleski decomposition of matrices. My numerical problems involving solve() made me find a bug in the chol() function. Here is an example. #Please, load the
2004 Dec 12
2
Help : generating correlation matrix with a particular structure
Hi, I would like to generate a correlation matrix with a particular structure. For example, a 3n x 3n matrix : A_(nxn) aI_(nxn) bI_(nxn) aI_(nxn) A_(nxn) cI_(nxn) aI_(nxn) cI_(nxn) A_(nxn) where - A_(nxn) is a *specified* symmetric, positive definite nxn matrix. - I_(nxn) is an identity matrix of order n - a, b, c are (any) real numbers Many attempts have been unsuccessful because a
2006 Oct 12
2
Problem loading SpareM package
Hi, I have just installed R 2.4.0 and when I try to load SpareseM, I get the following error message library(SparseM) Package SparseM (0.71) loaded. To cite, see citation("SparseM") Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'SparseM' methods specified for export, but none defined: as.matrix.csr, as.matrix.csc,
2007 Sep 26
2
generate fourth vector based on known correlations
I am trying to generate a fourth vector,z, given three known and fixed vectors, x1,x2,x3 with corresponding known and fixed correlations with themeselves and with z. That is, all correlations are known and prespecified. How can I do this? Thank you, ben
2009 May 26
2
(OT) Does pearson correlation assume bivariate normality of the data?
Dear all, The other day I was reading this post [1] that slightly surprised me: "To reject the null of no correlation, an hypothsis test based on the normal distribution. If normality is not the base assumption your working from then p-values, significance tests and conf. intervals dont mean much (the value of the coefficient is not reliable) " (BOB SAMOHYL). To me this implied that in
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 Dec 05
1
Question about lrandom effects specification in lme4
Folks: Suppose I have 3 random effects, A,B, and C. Using the older lme() function (in nlme) it was possible (using the pdMat classes) to specify that they are uncorrelated with identical variances. Is it possible to do this with lmer? My understanding is that if I specify them as lmer( y ~ ... + (A|Grp) + (B|Grp) + (C|Grp)) then they are uncorrelated but have different variances. Motivation:
2008 Jan 06
2
how to get residuals in factanal
In R factanal output, I can't find a function to give me residuals e. I mannually got it by using x -lamda1*f1 -lamda2*f2 - ... -lamdan*fn, but the e I got are not uncorrelated with all the f's. What did I do wrong? Please help. Yijun ____________________________________________________________________________________ Be a better friend, newshound, and
2011 Feb 09
2
Generate multivariate normal data with a random correlation matrix
Hi All. I'd like to generate a sample of n observations from a k dimensional multivariate normal distribution with a random correlation matrix. My solution: The lower (or upper) triangle of the correlation matrix has n.tri=(d/2)(d+1)-d entries. Take a uniform sample of n.tri possible correlations (runi(n.tr,-.99,.99) Populate a triangle of the matrix with the sampled correlations Mirror the
2012 Jul 31
2
Significance of correlation
Hi, I understand that to test the significance of correlation between two PAIRED variables, the function, cor.test () can be used. However, in my case, I have tested the correlation (i.e., Correlation Coefficient, r) between two independent (i.e, different) variables, and now I wish to test for the statistical significance of the correlation. Could you please suggest how I should do that. Thank