search for: cor1

Displaying 16 results from an estimated 16 matches for "cor1".

Did you mean: com1
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...
2023 Nov 15
2
Cannot calculate confidence intervals NULL
...3,15,18,13,12,14,19,18.5,17.5,12.5,10,9,11,13,14,16,11,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 rep...
2008 Aug 04
1
simulate data based on partial correlation matrix
...wever I'd like to modify it so that it can generate a fifth vector with specific partial correlations rather than zero order correlations: # create x1-x4 x1 <- rnorm(100, 50, 3) x2 <- rnorm(100) + x1/5 x3 <- rnorm(100) + x2/5 x4 <- rnorm(100) + x3/5 # find current correlations cor1 <- cor( cbind(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 corre...
2010 Sep 30
2
panel.pairs in splom
Hello, I have a customized pairs () fonction as follows that displays correctely my data. ------------------------------------------------------------------------ panel.cor1 <- function (x, y, digits=2, prefix="") { usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r <- cor(x, y,use="pairwise.complete.obs", method = meth) if (r>0) {alt<-"greater" } el...
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
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 - - -- -...
2013 Mar 31
1
How to represent certain values in a file as we want?
I have a raster file(1440*720 rows) contains values of 1 ,2 , and 3. when I plot the file , I got a map of three colors but I do not know which is which. How can I put those colors as as I want : 1=red 2=blue 3=green code: pvm <- file("C:\\User_sm-das.bin","rb") cor1<- readBin(pvm, numeric(), size=4, n=1440*720, signed=TRUE) r <-raster(t(matrix((data=cor1), ncol=720, nrow=1440))) image(r) -- View this message in context: http://r.789695.n4.nabble.com/How-to-represent-certain-values-in-a-file-as-we-want-tp4662925.html Sent from the R help mailing list...
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
2000 Mar 28
1
loess.smooth dumps core
...changed? It used to work, but now it causes R to abort with a segmentation fault. I stole the function points.lines() from V&R 1st ed. pp. 67--68, but now it only works if I remove the line with loess.smooth. Here's the function I'm using: points.lines <- function(x, y, ...) { cor1 <-round(cor(x, y, use="pairwise"), digits=2) ok <- !(is.na(x) | is.na(y)) points(x, y, ...) lines(loess.smooth(x=x[ok], y=y[ok]), col=3) abline(coef=c(0, 1)) text(min(x, na.rm=T), max(y, na.rm=T), cor1) } Is this a bug? ________________________________________...
2010 May 03
1
Comparing the correlations coefficient of two (very) dependent samples
...is some other way that might be 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...
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
2010 Aug 25
1
SEM : Warning : Could not compute QR decomposition of Hessian
...oute1_pond, NA, 1 access_hexa->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...
2003 Feb 19
1
getting/storing the name of an object passed to a function
...f class lda from lda()") } } 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(m...
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
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(ne...
2012 May 31
0
ignore NA column in a DF (for calculation) without removing them
...lation matrix. I'm working on a list.files. Here's the function: get.max.cor <- function(station, mat){ mat[row(mat) == col(mat)] <- -Inf which( mat[station, ] == max(mat[station, ],na.rm=TRUE) ) } If I have a correlation matrix like this (no NA-value): cor1 <- read.table(text=" ST208 ST209 ST210 ST211 ST212 ST208 1.0000000 0.8646358 0.8104837 0.8899451 0.7486417 ST209 0.8646358 1.0000000 0.9335584 0.8392696 0.8676857 ST210 0.8104837 0.9335584 1.0000000 0.8304132 0.9141465 ST211 0.8899451 0.8392696 0.8304132 1.0000000 0.8064669...