Displaying 20 results from an estimated 1000 matches similar to: "simulate data based on partial correlation matrix"
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
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, method="spearman"))
cor2 <- with(d, cor(x2, y2,
2023 Nov 15
2
Cannot calculate confidence intervals NULL
R-Experts,
Here below my R code working without error message but I don't get the results I am expecting.
Here is the result I get:
[1] "All values of t are equal to 0.28611928397257 \n Cannot calculate confidence intervals"
NULL
If someone knows how to solve my problem, really appreciate.
Best,
S
#########################################################
# Difference in Spearman
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
- - --
-
2010 May 03
1
Comparing the correlations coefficient of two (very) dependent samples
Hello all,
I believe this can be done using bootstrap, but I am wondering if there 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)
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
2010 Aug 25
1
SEM : Warning : Could not compute QR decomposition of Hessian
Hi useRs,
I'm trying for the first time to use a sem. The model finally runs,
but gives a warning saying :
"In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names
= vars, : Could not compute QR decomposition of Hessian.
Optimization probably did not converge. "
I found in R-help some posts on this warning, but my attemps to modify
the code didn't change
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
2003 Feb 19
1
getting/storing the name of an object passed to a function
Hi
I have a couple of functions that work on the object created by another R
command and then print out or summarise the results of this work.
The main function is defined as:
hotelling.t <- function(obj)
{
#internal commands
}
I then have print.hotelling.t() that takes the list returned by hotelling.t
and prints it with some extra significance calculations, formatting, etc.
I want to
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",
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
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),
2000 Mar 28
1
loess.smooth dumps core
Has the loess.smooth() function 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)
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
2012 May 31
0
ignore NA column in a DF (for calculation) without removing them
Dear users,
I have for the moment a function which looks for the best correlation for
each file I have in my correlation 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
2005 Nov 01
2
Greek letters in plots
Hi, all. I know that this is probably something that others have asked,
but I can't find a reference in either the FAQ or the help pages.
I'm trying to find a way to put Greek letters as a label of the plot
*with* a value from the data. Previously I've used pasted and the word
"rho".
* paste("rho=", cor2[i])
will produce a label of
2023 Dec 16
1
zapsmall(x) for scalar x
I was quite suprised to discover that applying `zapsmall` to a scalar value has no apparent effect. For example:
> y <- 2.220446e-16
> zapsmall(y,)
[1] 2.2204e-16
I was expecting zapsmall(x)` to act like
> round(y, digits=getOption('digits'))
[1] 0
Looking at the current source code, indicates that `zapsmall` is expecting a vector:
zapsmall <-
function (x, digits =
2023 Dec 17
1
zapsmall(x) for scalar x
Zapping a vector of small numbers to zero would cause problems when
printing the results of summary(). For example, if
zapsmall(c(2.220446e-16, ..., 2.220446e-16)) == c(0, ..., 0) then
print(summary(2.220446e-16), digits = 7) would print
Min. 1st Qu. Median Mean 3rd Qu. Max.
0 0 0 0 0 0
The same problem can also appear when
2023 Dec 17
1
zapsmall(x) for scalar x
Isn?t that the correct outcome? The user can change the number of digits if they want to see small values?
--
Change your thoughts and you change the world.
--Dr. Norman Vincent Peale
> On Dec 17, 2023, at 12:11?AM, Steve Martin <stevemartin041 at gmail.com> wrote:
>
> ?Zapping a vector of small numbers to zero would cause problems when
> printing the results of summary().
2023 Dec 18
1
[External] Re: zapsmall(x) for scalar x
Does mFUN() really need to be a function of x and the NA values of x? I
can't think of a case where it would be used on anything but the non-NA
values of x.
I think it would be easier to specify a different mFUN() (and document this
new argument) if the function has one argument and is applied to the non-NA
values of x.
zapsmall <- function(x,
digits = getOption("digits"),