Displaying 20 results from an estimated 4000 matches similar to: "how to calculate covariance matrix in R? why cov doesn't work"
2010 Jul 23
4
how to calculate the product of every two elements in two vectors
Thanks in advance!
A=c(1, 2,3)
B=c (9, 10, 11, 12)
I want to get C=c(1*9, 1*10, 1*11, 1*12, ....., 3*9, 3*10, 3*11, 3*12)?
C is still a vector with 12 elements
Is there a way to do that?
--
View this message in context: http://r.789695.n4.nabble.com/how-to-calculate-the-product-of-every-two-elements-in-two-vectors-tp2300299p2300299.html
Sent from the R help mailing list archive at Nabble.com.
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
2013 Mar 14
1
ggplot2 problem
Hello all!
I have a problem with ggplot2 library. I want to do an heat map and the y
variables are the year months. If I use the following code, he y values are
in alphabetical order, but I want it in month order.
The code is:
library(reshape)
library(ggplot2)
library(scales)
p <- ggplot(data.m, aes(variable, Month)) + geom_tile(aes(fill = value),
2009 Dec 04
2
how to seperate a matrix
Hello,
I am working on seperate the matrix to two matrices but got trouble on doing
it. Please give me some suggestions on doing this. Thanks a looooooooooooot!
My original matrix m is as follows for example,
[,1] [,2] [,3]
[1,] 6 8 1
[2,] 5 9 2
[3,] 20 10 3
[4,] 7 11 4
[5,] 8 12 5
[6,] 25 13 6
[7,] 14 14 7
I want to generate two
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 Feb 22
2
how do I calculate means or cov matrix for multivariate groups
Hello,
Having the matrix d
> d
value value2 class
1 1 1 x
2 2 2 x
3 3 3 x
4 4 2 x
5 5 1 y
6 11 3 y
7 12 4 z
8 13 5 z
9 14 6 z
10 15 7 z
I want to calculate the means and cov matrix for groups x,y,z.
I know how to do it the long way.
I tried to use tapply and
2010 Jan 04
3
how to draw abline correctly?
Hello, I am frastruated with this graph, just cannot get what I need. Thank
you for any suggestions or help. I really appreciate it. I wrote the
following code, but there are 3 problems
1, the red line is added on the graph but without any marker on the y-axis.
I want to display the number '.1361' on the y-axis. So people can easily
tell 'method 2' gets a constant estimate, which
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
2010 Feb 18
3
Can R make an usual dotplot
Dear R experts,
Can R make an usual dotplot just like Minitab and other softwares?
I have the following data, and can use dotchart to graph a dotplot:
y=c(2.873438152e-01, -8.732895642e-01,
4.579001889e-01, 1.047395204e+00,
8.491182299e-02 , -1.938007105e+00,
-1.273708343e+00, 9.848010588e-05,
7.238490734e-01, -1.490552717e+00)
dotchart(y, xlab="10 observations from
2010 Oct 11
2
Trouble accessing cov function from stats library
Dear all
I am trying to use the cov function in the stats library. I have no problem using this function from the console. However, in my R script I received a "function not found" message. Then I called stats::cov(...) and received an error message that the function was not exported. Then I tried stats:::cov (three colons) and received the error
Error in get(name, envir =
2006 Mar 10
1
what's wrong with my "cov"?
Hi all,
Why cov(y, y) only gives one value, and cov(t(y), t(y)) gives 3x3 NA matrix?
Here my y is listed below and it is a 3x1 matrix.
I am expecting that if I have a random vector y=[y1 y2 y3]', here " ' "
denotes a transposition so that
y is a column vector, where y1, y2, y3 are independent random variables...
then cov(y, y) should be
E[ y * y' ] - E[y] * E[y] ',
2009 Dec 02
2
calculation problem when export and import data
Hello,
I have a question on export and import data. Thank you for any suggestions.
data 'simul' is generated as follows:
N <- 20
n <- N/2
nsets <- 10
simul <- matrix(0,nsets,N)
th <- c(0,1, 1)
for(i in 1:nsets){
simul[i,] <- rnorm(N,mean= rep(th[1:2],N/2),sd=th[3])
}
I exported data as follows:
write.table(simul,
2019 Jan 22
2
How to add new arch for llvm-cov show?
Hi all,
I'm trying to support llvm-cov for a new architecture and I have successfully built compiler-rt for my arch. Following steps shown in https://clang.llvm.org/docs/SourceBasedCodeCoverage.html , I encountered an error for the last step(step of llvm-cov show).
The command line was (supposed my arch is XXXX)
"llvm-cov show -arch=XXXX ./foo -instr-profile=foo.profdata"
and the
2016 Mar 03
2
[LLVMDev] llvm-cov outputting coverage results as HTML reports
Dear All,
I am helping our test team migrate from gcov to llvmcov. They currently
generate HTML reports using lcov to easily navigate where coverage is
missing. However, there does not seem to be a Windows compatible solution
for generating HTML reports using the llvm-cov tools.
A possible solution to this problem is for llvm-cov to create html pages
that include an overall coverage summary
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
2016 Aug 12
2
A nicer HTML index page for llvm-cov
I've been working on adding code coverage support to my ELLCC project
(http://ellcc.org) and I thought it would be nice to fun the index page
of the HTML output of llvm-cov into something a little prettier and more
useful.
The initial result is here: http://ellcc.org/coverage/
If there is any interest, I'll submit the llvm-cov changes.
-Rich
1998 Feb 23
1
R-beta: Help: cov.mve in R? dgamma in Splus?
Hi all
I have a couple of obscure questions for R/Splus experts (which
unfortunately isn't me!)
I am trying to compute Bayes Factors using some Splus code of Raftery
in Gilks et al (1996). Only problem is
1) R doesn't seem to have a robust covariance (cov.mve) which I
suspect I need rather than a non-robust classical estimate
2) Splus has cov.mve BUT dgamma in Splus doesn't have a
2007 Aug 14
1
cov.unscaled in gls object
Hi list,
can I extract the cov.unscaled ("the unscaled covariance matrix") from a
gls fit (package nlme), like with summary.lm? Background: In a fixed
effect meta analysis regression the standard errors of the coefficients
can be computed as sqrt(diag(cov.unscaled)) where cov.unscaled is
(X'WX). I try do do this with a gls-fit.
Thanks, Sven
2016 Mar 04
2
llvm-cov accepting many binary files for aggregated coverage reports
Hi All,
I want to provide a solution that presents code coverage reports that
include the aggregated code-counts across many binaries. Our test
engineers currently do this using gcov-mode by merged .gcda data files. We
can do a similar merge of the .profraw files, so that the many binaries are
represented in one .profdata file; However, llvm-cov will only generate
reports based on one binary at
2006 Feb 08
3
rob var/cov + LAD regression
Hi,
after looking around I was not able to get info about these two questions:
1. Is there a function to have a "jackknifed corrected var/cov estimate" (as described in MacKinnon and White 1985) in a standard OLS regression?
2. Does R possess a LAD (Least Absolute Deviation) regression function?
Any help?
Thanks
--
========================================================
Angelo