search for: corr

Displaying 20 results from an estimated 540 matches for "corr".

Did you mean: core
2009 Aug 16
2
bootstrapped correlation confint lower than -1 ?
Dear R users, Does the results below make any sense? Can the the interval of the correlation coefficient be between *-1.0185* and -0.8265 at 95% confidence level? Liviu > library(boot) > data(mtcars) > with(mtcars, cor.test(mpg, wt, met="spearman")) Spearman's rank correlation rho data: mpg and wt S = 10292, p-value = 1.488e-11 alternative hypothesis: tr...
2010 May 24
1
retrieve path analysis coefficients (package agricolae)
Dear list, I'd like to use path.analysis in the package agricolae in batch format on many files, retrieving the path coefficients for each run and appending them to a table. I don't see any posts in the help files about this package or the path.analysis package. I've tried creating an object out of the call to path.analysis, but no matter what I try, the function automatically prints
2010 Mar 05
1
Error in inherits(x, "data.frame") : subscript out of bounds
Hi, I have a list p with different size dataframes and length of over 8000. I'm trying to calculate correlations between the rows of dataframes of this list and columns of another dataset (type data.frame also) so that first column is correlated with all the rows in the list dataframe. Some information from another dataset is also included to the final output (all.corrs). This worked a couple of...
2010 May 28
2
problem with a function
Hi all, I have a function rho.f which gives a list of estimators. I have the following problems. rho.f(0.3) gives me the right answer. However, if I use rho.f(corr[4]) give me a different answer, even though corr[4]==0.3. This prevents me from using a for loop. Can someone give me some help? Thank you very much in advance. Hannah > rho.f(0.3) $est.1 [1] 0 0 0 0 0 0 $est.2 [1] 0 0 0 0 0 0 $est.3 [1]...
2010 Jan 30
2
convert data frame of values into correlation matrix
Hi Group, Consider a data frame like this: mylabel1 <- rep(c("A","B","C"),each=3) mylabel2 <- rep(c("A","B","C"),3) corrs <- c(1,.8,.7,.8,1,.7,.7,.7,1) myData <- data.frame(mylabel1,mylabel2,corrs) myData mylabel1 mylabel2 corrs 1 A A 1.0 2 A B 0.8 3 A C 0.7 4 B A 0.8 5 B B 1.0 6 B C 0.7 7 C A 0....
2010 Jul 07
1
ifelse statement
Hi, I am a newbie of R, and playing with the "ifelse" statement. I have the following codes: ## first, for(i in 1:3) { for(j in 2:4) { cor.temp <- cor(iris.allnum[,i], iris.allnum[,j]) if(i==1 & j==2) corr.iris <- cor.temp else corr.iris <- c(corr.iris, cor.temp) } } this code is working fine. I also tried to perform the same thing in another way with "ifelse": for(i in 1:3) { for(j in 2:4) { cor.temp <- cor(iris.allnum[,i], iris.allnum[,j]) corr.iris <- ifelse(i==1 & j==2...
2010 Apr 16
3
problem with FUN in Hmisc::summarize
Hi all, I'd like to use the Hmisc::summarize function, but it uses a function (FUN) of a single vector argument to create the statistical summaries. Consider an easy case: I'd like to compute the correlation between two variables in my dataframe, grouped according to other variables in the same dataframe. For exemple, consider the following dataframe D: V1 V2 V3 A 1 -1 A 1 1 A -1 -1 B 1 1 B 1 1 I'd like to use Hmisc::summarize(X=D, by=llist(myvar=D$V...
2006 Mar 25
2
Please help on correlation matrix
hi everyone, Suppose I have three variables a, b, and c each with 10 values. Now I construct a corr matrix for them. Now I want to give the names of columns of corr matrix as a, b, c, i.e. the first column of corr matrix will have name as ‘a’ second column with ‘b’ and so on. Can anyone give me any code by which I can automatically assign the names of columns of corr matrix which are originally t...
2005 Dec 03
1
Correlation matrix from a vector of pairwise correlations
I've a vector of pairwise correlations in the order low-index element precedes the high-index element, say: corr(1,2)=0.1, corr(1,3)=0.2, corr(2,3)=0.3, corr(3,4)=0.4 How can I construct the corresponding correlation matrix? I tried using the "combn"-function in "combinat" package: library(combinat) comb...
2005 Mar 02
1
Warning: number of items to replace is not a multiple of replacement length
...(age) { indic=c(2,2) lage=log(age) xpars=c(2.1862908,7.5528077,8.5806697,2.3319461,8.8959507,9.1380187,0.3720293) beta<-c(0,0) alpha1<-c(0,0) alpha2<-c(0,0) beta[1]<-xpars[1] alpha1[1]<-xpars[2] alpha2[1]<-xpars[3] beta[2]<-xpars[4] alpha1[2]<-xpars[5] alpha2[2]<-xpars[6] corr<-matrix(rep(0,4),nc=2) corr[1,1]=1 corr[2,2]=1 corr[1,2]=xpars[7] corr[2,1]=corr[1,2] LLK<-0 L<-c(0,0) R<-c(0,0) for(j in 1:2){ if(indic[j]==1){ L[j]<--Inf R[j]<-alpha1[j]-beta[j]*lage} if(indic[j]==2){ L[j]<-alpha1[j]-beta[j]*lage R[j]<-alpha2[j]...
2000 Mar 14
1
qr.solve (fwd)
Two friend reported me a problem, which I can't solve: (I run R-1.0.0, Debian Linux) They hava a function "corr.matrix" (see end of mail), and when they create a 173x173 matrix with this function V <- corr.matrix(0.3, n=173) V1 <- qr.solve(V) reports: Error in qr(a, tol = tol) : NA/NaN/Inf in foreign function call (arg 1) For n < 173, qr.solve returns the correct result. Torsten ________...
2010 Feb 12
1
popbio and stochastic lambda calculation
...ntially larger than published. The authors of the published example used a different method to calculate the CIs around lambda, but I would have expected the results of the vitalsim to be closer. (The authors used the 'delta' method from Caswell (2001)). My main questions are: 1. Have I correctly calculated stochastic lambda and its 95% CIs? 2. Why am I unable to use any distributions other than beta? What can I do about that? Thank you, Shawn Morrison ##################################################### #My example: ##################################################### rm(list =...
2009 Apr 19
1
help with this code
...nrow=2, ncol=2, byrow=T) beta <- seq(0, 1, length.out=n+1) alpha <- sort (sapply(1-beta, qnorm)) x <- array(0, dim=c(n, n)) for (s in 1:n) { for (t in 1:n){ if (s>=t) x[s,t] <- pmvnorm(lower=c(alpha[s], alpha[t]),upper=c(alpha[s+1], alpha[t+1]), mean=c(0,0), corr=var)/(s*(s+1)) else x[s,t] <- pmvnorm(lower=c(alpha[s], alpha[t]),upper=c(alpha[s+1], alpha[t+1]), mean-c(0,0), corr=var)/(t*(t+1)) } } n*beta[2]-(n-1)*pmvnorm(lower=c(alpha[n-1],alpha[n-1]), upper=rep(Inf,2), corr=var, mean=c(0,0))+n*(n-1)*sum(x) } I got the error info...
2010 Jun 08
2
problem with if else statement
...ment (med.hyper==1) table(med.hyper) med.hyper 0 1 472 97 I want to subtract 5 mmHg (rr.dia.2m-5) from the measured diastolic blood pressure (rr.dia.2m) if not treated - the value of the measured diastolic blood pressure should remain the same ->my code (data frame is attached !) rr.dia2.corr<-if(med.hyper==1) { rr.dia.2m-5 } else { rr.dia2.corr==rr.dia.2m } R warning Warnmeldung: In if (med.hyper == 1) { : Bedingung hat L?nge > 1 und nur das erste Element wird benutzt "Only first condition is use" which you can see from the result (simply 5 mm was subtracted and the...
2005 Apr 11
2
Trying to undo an assignment
Hi, I defined corr to be a function, not realising that this was also the name for correlation in package=boot. How do I explicitly call the corr function within package boot (so, scope up over the current frame, I guess is another way of saying it) without removing my new corr function ? Thanks, Tolga Please fol...
2013 Mar 04
1
How to loop several binary files from two directories?
I have two binary files(rasters) with the same dimensions. The first file is called `over` and the second is `corr`. I want to replace values in `over` by `NA` whenever `corr` is greater than 0.5. to read the two files we can use: conne <- file("C:corr.bin","rb") over <- readBin(conne, numeric(), size=4, n=1440*720, signed=TRUE) frf <- file("C:cor206...
2016 Apr 29
2
lm() with spearman corr option ?
...panel.border = element_rect( color = "red", size = 3, linetype = "solid", fill = "transparent" ) ) } p } Basically, this function draws red squares over pairwise corr plots with p<0.05. Now, since I need to use the spearman rank corr, I tried to modify the lm function by adding ?method=spearman? but this did not work at al. Could anybody suggest the way to add the spearman rank corr function in this particular function ? Thanks. -------------- next pa...
2008 Aug 13
2
Tiny help for tiny function
...n. I wrote a tiny function to give me back from the original matrix, a matrix showing only the values smaller -0.8 and bigger 0.8. y<-c(0.1,0.2,0.3,-0.8,-0.4,0.9) x<-c(0.5,0.3,0.9,-0.9,-0.7,0.3) XY<-rbind(x,y) extract.values<-function (x) { if(x>=0.8|x<=-0.8)x else("low corr.") } works: Test<-sapply(XY,extract.values,simplify=FALSE) but now I try to solve the problem of having NA in the matrix. I tried like that: extract.values<-function (x) { if(x>=0.8|x<=-0.8|x==NA)x else("low corr.") } woks not: x<-c(0.5,0.3,0.9,-0.9,-0.7,0....
2005 Sep 16
1
corr.test -- use a different null hypothesis
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 First of all, I'm a physicist and therefore I'm not much used to use statistics. So, please forgive me if this is a FAQ or stupid, but I failed to find the answer by myself. I want to use corr.test to test for the correlation of two data sets (actually I have a lot of data set and perform pairwise testing). But I wanted to find sets where the correlation is less than a certain limit, i.e. |r_exp| < r_0. As far as I can see corr.test is designed to work only for the null hypothesis r_e...
2008 May 15
1
logistic transformation using nlminb
...the minimisation I'm using nlminb and to satisfy the first 2 conditions the logistic transformation is used with box constraints for condition 3. However, I don't seem to be able to get the values x that i'm expecting from fitting a simpler model. For example, set.seed(0) # creating a correlation matrix corr <- diag(5) corr[lower.tri(corr)] <- 0.5 corr[upper.tri(corr)] <- 0.5 # Data for the minimisation mat <- rmvnorm(10000, mean=c(3, 2.75, 2.8, 3, 2.9), sd=c(0.1, 0.1,0.12, 0.15, 0.10), cov=corr) # here is the simple optimisation function that allows the 5th element to...