Displaying 20 results from an estimated 20000 matches similar to: "a pickle with ranks and reals?"
2003 Aug 27
1
trying to produce an array of ranks
OK, I am try to produce an array of ranks. I have a set of data (s)
that looks like this
rt subj
312 dave
467 dave
411 dave
383 kim
398 kim
...
Now I want to make a column that is an array of the ranks of rt by
subject. The closest of gotten is using the following.
r <- by (s, s$subj, function(d) rank(d[1]))
This gets the data out with ranks but I cannot figure out how to easily
2002 May 06
3
Spearman rank-order correlation matrix
I"ve got a data frame with a selection of columns I want to compute a
rank-order correlation matrix from without disturbing the original
data frame.
foo[,c("a","b","d","f","g")]
What I wanted to do, intuitively, was:
> cor(rank(foo[,c("a","b","d","f","g")]))
but rank in that context
2006 Oct 08
1
Simulate p-value in lme4
Dear r-helpers,
Spencer Graves and Manual Morales proposed the following methods to
simulate p-values in lme4:
************preliminary************
require(lme4)
require(MASS)
summary(glm(y ~ lbase*trt + lage + V4, family = poisson, data =
epil), cor = FALSE)
epil2 <- epil[epil$period == 1, ]
epil2["period"] <- rep(0, 59); epil2["y"] <- epil2["base"]
2010 Nov 30
3
pca analysis: extract rotated scores?
Dear all
I'm unable to find an example of extracting the rotated scores of a
principal components analysis. I can do this easily for the un-rotated
version.
data(mtcars)
.PC <- princomp(~am+carb+cyl+disp+drat+gear+hp+mpg, cor=TRUE, data=mtcars)
unclass(loadings(.PC)) # component loadings
summary(.PC) # proportions of variance
mtcars$PC1 <- .PC$scores[,1] # extract un-rotated scores of
2008 Sep 06
1
Test for equality of complicatedly related average correlations
Dear R-Users,
I am currently looking for a way to test the equality of two correlations
that are related in a very special way. Let me describe the situation with
an example.
- There are 100 respondents, and there are 2 points in time, t=1 and t=2.
- For each of the respondents and at each of the time points, I have
information on 10 X-variables and on 10 Y-variables.
- Based on this
2008 Feb 28
4
p-value in Spearman rank order
Dear R-helpers,
I would like to do a Spearman rank order test, and used the cor() function
with the method "spearman".
It gives me a number (correlation coefficient?) , but how can I get the
p-value?
Thank you for the help in advance!
Regards,
Anne-Katrin
--
[[alternative HTML version deleted]]
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())
2009 Jan 31
1
display p-values and significance levels
Hi there,
I got a piece of code for the Iris data which allows to display correlation
coefficients for each Iris species in the lower panel (color coded). I would
now like to add e.g. a "*" to show the significance of each correlation next
to the correlation coefficient.
Furthermore I would like to make a t.test between the species "setosa" and
"versicolor" for
2010 Jun 09
1
bug? in stats::cor for use=complete.obs with NAs
Arrrrr,
I think I've found a bug in the behavior of the stats::cor function when
NAs are present, but in case I'm missing something, could you look over
this example and let me know what you think:
> a = c(1,3,NA,1,2)
> b = c(1,2,1,1,4)
> cor(a,b,method="spearman", use="complete.obs")
[1] 0.8164966
> cor(a,b,method="spearman",
2004 Aug 30
1
Wrong result with cor(x, y, method="spearman", use="complete.obs") with NA's???
Hallo!
Is there an error in cor to calculate Spearman
correlation with cor if there are NA's? cor.test gives
the correct result. At least there is a difference.
Or am I doing something wrong???
Does anybody know something about this?
a<-c(2,4,3,NA)
b<-c(4,1,2,3)
cor(a, b, method="spearman", use="complete.obs")
# -0.9819805
cor.test(a, b,
2005 Jan 25
1
spearman rank test correlation
Hallo,
does anybody know if there is an implementation of the Spearman rank
correlation in R that gives a correct (or at least 'safe') p-value in
the case of ties??
I have browsed the R-help archives but I found nothing.
Thanks a lot in advance for any help,
Antonino Casile
2004 Mar 15
1
spearman rank correlation problem
Hello R gurus,
I want to calculate the Spearman rho between two ranked lists. I am
getting results with cor.test that differ in comparison to my own
spearman function:
> my.spearman
function(l1, l2) {
if(length(l1) != length(l2)) stop("lists must have same length")
r1 <- rank(l1)
r2 <- rank(l2)
dsq <- sapply(r1-r2,function(x) x^2)
1 - ((6 * sum(dsq))
2006 Sep 13
1
S in cor.test(..., method="spearman")
Dear HelpeRs,
I have some data:
"ice" <- structure(c(0.386, 0.374, 0.393, 0.425, 0.406, 0.344,
0.327, 0.288, 0.269, 0.256, 0.286, 0.298, 0.329, 0.318, 0.381,
0.381, 0.47, 0.443, 0.386, 0.342, 0.319, 0.307, 0.284, 0.326,
0.309, 0.359, 0.376, 0.416, 0.437, 0.548, 41, 56, 63, 68,
69, 65, 61, 47, 32, 24, 28, 26, 32, 40, 55, 63, 72, 72, 67,
60, 44, 40, 32, 27, 28, 33,
2005 Oct 07
1
cor() function, method="spearman"
Hello,
Does anyone know if the cor function, when method = "spearman", returns a correlation coefficient corrected for any ties in the ranks of the data? I have data with quite a few ties and am thinking that I should use a calculation of the coefficient corrected for ties, but before I try and code this calculation myself, I thought I should check whether or not cor() automatically
2008 Mar 05
2
Correlation matrix one side with significance
Hi there!
In my case,
cor(d[1:20])
makes me a good correlation matrix.
Now I'd like to have it one sided, means only the left bottom side to be
printed (the others are the same) and I'd like to have * where the
p-value is lower than 0.05 and ** lower than 0.01.
How can I do this?
And another thing: Is there a way to output that table as a latex table?
Thanks,
Martin
--
Ihr
2009 Jan 05
1
Error : unused arguments in pairs()
Hi there,
I am just starting in R and this might be a very basic question.
I applied one on the examples of
pairs()
to my own data. The examples shows scatter plots on one side of the matrix
and the correlation coefficients on the other which works well. I then
modified it slightly because I want different colors in the plots. Now i am
getting the error of unused arguments, because the color
2009 Sep 18
1
Within-group correlation confidence intervals
I'm trying to obtain within-group correlations on a subset of variables. I
first selected my variables using the following command:
mydata$x<-mydata[c("iq","education","achievement")]
I'd like to look at correlations among those variables separately for men
and women. My gender variable in mydata is coded 1 (women) and 0 (men).
I have successfully used
2006 Aug 17
1
Simulate p-value in lme4
Dear list,
This is more of a stats question than an R question per se. First, I
realize there has been a lot of discussion about the problems with
estimating P-values from F-ratios for mixed-effects models in lme4.
Using mcmcsamp() seems like a great alternative for evaluating the
significance of individual coefficients, but not for groups of
coefficients as might occur in an experimental design
2006 Jul 10
2
A possible too old question on significant test of correlation matrix
Dear all,
I'm working on a data.frame named en.data, which has n cases and m columns.
I generate the correlation matrix of en.data by
> cor(en.data)
I find that there is no p-value on each correlation in the correlation
matrix. I searched in the R-help mail list and found some related
posts, but I didn't find direct way to solve the problem. Someone said
to use cor.test() or
2011 Dec 23
3
data vector to corresonding percentile ranks
I have a problem where I need to calculate the corresponding cohort
percentile ranks for each of several variables.
Essentially, what I need is a function that will calculate the
distribution-free percentiles from each variable's data vector, returning a
corresponding vector of percentiles:
e.g.:
percentile.my.data<-/function/(my.data)
I tried to make ecdf() perform this task but