Displaying 20 results from an estimated 20 matches for "cor2".
Did you mean:
col2
2023 Nov 15
1
Cannot calculate confidence intervals NULL
I believe the problem is here:
cor1 <- cor(x1, y1, method="spearman")
cor2 <- cor(x2, y2, method="spearman")
The x's and y's are not looked for in data (i.e. NSE) but in the
environment where the function was defined, which is standard evaluation.
Change the above to:
cor1 <- with(d, cor(x1, y1, method="spearman"))
cor2 <- with(d, c...
2023 Nov 15
2
Cannot calculate confidence intervals NULL
...,18,14,13,12,12)
?
# Function to calculate the difference in Spearman coefficients
pearson_diff <- function(data, indices) {
?
# Sample the data
? d <- data[indices, ]
?
?# Calculate the Spearman correlation coefficients for every sample
? cor1 <- cor(x1, y1, method="spearman")
? cor2 <- cor(x2, y2, method="spearman")
?
# Return the difference
? return(cor1 - cor2)
}
?
# Create a data.frame with the data
data <- data.frame(x1, y1, x2, y2)
?
# Use the boot function to apply the bootstrap
set.seed(123) # For reproducibility
bootstrap_results <- boot(data = data,...
2008 Aug 04
1
simulate data based on partial correlation matrix
...nd(x1,x2,x3,x4) )
cor1
# create 1st version of z
z <- rnorm(100)
# combine in a matrix
m1 <- cbind( x1, x2, x3, x4, z )
# center and scale
m2 <- scale(m1)
# find cholesky decomp
c1 <- chol(var(m2))
# force to be independent
m3 <- m2 %*% solve(c1)
# create new correlation matrix:
cor2 <- cbind( rbind( cor1, z=c(.5,.3,.1,.05) ), z=c(.5,.3,.1,.05,1) )
# create new matrix
m4 <- m3 %*% chol(cor2)
# uncenter and unscale
m5 <- sweep( m4, 2, attr(m2, 'scaled:scale'), '*')
m5 <- sweep( m5, 2, attr(m2, 'scaled:center'), '+')
##Check they are...
2005 Nov 01
2
Greek letters in plots
...that others have asked,
but I can't find a reference in either the FAQ or the help pages.
I'm trying to find a way to put Greek letters as a label of the plot
*with* a value from the data. Previously I've used pasted and the word
"rho".
* paste("rho=", cor2[i])
will produce a label of "rho=0.74", or whatever. But if I use
'substitute' or 'evaluate' commands in order to get a real Greek letter,
I lose the ability to paste it with a data value.
Any ideas?
Thanks, Jo
Jo Hardin
Assistant Professor
Department of...
2009 Nov 16
1
extracting values from correlation matrix
Hi! All,
I have 2 correlation matrices of 4000x4000 both with same row names and
column names say cor1 and cor2. I have extracted some information from 1st
matrix cor1 which is something like this:
rowname colname cor1_value
a b 0.8
b a 0.8
c f 0.62
d k 0.59
- - --
-...
2010 Jan 29
2
Vectors with equal sd but different slope
Hi,
what I would need are 2 vector pairs (x,y) and (x1,y1). x and x1 must have
the same sd. y and y1 should also exhibit the same sd's but different ones
as x and x1. Plotting x,y and x1,y1 should produce a plot with 2 vectors
having a different slope. Plotting both vector pairs in one plot with fixed
axes should reveal the different slope.
many thanks
syrvn
--
View this message in
2010 May 03
1
Comparing the correlations coefficient of two (very) dependent samples
...used to tackle this.
#Let's say I have two pairs of samples:
set.seed(100)
s1 <- rnorm(100)
s2 <- s1 + rnorm(100)
x1 <- s1[1:99]
y1 <- s2[1:99]
x2 <- x1
y2 <- s2[2:100]
#And both yield the following two correlations:
cor(x1,y1) # 0.7568969 (cor1)
cor(x2,y2) # -0.2055501 (cor2)
Now for my questions:
1) is cor1 larger then cor2? (CI for the diff ?)
2) With what P value?
3) What if the values of s1 are not independent ?
I found an older thread discussing such issues:
http://tolstoy.newcastle.edu.au/R/e2/help/06/09/1035.html
But wasn't sure how much this might be re...
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
2005 Jul 13
1
help: how to plot a circle on the scatter plot
Hello,
I have a data set with 15 variables, and use "pairs" to plot the
scatterplot of this data set. Then I want to plot some circles on the
small pictures with high correlation(e.g. > 0.9).
First, I use "cor" to obtain the corresponding correlation matrix (x)
for this scatterplot.
Second, use "seq(along = x)[x > 0.9]" to find the positions of the
small
2012 Dec 03
4
How to calculate the spatial correlation of several files?
dir1 <- list.files("C:\\Users\\aalyaari\\Desktop\\cor", "*.bin",
full.names = TRUE)
dir2 <- list.files("C:\\Users\\aalyaari\\Desktop\\cor2", "*.bin",
full.names = TRUE)
results <- list()
for (.files in dir1){ # read in the 365 files as a vector of
numbers for dir1
file1 <- do.call(rbind,(lapply(.files, readBin , integer() , size =
2 ,
n = 360 * 720 , signe...
2003 Feb 19
1
getting/storing the name of an object passed to a function
...quot;)
}
}
group <- as.factor(eval(obj$call[[3]]))
fac.levels <- levels(group)
x <- eval(obj$call[[2]])
x1 <- subset(x, group==fac.levels[1])
x2 <- subset(x, group==fac.levels[2])
s1 <- cov(x1)
s2 <- cov(x2)
cor1 <- cor(x1)
cor2 <- cor(x2)
n1 <- nrow(x1)
n2 <- nrow(x2)
n.vars <- ncol(x)
V <- (1/(n1+n2-2))*(((n1-1)*s1)+((n2-1)*s2))
Vcor <- (1/(n1+n2-2))*(((n1-1)*cor1)+((n2-1)*cor2))
mu1 <- obj$means[1,]
mu2 <- obj$means[2,]
d2 <- mahalanobis(mu1, mu2, V)
d <-...
2004 Nov 16
5
Difference between two correlation matrices
Hi
Now a more theoretical question. I have two correlation matrices - one
of a set of variables under a particular condition, the other of the
same set of variables under a different condition. Is there a
statistical test I can use to see if these correlation matrices are
"different"?
Thanks
Mick
2010 Mar 24
3
help in matlab - r code
...44862745098039,0.458156862745098,0.647843137254902)
ImageWidth = size(data,2); dim(A)[2] # i.e. number of col
MaxOffset = 99; # defined variable, =2R
ImageWidthToProcess = ImageWidth-MaxOffset; # =2R defined variable
for Offset = 1:MaxOffset ; loop to calculate the autocorrelation. basicly,
they do cor2, which I think is Spearman correlation, between every column
and store it in the vector position???
OffsetPlaquette = data(:,1+Offset:ImageWidthToProcess+Offset);
AutoCData(Offset) = corr2(data(:,1:ImageWidthToProcess),
OffsetPlaquette)
end
# IN R would be... but it is not correct! What wo...
2011 Jan 28
1
Please help -- Converting a 2D matrix to 3 columns for graphical representation
Hi,
I am trying to convert a 2D correlation matrix to 3 columns for graphical
representation:
rdata = replicate(100, rnorm(15)) #construct a 2D matrix
c1 = cor(rdata) #outputs a correlation matrix
Now I want to convert the 2D c1 to
(row#, col#, correlation)
1 1 cor1
1 2 cor2
1 3 cor3
...
2 1 cor..
Is there a way to do this?
The main reason I am doing this is to find a correlation based graph for
values >= 0.85 using,
corm <- corm[abs(corm[,3]) >= 0.86, ]
library(network); library(sna)
net <- network(corm, directed = F)
cd <- component.dist(net)
delete...
2012 May 31
0
ignore NA column in a DF (for calculation) without removing them
...696 0.8676857
ST210 0.8104837 0.9335584 1.0000000 0.8304132 0.9141465
ST211 0.8899451 0.8392696 0.8304132 1.0000000 0.8064669
ST212 0.7486417 0.8676857 0.9141465 0.8064669 1.0000000
", header=TRUE)
It works perfectly. If I have a correlation matrix with some NAs (but not
only NAs) like this:
cor2 <- read.table(text="
ST208 ST209 ST210 ST211 ST212
ST208 1.0000000 NA 0.9666491 0.9573701 0.9233598
ST209 NA 1.0000000 0.9744054 0.9577192 0.9346706
ST210 0.9666491 0.9744054 1.0000000 0.9460145 0.9582683
ST211 0.9573701 0.9577192 0.9460145 1.0000000 NA
ST212 0.9233598 0.934...
2010 Aug 25
1
SEM : Warning : Could not compute QR decomposition of Hessian
...route2_pond, acc2, NA
hydro->ind_plando, NA, 1
hydro->long_sup15, eau2, NA
hydro->long_inf15, eau3, NA
topog->pente, NA, 1
topog->est, top2, NA
topog->sud, top3, NA
topog->nord, top4, NA
topog->ouest, top5, NA
dist_protect-> urbanisation, cor1,NA
dist_protect-> adj_99, cor2, NA
dist_protect-> etat_hexa, cor3, NA
topog-> urbanisation, cor4, NA
topog-> adj_99, cor5, NA
topog-> etat_hexa, cor6, NA
topog-> access_hexa, cor7, NA
topog<->hydro, cor8, NA
topog<->pedo, cor9, NA
pedo-> urbanisation, cor10, NA
pedo-> adj_99, cor11, NA
pedo->...
2006 Mar 27
3
graphing and scrolling
Dear R users
graphing with plot(x) seams to work for a small length(x), when length(x) is too large it seams to clutter the display, a solution would be to display subsets of x at a time, yet a better way which I hope R supports is to place a sliding bar on the display window to control length(x) and thus the resolution, which will involve auto scaling the y axis as well as automatically
2009 Apr 29
1
Dynamic visualisation of R data using Adobe FLEX
Hi useRs,
I had posted about Adobe FLEX talking to R for rich visualisation.
Reply from Jeffery Horner contained links to the
revolution-computing.com webpage which had information pertaining to
the Bay Users R group Meetup on Web Dashboards with R.
I have a very specific project that I need to implement.
I wish to use the graphics capabilities provided by Adobe FLEX to
visualise outputs from R.
2011 Jul 29
2
'breackpoints' (package 'strucchange'): 2 blocking error messages when using for multiple regression model testing
Good morning to all,
I am encountering a blocking issue when using the function 'breackpoints'
from package 'strucchange'.
*Context:*
I use a data frame, 248 observations of 5 variables, no NA.
I compute a linear model, as y~x1+...+x4
x4 is a dummy variable (0 or 1).
I want to check this model for structural changes.
*Process & issues:*
*First, I used function Fstats.* It
2009 May 05
1
self organizing map advice for categorical data
...t; Hi Harsh,
>
> If your project is so specific on the regression model, my suggestion
> is to use tcl/tk or Gtk2 interface instead of FLEX, because your
> requirement on interaction is simple (e.g. you don't need to
> drag-and-drop points).
>
> I think the example 'run.cor2.examp()' in 'TeachingDemos' package can
> give you enough inspiration.
>
> Or if you want to do the job (to change the slope) automatically, you
> may want to see the example in the 'animation' package:
>
> ##
> install.packages("animation")
> l...