Re: [R] Covariance between two dichotomous variables

2014-09-04 Thread Greg Snow
If you have 2 dichotomous variables coded 0/1 (and stored as numerics) then the var and cov functions can be used to compute the covariance as if they were continuous variables. Some algebra shows that the continous covariance and the binomial covariance only differ by the denominator (n for binom

[R] Covariance between two dichotomous variables

2014-09-02 Thread Heather Kettrey
Hi, I am trying to test a mediation hypothesis using coefficients from logistic regression analyses (x, m, and y are all dichotomous). I am running a test of significance using MacKinnon and Dwyer's adaptation of Sobel's test (i.e., correcting for different scales of coefficients in cases of a dic

Re: [R] covariance estimate in function sem (Lavaan)

2012-08-10 Thread yrosseel
On 07/30/2012 11:00 PM, Luna wrote: Dear R users, I have a hard time interpreting the covariances in the parameter estimates output (standardized), even in the example documented (PoliticalDemocracy). Can anyone tell me if the estimated covariances are residual covariances (unexplained by the mod

[R] covariance estimate in function sem (Lavaan)

2012-07-30 Thread Luna
Dear R users, I have a hard time interpreting the covariances in the parameter estimates output (standardized), even in the example documented (PoliticalDemocracy). Can anyone tell me if the estimated covariances are residual covariances (unexplained by the model), or the covariances of the obser

Re: [R] Covariance structure for lme

2012-06-30 Thread apcoble
This bit helped me to match lme results in R with SAS, try options(contrasts=c("contr.sum","contr.poly")) before lme model. -- View this message in context: http://r.789695.n4.nabble.com/Covariance-structure-for-lme-tp4630413p4635005.html Sent from the R help mailing list archive at Nab

[R] Covariance matrix in R with non-numeric variables

2012-05-17 Thread nataraj
Dear R help forum members, I am modeling a gaussian distribution for a computational biology application and I am working in the statistical package "R". In this regard, my problem is that I have to construct a covariance matrix with variables (non-numeric) and the covariance matrix is to be us

[R] Covariance structure for lme

2012-05-17 Thread Charles Determan Jr
Greetings again R users, Some of you will likely recognize me but I hope you can help me once more. I have tried the mixed model mailing list for this question but have yet to find a solution. As such I hope someone will have another idea. I have previously attempted to replicate the UN, CS, an

Re: [R] covariance

2012-02-17 Thread Petr Savicky
On Fri, Feb 17, 2012 at 11:06:23PM +0300, Naser Albalwi wrote: > > Thank, thats what I need, using> the built-in help system and R's capability > to allow you to view source code for functions, but how??? Hi. First, type "cov" without quotation marks to R's prompt. The printed code calls .Int

Re: [R] covariance

2012-02-17 Thread Ali2006
could you help with example ?? -- View this message in context: http://r.789695.n4.nabble.com/covariance-tp4398242p4398470.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/l

Re: [R] covariance

2012-02-17 Thread Naser Albalwi
Thank, thats what I need, using> the built-in help system and R's capability to allow you to view source code for functions, but how??? > Date: Fri, 17 Feb 2012 14:55:10 -0500 > Subject: Re: [R] covariance > From: sarah.gos...@gmail.com > To: nasser-d2...@hotmai

Re: [R] covariance

2012-02-17 Thread David Winsemius
On Feb 17, 2012, at 2:36 PM, Ali2006 wrote: can any one please tell me how can I Compute the covariance matrix of (Y) which is 5 variables .. without using a built-in function?? 2) how (cov) works ( I need to get the details for this function ??? http://cran.r-project.org/doc/Rnews/

Re: [R] covariance

2012-02-17 Thread Sarah Goslee
This sounds remarkably like homework. You can address your own issue using the built-in help system and R's capability to allow you to view source code for functions, but we can't help you do your assignments. Sarah On Fri, Feb 17, 2012 at 2:36 PM, Ali2006 wrote: > can any one please tell me how

Re: [R] covariance

2012-02-17 Thread Doran, Harold
n...@r-project.org] On > Behalf Of Ali2006 > Sent: Friday, February 17, 2012 2:37 PM > To: r-help@r-project.org > Subject: [R] covariance > > can any one please tell me how can I Compute the covariance matrix of (Y) > which is 5 variables .. without using a built-in function??

[R] covariance

2012-02-17 Thread Ali2006
can any one please tell me how can I Compute the covariance matrix of (Y) which is 5 variables .. without using a built-in function?? 2) how (cov) works ( I need to get the details for this function ??? -- View this message in context: http://r.789695.n4.nabble.com/covariance-tp439824

[R] covariance matrix of model parameters

2011-10-22 Thread rahul.chhabra
I am applying a hidden markov model on joint multivariate gaussian distribution for 2 vectors. I am using the depmixS4 package in R. Specifically, I am using the following code: mod<-depmix(list(response = mom ~ mkt + p0 + p1, mkt~1), data = regvar, nstates = 2, family = list(gaussian(), gaussia

Re: [R] Covariance-Variance Matrix and For Loops

2011-10-01 Thread sf1979
That's very helpful Michael, thank you. I will add it to the arsenal. -- View this message in context: http://r.789695.n4.nabble.com/Covariance-Variance-Matrix-and-For-Loops-tp3859441p3863098.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Covariance-Variance Matrix and For Loops

2011-10-01 Thread R. Michael Weylandt
Surprising: must be newer update than I realizedanyways, here's the code if you want to add it manually: simplify2array <- function (x, higher = TRUE) { if (length(common.len <- unique(unlist(lapply(x, length > 1L) return(x) if (common.len == 1L) unlist(x,

Re: [R] Covariance-Variance Matrix and For Loops

2011-10-01 Thread sf1979
Hello again, sapply works. However it does not explicitly call a simplify function, but rather seems to handle the case within its own body of code. I should be able to figure out basically what simplify2array does from the code though. function (X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE)

Re: [R] Covariance-Variance Matrix and For Loops

2011-09-30 Thread R. Michael Weylandt
I don't have access to older versions of R right now, but if you have a recent install you are probably running 2.13.1 or 2.13.0. Can you run the following: X <- list(a= rnorm(5), b= rnorm(5)) sapply(X, min) ? sapply calls simplify2array() so if this works take a look at the code for sapply (j

Re: [R] Covariance-Variance Matrix and For Loops

2011-09-30 Thread sf1979
Thank you Michael. I think my initial problem may have been due to a 'clerical error' upriver, so I appreciate you taking the time to give me this help. Unfortunately, my version of R does not contain simplify2array() and does not find it in help (?simplify2array) - which is strange because I jus

Re: [R] Covariance-Variance Matrix and For Loops

2011-09-30 Thread R. Michael Weylandt
Without seeing cvm1_list, I can't guarantee this will work, but consider this: testList = list(rnorm(500), rnorm(500), rnorm(500), rnorm(500), rnorm(500)) testMat = simplify2array(testList) covTest = cov(testMat) Running your code works on my testList, so I can't help there without a reproducible

[R] Covariance-Variance Matrix and For Loops

2011-09-30 Thread sf1979
Hello, I am very new to R (as my Subject probably indicates). I want to do something that should, I think, be very simple. I have five vectors in a list and I want to construct a covariance matrix out of them. Given a 5X5 matrix cvm1, and the list of vectors, cvm1_list, I thought the following w

Re: [R] covariance matrix TL-moments

2011-07-03 Thread J. R. M. Hosking
On 2011-07-03 04:48, osama hussien wrote: The backage lmoments computes the L-moments covariances. does anyone know a backage to compute the TL-moments covariances thank As far as I know the answer is no. But if you study the code of function varLmoments in package nsRFA and see how closely th

[R] covariance matrix TL-moments

2011-07-03 Thread osama hussien
The backage lmoments computes the L-moments covariances. does anyone know a backage to compute the TL-moments covariances thank -- Osama Abdelaziz Hussien Department of Statistics Faculty of Commerce Alexandria University Egypt __ R-help@r-project.org

Re: [R] covariance matrix: a erro and simple mixed model question, but id not know answer sorry

2011-04-18 Thread Maya Joshi
Let me clarify the output I want to create: Source X1 (var) X2 (var) X1&X2 (cov) gen var(X1) var(X2) cov(x1X2) block var(X1) var(X2) cov(x1x2) error/ res var(

[R] covariance matrix: a erro and simple mixed model question, but id not know answer sorry

2011-04-17 Thread Maya Joshi
Dear list I need your help: Execuse me for my limited R knowledge. #example data set set.seed (134) lm=c(1:4) block = c(rep(lm,6)) gen <- c(rep(1, 4), rep(2, 4), rep(3, 4), rep(4, 4),rep(5, 4),rep(6, 4)) X1 = c( rnorm (4, 10, 4), rnorm (4, 12, 6), rnorm (4, 10, 7),rnorm (4, 5, 2), rnorm (4, 8,

[R] covariance matrix

2010-10-24 Thread Marcelo Lima
Hi all, I generated a covariance matrix and visualized as a 2D contour plot (x,y, covariance matrix), I would like to extract from the matrix the values ( in x and y) that auto-correlate which I will plot as an normal (x,y(being the values that auto-corelate to a certain x and y values in my origi

Re: [R] covariance matrix

2010-10-22 Thread Bert Gunter
Unintelligible -- to me anyway. You will have to explain what you mean more explicitly and with greater clarity -- at least for my feeble mind-- to get help. -- Bert Gunter On Fri, Oct 22, 2010 at 11:01 AM, Marcelo Lima wrote: > Dear all, > > I generated a covariance matrix and I would like to g

[R] covariance matrix

2010-10-22 Thread Marcelo Lima
Dear all, I generated a covariance matrix and I would like to generate a 1D plot of the data that auto-correlate. any suggestions? Thanks, Marcelo -- Marcelo Andrade de Lima UNIFESP - Universidade Federal de São Paulo Departamento de Bioquímica Disciplina de Biologia Molecular Rua Três de Maio

[R] covariance matrix structure for random effect in glmmPQL

2010-09-09 Thread Qiu, Weiyu
Dear all, I'm using R function "glmmPQL" in "MASS" package for generalized linear mixed model considering the temporal correlations in random effect. There are 1825 observations in my data, in which the random effect is called "Date", and there are five levels in "Date", each repeats 365 times

[R] COVARIANCE MATRIX FOR RANDOM EFFECTS - nlme

2009-10-11 Thread Charles Obuya Sabatia
R-Help, I been using nlme to fit a model with 2 random effects. The correlation matrix I get with the VarCorr command does not seem to have the correct value for the correlation entry. E.g., below is a VarCorr matrix of random effects from data that I am working on: Variance StdDev

Re: [R] covariance

2009-04-19 Thread Marc Schwartz
Depending upon the size of the matrix, using: diag(cov(t(x), t(y))) might be notably faster. On smaller matrices the time savings is negligible. Using Jorge's example below: > diag(cov(t(X), t(Y))) [1] 0.23396819 0.51455839 1.13851842 -4.30551345 -2.60720372 [6] -0.06834326 0.783441

Re: [R] covariance

2009-04-19 Thread Jorge Ivan Velez
Dear Benny, Here is something that could get you a hint: # Some data set.seed(123) X <- matrix(rnorm(100),ncol=10) Y <- matrix(rnorm(100,2,4),ncol=10) # Number of rows n<-nrow(X) # Covariances sapply(1:n,function(i) cov(X[i,],Y[i,])) # [1] 0.23396819 0.51455839 1.13851842 -4.30551345 -2.60720

Re: [R] covariance

2009-04-19 Thread Gábor Csárdi
sapply(seq_len(nrow(x)), function(i) var(x[i,], y[i,])) Gabor On Sun, Apr 19, 2009 at 7:12 PM, Benny Chain wrote: > Does anyone know a way to calculate the covariances between two > arrays/matrices x and y, row by row. i.e. var(x[n,],y[n,]) for all n ? > > Benjamin Chain > Division of Infection

[R] covariance

2009-04-19 Thread Benny Chain
Does anyone know a way to calculate the covariances between two arrays/matrices x and y, row by row. i.e. var(x[n,],y[n,]) for all n ? Benjamin Chain Division of Infection and Immunity Windeyer Building UCL, 46 Cleveland St. London W1T 4JF Fax 00 44 20 7679 9301 __

[R] Covariance structure determination when lmer has false convergence.

2008-08-11 Thread Todd Remund
I have fit a model with a more complex covariance structure, but the fit reports a false convergence. I have read from past posts that this can be an indication of over-specification. I went ahead and fit a model with a simpler covariance structure. It doesn't seem like I can compare the two

Re: [R] Covariance matrix

2008-08-07 Thread Moshe Olshansky
Just interchange rows 2 and 3 and then columns 2 and 3 of the original covariance matrix. --- On Fri, 8/8/08, Zhang Yanwei - Princeton-MRAm <[EMAIL PROTECTED]> wrote: > From: Zhang Yanwei - Princeton-MRAm <[EMAIL PROTECTED]> > Subject: [R] Covariance matrix > To:

[R] Covariance matrix

2008-08-07 Thread Zhang Yanwei - Princeton-MRAm
Hi all, Assume I have a random vector with four variables, i.e. A=(a,b,c,d). I am able to get the covariance matrix of vector A, but how can I get the covariance matrix of vector B=(a,c,b,d) by manipulating the corresponding covariance matrix of A? Thanks. Sincerely, Yanwei Zhang Department

Re: [R] covariance matrix of the regression coefficients

2007-10-29 Thread Doran, Harold
Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of A. Beaujean > Sent: Monday, October 29, 2007 4:25 PM > To: Peter B. Mandeville > Cc: r-help > Subject: Re: [R] covariance matrix of the regression coefficients > > If X is your p-1 variable matrix (with

Re: [R] covariance matrix of the regression coefficients

2007-10-29 Thread A. Beaujean
If X is your p-1 variable matrix (with the first column vector being 1s), i.e., nrow(X)=n and ncol(X)=p then MSE<-summary(lm(Y~X[2]+X[3] + ...X[P-1]))$s^2 and your coefficient (co)variance matrix is MSE*ginv(t(X)%*%X) Best, Alex On 10/29/07, Peter B. Mandeville <[EMAIL PROTECTED]> wrote: > >

Re: [R] covariance matrix of the regression coefficients

2007-10-29 Thread John Fox
Dear Peter, See ?vcov. You could have discovered this via help.search("covariance"). I hope this helps, John On Mon, 29 Oct 2007 11:30:11 -0600 "Peter B. Mandeville" <[EMAIL PROTECTED]> wrote: > Greetings, > > > > Cohen, Cohen, West, and Aiken 2003 (Applied Multiple > Regression-Correlatio

Re: [R] covariance matrix of the regression coefficients

2007-10-29 Thread Peter Dalgaard
Peter B. Mandeville wrote: > Greetings, > > > > Cohen, Cohen, West, and Aiken 2003 (Applied Multiple Regression-Correlation > Analysis for the Behavioral Sciences, Third Edition) on page 273 state the > covariance matrix of the regression coefficients is provided by standard > programs for multip

Re: [R] covariance matrix of the regression coefficients

2007-10-29 Thread Ravi Varadhan
adhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter B. Mandeville Sent: Monday, October 29, 2007 1:30 PM To: r-help@r-project.org Subject: [R] covariance matrix of the regression coefficients Greetings, Cohen, Cohen, West, and Aiken 2003 (Applie

Re: [R] covariance matrix of the regression coefficients

2007-10-29 Thread Prof Brian Ripley
See ?vcov . On Mon, 29 Oct 2007, Peter B. Mandeville wrote: > Greetings, > > > > Cohen, Cohen, West, and Aiken 2003 (Applied Multiple Regression-Correlation > Analysis for the Behavioral Sciences, Third Edition) on page 273 state the > covariance matrix of the regression coefficients is provided

[R] covariance matrix of the regression coefficients

2007-10-29 Thread Peter B. Mandeville
Greetings, Cohen, Cohen, West, and Aiken 2003 (Applied Multiple Regression-Correlation Analysis for the Behavioral Sciences, Third Edition) on page 273 state the covariance matrix of the regression coefficients is provided by standard programs for multiple regression, including SAS, SPSS, and S

[R] covariance matrix of the regression coefficients

2007-10-29 Thread Peter B. Mandeville
Greetings, On page 273, Cohen, Cohen, West, and Aiken (Applied Multiple Regression/Correlation Analysis for the Behavioral Sciences, Third Edition", state that the covariance matrix of the regression coefficients is provided by standard programs for multiple regression, including SAS, SPSS, an

[R] covariance matrix of the regression coefficients

2007-10-29 Thread Peter B. Mandeville
Greetings, Cohen, Cohen, West, and Aiken 2003 (Applied Multiple Regression-Correlation Analysis for the Behavioral Sciences, Third Edition) on page 273 state the covariance matrix of the regression coefficients is provided by standard programs for multiple regression, including SAS, SPSS, and S