Displaying 20 results from an estimated 5000 matches similar to: "bootstrapped correlation confint lower than -1 ?"
2016 Apr 29
2
lm() with spearman corr option ?
Hi,
A following function was kindly provided by GGally?s maintainer, Barret Schloerke.
function(data, mapping, ...) {
p <- ggplot(data = data, mapping = mapping) +
geom_point(color = I("blue")) +
geom_smooth(method = "lm", color = I("black"), ...) +
theme_blank() +
theme(panel.border=element_rect(fill=NA, linetype =
2004 Oct 17
2
Plotcorr: colour the ellipses to emphasize the differences
Hello R users!
I began with R and I must say that it is really nice. I have data with a lot of variables
and have a problem to extract the pattern from correlation matrix. So I tried with plotcorr
and it went fine. While I was reading the help page of this function, I found that ellipse
display can be even better with use of different colors (the code is bellow). However I have
a problem to
2011 Apr 09
3
In need of help with correlations
I am in need of someone's help in correlating gene expression. I'm somewhat
new to R, and can't seem to find anyone local to help me with what I think
is a simple problem.
I need to obtain pearson and spearman correlation coefficients, and
corresponding p-values for all of the genes in my dataset that correlate to
one specific gene of interest. I'm working with mouse Affymetrix
2008 Apr 24
1
Obtaining correlation parameters for multiple rows
Hi,
I would like to obtain correlation parameters (e.g., coefficients, p-value)
for multiple samples in regard to a reference. I have my data in a table
with the reference as the second row (first row are headers) and then each
sample in a row. What I do so far is load up the data, get the reference
sample and use "apply" and "lm" to do the regression:
x <-
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":
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
>
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
2006 Nov 15
1
Correlations not in sync with r2 from regression
I have two variables, minutereturnsa which can be thought of as my
independent variable and minutereturnsb which can be thought of as my
dependent variable. When I run correlations on the two variables,
depending on which of the three methods I use, I get values of between
-.15 through -.19.
Then, when I do a regression, I get an rsquared of .004 which is more in
line with my intuition. In other
2005 Mar 02
1
Warning: number of items to replace is not a multiple of replacement length
I feel like a complete dolt, as I know this question has been asked by
others on a fairly regular basis, but I'm going in circles trying to get
the following to work:
id.prob<-function (tt)
{
library(mvtnorm)
#============================
Makeham<-function(tt)
{
a2=0.030386513
a3=0.006688287
b3=0.039047537
t<-tt-20
h.t<-a2+a3*exp(b3*t)
S.t<-exp(-a2*t+a3/b3*(1-exp(b3*t)))
2010 Feb 12
1
popbio and stochastic lambda calculation
Hello R users,
I am trying to calculate the stochastic lambda for a published matrix
population model using the popbio package.
Unfortunately, I have been unable to match the published results. Can
anyone tell me whether this is due to slightly different methods being
used, or have I gone wrong somewhere in my code?
Could the answer be as simple as comparing deterministic lambdas to
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
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
2009 Apr 19
1
help with this code
Hi, can anyone help me with the following code? Thanks!
library(mvtnorm)
f2 <- function(n, rho) {
var <- matrix(c(1,rho,rho,1), 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],
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)
combn(c(0.1,0.2,0.3,0.4),2)
, but to no avail...
Thank you for your
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 <-
2008 May 15
1
logistic transformation using nlminb
Dear all,
I want to find the optimal values of a vector, x (with 6 elements)
say, satisfying the following conditions:
1. for all x>=0
2. sum(x)=1
3. x[5]<=0.5 and x[6]<=0.5
For 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
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 follow the attached hyperlink to an important disclaimer
2010 Jun 08
2
problem with if else statement
Dear colleagues,
What did I not understand ?
->my intention
I want to create a new variable:
In plain language:
If someone is taking anithypertensive treatment (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
2008 Aug 13
2
Tiny help for tiny function
I just started to write tiny functions and therefore I appologise in advance
if I am asking stupid question.
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
2010 Aug 07
1
[Q] a dummy variable used with sapply
Hello,
While learning how to manipulate data with R, I found one example that I could not understand.
In the following example, the function definition of "maxcor" has an argument named "i" and I don't understand why.
Could someone explain why the maxcor function definition needs to have this argument?
maxcor = function(i, n = 10, m = 5)
{
mat =