Displaying 20 results from an estimated 10000 matches similar to: "Barplots and error indicators: Some R-Code"
2012 Apr 25
1
recommended way to group function calls in Sweave
Dear all
When using Sweave, I'm always hitting the same bump: I want to group
repetitive calls in a function, but I want both the results and the
function calls in the printed output. Let me explain myself.
Consider the following computation in an Sweave document:
summary(iris[,1:2])
cor(iris[,1:2])
When using these two calls directly, I obtain the following output:
> summary(iris[,1:2])
2006 Sep 11
2
Translating R code + library into Fortran?
Hi all,
I'm running a monte carlo test of a neural network tool I've developed,
and it looks like it's going to take a very long time if I run it in R
so I'm interested in translating my code (included below) into something
faster like Fortran (which I'll have to learn from scratch). However, as
you'll see my code loads the nnet library and uses it quite a bit, and I
2005 Apr 13
2
extracting one element of correlation matrices from a list poroduced by the 'by' statement
I am producing 2X2 correlation matrices by a class variable. I need to
extract a vector of correlation coefficients only. I am doing that in a
loop (see below) but I am sure there would be a simpler way. Please
help!
> by(d1[,c(2,3)],d1[,1],cor)
d1[, 1]: 1
c e
c 1.0000000 0.1972309
e 0.1972309 1.0000000
2000 Feb 24
2
(-1 as index) OR (envelope for QQ)
I'm new to R (and to S) and am wondering about code from pages 72 and
83 of MASS (Venables+Ripley, 3rd edition), to draw an envelope on a QQ
plot. Copying from the book, I've got:
#... code whose gist is "a.fit <- nls(..."
num.points <- length(resid(a.fit))
qqnorm(residuals(a.fit)) # illustrate data-model residuals
qqline(residuals(a.fit))
samp <-
2002 Oct 08
2
sem (lisrel) - starting problems
Hi,
(1.)
How is it possible to get automatic a "lower triangle of correlation matrix" ?
h.cor <- cor(dat,use="pairwise.complete.obs")
zz <- lower.tri(h.cor,diag=T)
### that's not what i wish and "wrong" ?
results <- matrix(unlist(h.cor[upper.tri(h.cor,diag=T)]))
results <- matrix(unlist(h.cor[upper.tri(h.cor,diag=T)]),5)
Must i take the lowest
2009 Feb 12
3
get top 50 correlated item from a correlation matrix for each item
Hi,
I have a correlation matrix of about 3000 items, i.e., a 3000*3000
matrix. For each of the 3000 items, I want to get the top 50 items that
have the highest correlation with it (excluding itself) and generate a
data frame with 3 columns like ("ID", "ID2", "cor"), where ID is those
3000 items each repeat 50 times, and ID2 is the top 50 correlated items
with ID,
2008 May 17
1
Correlated Columns in data frame
Dear all,
Sorry to post my query once again in the list, since I did
not get attention from anyone in my previous mail to this
list.
Now I make it simple here that please give me a code for
find out the columns of a dataframe whose correlation
coefficient is below a pre-determined threshold. (For
detailed query please see my previous message to this list,
pasted hereunder)
Thanks and regards,
2005 Aug 04
1
Where the error message comes from?
Hi all:
I get the following error message that I am not able to resolve.
Error in if (const(t, min(1e-08, mean(t)/1e+06))) { :
missing value where TRUE/FALSE needed
It appears right before the last data.frame statement.
Below is the program that simulates data from one way random effects
model and then computes normality and bootstrap confidence interval for
2007 Sep 21
3
Estimate correlation with bootstrap
Hello.
I would like to estimate the correlation coefficient
from two samples with Bootstrapping using the
R-function sample().
The problem is, that I have to sample pairwise. For
example if I have got two time series and I draw from
the first series the value from 1912 I need the value
from 1912 from the second sample, too.
Example:
Imagine that a and b are two time series with returns
for
2010 Feb 02
1
ggplot/time series with indicators question
Hello, I am trying to plot time-series data with certain weeks highlighted using symbols.
require(ggplot2)
#plotting time series data
timescale <- seq(as.Date("01/01/09","%m/%d/%y"), length.out=12, by=7)
data.all <- data.frame(
id = c(rep('111',12),rep('222',12),rep('333',12)),
week=c(timescale,timescale,timescale),
2012 Mar 08
4
Correlation between 2 matrices but with subset of variables
Dear All,
I have two matrices A (40 x 732) and B (40 x 1230) and would like to calculate correlation between them. I can use: cor(A,B, method="pearson") to calculate correlation between all possible pairs. But the issue is that there is one-many specific mappings between A and B and I just need to calculate correlations for those pairs (not all). Some variables in A (proteins, say p1)
2004 Jan 29
1
Confirmatory Factor Analysis in R? SEM?
Hi
Has anyone used R to conduct confirmatory factor analysis? This email pertains to use of SEM.
For context consider an example: the basic idea is that there are a bunch of observables variables (say study habbits, amount of time reading in the bus, doing homework, helping other do homework, doing follow-up on errors etc.) and one believes that all these variables maybe measured by two or
2008 Jul 20
2
problem with read.table
Hi,
Although I set check.names to FALSE in read.table, the duplicate names get modified. What should be done in this case?
the text file to be read by read.table
AM2 AM2 AM2 FAL
2 3 4 5
1 -1 -3 -2
t = read.table ("my_file", check.names = FALSE, header = T)
> t
AM2 AM2.1 AM2.2 FAL
2011 Jun 28
2
problem with corrgram function
Dear list,
I have a problem with the "corrgram" function. It does not seem to
"color" large negative correlations, while the same correlation, if
positive, provides no problems. Is this a bug?
require(corrgram)
a = seq(1,100)
b = -jitter(seq(1,100), 80)
cor(a,b) # r about -.96
c=as.data.frame(cbind(a,b))
corrgram(c, order=NULL, lower.panel=panel.pie,upper.panel=NULL,
2007 Apr 24
1
inner loop problem!?
Hi,
i have 656 attributes ind INTERVALL_VAR & 119 in GROUP
and this morning i'm little confused why the inner loop hang if it
arrive 656th column.
My Task is a t-test and correlation with all columns in INTERVALL_VAR
for all attributes in GROUP.
many thanks & regards,
christian
for( k in
1:length(GROUP)){
2009 Oct 06
2
Viewing specific data from a dataframe
Dear R users,
Simple question. Can anyone help with the code that would allow me to view only the variables who's correlation output is >0.8?
This is the code I'm using to date
>cor(data, method="spearman")
Kind regards
Krys
--------------------------------------------
_________________________________________________________________
Save time by
2007 Nov 08
6
Extract correlations from a matrix
Dear R users,
suppose I have a matrix of observations for which I calculate all
pair-wise correlations:
m=matrix(sample(1:100,replace=T),10,10)
w=cor(m,use="pairwise.complete.obs")
How do I extract only those correlations that are >0.6?
w[w>0.6] #obviously doesn?t work,
and I can?t find a way around it.
I would very much appreciate any help!
Best wishes
Christoph
(using R
2013 Mar 18
0
Problem with generated parameter estimates
Dear All,
I would be very grateful for your help concerning the following question:
Below mentioned programme is available on net to generate longitudinal
data. Usually we get almost same parameter estimates as used to generate
the data. The problem here is I am not able to get it for data used here,
despite increasing sample size and number of simulations. Is it normal to
expect this type of
2010 Dec 02
2
Hmisc label function applied to data frame
Hello,
I'm attempting to create a data frame with correlations between every pair
of variables in a data frame, so that I can then sort by the value of the
correlation coefficient and see which pairs of variables are most strongly
correlated.
The sm2vec function in the corpcor library works very nicely as shown here:
library(Hmisc)
library(corpcor)
# Create example data
x1 = runif(50)
x2 =
2011 Nov 23
2
Correlation matrix removing insignificant R values
Hello.
I have a large dataset with sales pr month for 56 products with 10 months
and i have tried to see how the sales are correlated using
cor()
This has given me a 56X56 matrix with the R value for each product pair.
Most of these correlations are insignificant, and i want only to retain the
instances were the R value is significant (for 10 observations it should be
above 0.64)
Can someone