Displaying 20 results from an estimated 9000 matches similar to: "Pearson corelation and p-value for matrix"
2002 Jan 15
1
acf conf intervals +speed
Hi,
I'm trying to obtain confidence intervals for auto and
cross correlation estimates. I've adapted code made
available by Stock and Watson that uses the Bartlett
Kernel and the delta method. In R it runs really,
really slow because of the loops it uses and I have 9
series that I'd like to examine (81 total
combinations). It was easy enough to replace one of
the while loops with a
2009 Oct 06
2
Viewing specific data from a dataframe
Dear R users,
Simple question. Can anyone help with the code that would allow me to view only the variables who's correlation output is >0.8?
This is the code I'm using to date
>cor(data, method="spearman")
Kind regards
Krys
--------------------------------------------
_________________________________________________________________
Save time by
2008 May 17
1
Correlated Columns in data frame
Dear all,
Sorry to post my query once again in the list, since I did
not get attention from anyone in my previous mail to this
list.
Now I make it simple here that please give me a code for
find out the columns of a dataframe whose correlation
coefficient is below a pre-determined threshold. (For
detailed query please see my previous message to this list,
pasted hereunder)
Thanks and regards,
2010 Dec 02
2
Hmisc label function applied to data frame
Hello,
I'm attempting to create a data frame with correlations between every pair
of variables in a data frame, so that I can then sort by the value of the
correlation coefficient and see which pairs of variables are most strongly
correlated.
The sm2vec function in the corpcor library works very nicely as shown here:
library(Hmisc)
library(corpcor)
# Create example data
x1 = runif(50)
x2 =
2013 Mar 02
3
print method like print.anova()
I have a print method for a set of statistical tests, vcdExtra::CMHtest,
for which I'd like to
have more sensible printing of pvalues, as in print.anova().
[Testing this requires the latest version of vcdExtra, from R-Forge
**|install.packages("vcdExtra", repos="http://R-Forge.R-project.org")|**
]
With my current print method, I get results like this, but all Prob
values
2011 Jul 12
3
Help in error removal
Dear all,
I am new to programming in R.
I deal with microarray data,which is a data frame object type. I need to carry out a few statistical procedures on this, one of them being the pearson corelation. I need to do this between each row which is a gene. So the desired result is a square matrix with the pearson corelation value between each row. So the first column would be (1,1)=0,(1,2),(1,3)
2013 Feb 20
1
Problem with levelplot() in a loop
Dear R users,
I am trying to print heatmaps in a loop (with a pause). Idea is to
visualize changing correlations over time and for testing I wrote this
simple (reproducible) code below.
My problem is that levelplot() does not produce any output when I run the
code (though heatmap does). Ideally I would like to use levelplot() as it
produces a neat index on the side indicating the color and the
2008 Nov 26
2
Very slow: using double apply and cor.test to compute correlation p.values for 2 matrices
My two matrices are roughly the sizes of m1 and m2. I tried using two apply and cor.test to compute the correlation p.values. More than an hour, and the codes are still running. Please help to make it more efficient.
m1 <- matrix(rnorm(100000), ncol=100)
m2 <- matrix(rnorm(10000000), ncol=100)
cor.pvalues <- apply(m1, 1, function(x) { apply(m2, 1, function(y) { cor.test(x,y)$p.value
2005 Feb 25
3
Loops and dataframes
Hi,
I am experiencing a long delay when using dataframes inside loops and was
wordering if this is a bug or not.
Example code:
> st <- rep(1,100000)
> ed <- rep(2,100000)
> for(i in 1:length(st)) st[i] <- ed[i] # works fine
> df <- data.frame(start=st,end=ed)
> for(i in 1:dim(df)[1]) df[i,1] <- df[i,2] #takes for ever
R: R 2.0.0 (2004-10-04)
OS: Linux, Fedora Core 2
2003 Nov 21
3
speeding up a pairwise correlation calculation
Hi,
I have a data.frame with 294 columns and 211 rows. I am calculating
correlations between all pairs of columns (excluding column 1) and based
on these correlation values I delete one column from any pair that shows
a R^2 greater than a cuttoff value. (Rather than directly delete the
column all I do is store the column number, and do the deletion later)
The code I am using is:
ndesc
2008 Nov 27
2
Regression Problem for loop
Dear all,
I have wrote a code for a linear regression. I want to
write a loop for so, that I can get estimate for pavlues for six predictors.
But I am getting for estmate for only last one. How can I get pvalues for
all my predictors in a loop??
Anticipating your help
Thanks
Ales
> mat<-matrix(rnorm(36),nrow=6)
> mat
[,1] [,2] [,3]
2008 Jan 19
1
How do we get two-tailed p-values for rlm?
How do we get 2-tailed p-values for the rlm summary?
I'm using the following:
> fit <- rlm(oatRT ~ oatoacData$erp, psi=psi.bisquare, maxit=100,
na.action='na.omit')
> fitsum <- summary(fit, cor=F)
> print(fitsum)
Call: rlm(formula = oatRT ~ oatoacData$erp, psi = psi.bisquare, maxit = 100,
na.action = "na.omit")
Residuals:
Min 1Q Median
2008 Aug 06
1
Correlation dichotomous factor, continous (numerical) and ordered factor
Hello R-User!
I appologise in advance if this should also go into statistics but I am
presently puzzled.
I have a data.frame (about 300 rows and about 80 variables) and my variables
are dichotomous factors, continuous (numerical) and ordered factors.
I would like to calculate the linear correlation between every pair of my
variables, because I would like to perform a logistic regression (glm())
2008 Oct 24
1
Repetitive correlation test
Dear all,
Through the following code, I wanted to perform correlation test repetedly (through loop) on different combinations of variables of a data set.
Code:
x=read.table("sample.txt",header=T,sep="\t")
out="corout.txt"
sink(out)
nm = names(x)
print(nm)
nvr=3
# nvr=Total no. of variables in the input data file
for (i in 1:(nvr-1))
{
for(j in (i+1):nvr)
{
frm=
2011 May 31
2
correlatation matrix
Hi there,
I wonder if there is a way of efficiently generating a correlation matrix of two expression matrices. I want to correlate miRNA and mRNA expression and used the following code:
##dat.mi miRNA expression matrix, dat.m mRNA expression matrix
nc <- nrow(dat.mi)
cor.mat <- data.frame(rep(NA,nrow(dat.m)))
pval.mat <- data.frame(rep(NA,nrow(dat.m)))
for(i in 1:nc)
{
cr <- vector()
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
2010 Jun 20
2
compute coefficient of determination (R-squared) for GLM (maximum likelihood)
Dear,
I want to compute coefficient of determination (R-squared) to complement AIC
for model selection of
multivariable GLM.
However, I found this is not a built-in function in glm. neither is it
available through reviewing the question in the R-help archive.
Please kindly help and thanks a lot.
Elaine
[[alternative HTML version deleted]]
2008 May 08
2
applying cor.test to a (m, n) matrix
Hi everybody,
I would like to apply cor.test to a matrix with m rows and n columns and get the results in a list of matrices , one matrix for p.val, one for the statistic, one for the correlation and 2 for upper and lower confidence intervals, something analog with cor() applied to a matrix.
I have done my own function to get a matrix of p.values and i suppose i can build similar functions for
2009 Jun 15
1
multcomp: contrasts for count data
Hi,
I would like to derive p-values for pair-wise comparison (Tukey's) of
effects when the response is a count.
I am trying a test case where y ~ Po( lambda(x) ). x has three
levels : A, B and C with lambda(x) = 10, 20 and 20 respectively.
Hence, p-values for the contrast C - B should distribute uniformally.
I have implemented this test case as below but do not get uniform
2007 Oct 26
2
calculating correlation of a Supply/Demand measure and price change (in high frequency time series data)
Regarding "financial" data: I have a high frequency (1 minute) measure of
supply/demand and I'd like to know if it has any influence on short term
price changes (also 1 minute).
Question: How do I calculate the correlation between this supply/demand
measure and price changes (correctly)?
Some facts about that data:
The price changes and supply/demand measure are non-normal. An