similar to: Sample covariance matrix in R

Displaying 20 results from an estimated 7000 matches similar to: "Sample covariance matrix in R"

2010 Oct 18
1
Looking for covariance function -OR- how do you search
Hello everyone., I am looking for a covariance function this not the first time I have this type of problem (to find which function does something). I try in google with "R cran covariance function" but usually this ends with different results that do not help me that much. Could you please try to advice me how to search for what function implements the functionality you want.
2011 Sep 30
3
is member
Dear all, I have a vector with number that some of them are part of the   seq(1,800,4). How can I check which of the numbers belong to the seq(1,800,4)   LEt's say that is called myvector the vector with the numbers. Is there in R something like this? is.member(myvector,seq(1,800,4))   I would like to thank you in advance for your help   B.R Alex [[alternative HTML version deleted]]
2012 Mar 10
2
Window on a vector
Dear all, I have a large vector (lets call it myVector) and I want to plot its value with the logic below yaxis<-myVector[1] yaxis<-c(xaxis,mean(myvector[2:3]) yaxis<-c(xaxis,mean(myvector[4:8]) yaxis<c(xaxis,mean(myvector[9:16]) yaxis<c(xaxis,mean(myvector[17:32]) this has to stop when the new ..... yaxis<c(xaxis,mean(myvector[1024:2048]) will not find the correspondent number
2012 Mar 22
2
Create weird type of sequences
Dear all, I would like to create the following sequence of numbers 1 2 2 3 3 3 3 4 4 4 4 4 4 4 4 and so on (actually I double the number of same elements).... the reason is that I want then to feed the sequence above to  tapply(myVector, weirSeq, FUN = mean) and then average over those... Could you please provide some guidance how I can create such a sequence in R? Regards Alex
2012 Mar 24
1
plotting with line types... bit confusing
Dear all, I would like to print an empirical cdf on a vector I have while the plot(ecdf(myVector)) works great when I try to specify the line type to be a line (I get points) with plot(ecdf(myVector),type="lines") Error in plot.default(NA, NA, type = "n", xlim = xlim, ylim = ylim, xlab = xlab,  :   formal argument "type" matched by multiple actual arguments I get
2005 Nov 16
6
nlme question
I am using the package nlme to fit a simple random effects (variance components model) with 3 parameters: overall mean (fixed effect), between subject variance (random) and within subject variance (random). I have 16 subjects with 1-4 obs per subject. I need a 3x3 variance-covariance matrix that includes all 3 parameters in order to compute the variance of a specific linear
2006 Apr 13
3
Penalized Splines as BLUPs using lmer?
Dear R-list, I?m trying to use the lmer of the lme4 package to fit a linear mixed model of the form Y = Xb + Zu + e and I can?t figure out how to control the covariance structure of u. I want u ~ N(0,sigma^2*I). More precisely I?m trying to smooth a curve through data using the "Penalized Splines as BLUPs" method as described in Ruppert, Wand & Carroll (2003). So I have Z = [Z1
2012 Mar 12
3
how to calculate a variance and covariance matrix for a vector
Hello, I have a vector {a, b1, b2, b3, b4}. How can I calculate the following matrix: var(a) cov(a, b1) cov(a, b2) cov(a, b3) cov(a, b4) cov(a, b1) var(b1) cov(a, b2) cov(a, b3) cov(a, b4) ... ... cov(a, b1) cov(a, b2) cov(a, b3) cov(a, b4) var(b4) I would very appreciate your inputs. Thank you very much. Sincerely, Jialin Huang [[alternative HTML version deleted]]
2010 Jul 19
1
Calculation of Covariance Matrix Calculation
Hi, Excuse me for asking this silly question. But I really couldn't understand why cov() and ccov() don't work for my calculation of covariance matrix. a <- matrix(1:8, 2, 4) a [,1] [,2] [,3] [,4] [1,] 1 3 5 7 [2,] 2 4 6 8 > ccov(a) Error in solve.default(cov, ...) : Lapack routine dgesv: system is exactly singular I also tried colume bind, but it
2007 Feb 06
3
How-To construct a cov list to use a covariance matrix in factanal?
Hi, I have a set of covariance matrices but not the original data. I want to carry out some exploratory factor analysis. So, I am trying to construct a covariance matrix list as the input for factanal. I can construct a list which includes the cov, the centers, and the n.obs. But it doesn't work. I get an error that says "Error in sqrt(diag(cv)) : Non-numeric argument to mathematical
2008 Jun 26
2
constructing arbitrary (positive definite) covariance matrix
Dear list, I am trying to use the 'mvrnorm' function from the MASS package for simulating multivariate Gaussian data with given covariance matrix. The diagonal elements of my covariance matrix should be the same, i.e., all variables have the same marginal variance. Also all correlations between all pair of variables should be identical, but could be any value in [-1,1]. The problem I am
2010 Mar 27
3
Calculate variance/covariance with complex numbers
Anybody knows what functions can be used to calculate variance/covariance with complex numbers? var and cov don't seem to work: > a 1 V1 0.00810014+0.00169366i V2 0.00813054+0.00158251i V3 0.00805489+0.00163295i V4 0.00809141+0.00159533i V5 0.00813976+0.00161850i > var(a) 1 1 1.141556e-09 Warning message: In var(a) : imaginary parts discarded in
2012 Feb 17
4
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?????? 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-tp4398242p4398242.html Sent from the R help mailing list archive at Nabble.com.
2011 Apr 18
1
covariance matrix: a erro and simple mixed model question, but id not know answer sorry
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, 4), rnorm (4,7, 2)) X2 = X1 + rnorm(length(X1), 0,3) yvar <- c(X1, X2) X <- c(rep( 1,
2013 Mar 08
1
getting covariance ignoring NaN missing values
Hi all, I have a matrix that has many NaN values. As soon as one of the columns has a missing (NaN) value the covariance estimation gets thrown off. Is there a robust way to do this? Thanks, Sachin a=array(rnorm(9),dim=c(3,3))> a [,1] [,2] [,3] [1,] -0.79418236 0.7813952 0.855881 [2,] -1.65347906 -1.9462446 -0.376325 [3,] -0.03144987 0.6756862 -1.879801>
2007 Sep 26
1
Accessing the fixed- and random-effects variance-covariance matrices of an nlme model
I would appreciate confirmation that the function vcov(model.nlme) gives the var-cov matrix of the fixed effects in an nlme model. Presumably the random-effects var-cov matrix is given by cov(ranef (model.nlme)? Rob Forsyth
2006 May 20
5
Can lmer() fit a multilevel model embedded in a regression?
I would like to fit a hierarchical regression model from Witte et al. (1994; see reference below). It's a logistic regression of a health outcome on quntities of food intake; the linear predictor has the form, X*beta + W*gamma, where X is a matrix of consumption of 82 foods (i.e., the rows of X represent people in the study, the columns represent different foods, and X_ij is the amount of
2009 Dec 04
1
how to calculate covariance matrix in R? why cov doesn't work
Hello, Sorry. It may be a stupid question. I have two vectors a<-c(9,3,5) b<-c(3,4,1) How can I get the variance-covariance matrix of these two vectors? I tried cov(a,b), I got a number not a matrix. I tried to transpose vector a and b as t(a) and t(b), it still cannot work. Any suggestions? Thank a lot! -- View this message in context:
2011 Sep 30
1
Covariance-Variance Matrix and For Loops
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 would work (sorry cannot find code tags): for(i in 1:5){ for(j in 1:5){ cvm1[i,j] <-
2005 Jan 20
3
Constructing Matrices
Dear List: I am working to construct a matrix of a particular form. For the most part, developing the matrix is simple and is built as follows: vl.mat<-matrix(c(0,0,0,0,0,64,0,0,0,0,64,0,0,0,0,64),nc=4) Now to expand this matrix to be block-diagonal, I do the following: sample.size <- 100 # number of individual students I<- diag(sample.size) bd.mat<-kronecker(I,vl.mat) This