Displaying 20 results from an estimated 90000 matches similar to: "plot a distance matrix"
2012 Jun 16
1
Efficient distance calculation on big matrix
Hi All,
I'm working on analyzing a large data set, lets asume that
dim(Data)=c(1000,8700). I want to calculate the canberra distance
between the columns of this matrix, and using a toy example ('test' is
a matrix filled with random numbers 0-1):
> system.time(d<-as.matrix(dist(t(test), method = "canberra", diag = FALSE, upper = FALSE, p = 2)))
user system
2010 Jun 07
1
classification algorithms with distance matrix
Dear all,
I have a problem when using some classification functions (Kmeans, PAM,
FANNY...) with a distance matrix, and i would to understand how it
proceeds for the positioning of centroids after one execution step.
In fact, in the classical formulation of the algorithm, after each step,
to re-position the center, it calculates the distance between any
elements of the old cluster and its
2008 Jul 25
1
Write lower half of distance matrix only
Hi,
I'm very new to R. I want to know if there is any way to write only the
lower half of a distance matrix created in R to a csv file for example. I
get the 'cannot coerce class "dist" into a data.frame' message when I try.
I have used as.matrix and can write to a file this way, but as a full
matrix.
The reason I only want the lower half is that I've been doing some
2008 Jan 20
1
distance matrix
Hello, I want do get the point to point distance matrix.
Suppose, I have a data frame where the first column is X and second column
is Y coordinate of points.
I define a function dst(x1,y1,x2,y2) to claculate distance between two
points. But I don't know how to tell R to calculate dst for every two points
and create a matrix of these distances.
Can you give me a little guidance, please? I am
2010 Feb 04
3
mgcv problem
Dear friends,
I have install the last version 2.10 and now I have probles with 'mgcv' which can be load. I proved to eliminated and reinstalled but always obtain the same message:
> library (mgcv)
This is mgcv 1.6-1. For overview type `help("mgcv-package")'.
Error in runif(1) :
.Random.seed is not an integer vector but of type 'list'
Error : .onAttach non
2010 Apr 30
1
How to generate a distance matrix?
Hi,
I'm trying to generate a distance matrix between sample pairs (example
below). I'm not very familiar with the loop command which I expect I will
need for this. The example below demosntrates what I'd like to get out of
the data - essentially, to calculate the proportion of positions where two
samples differ.
Any help much appreciated! Also, any notes on how the functions work
2011 Apr 29
1
logistic regression with glm: cooks distance and dfbetas are different compared to SPSS output
Hi there,
I have the problem, that I'm not able to reproduce the SPSS residual
statistics (dfbeta and cook's distance) with a simple binary logistic
regression model obtained in R via the glm-function.
I tried the following:
fit <- glm(y ~ x1 + x2 + x3, data, family=binomial)
cooks.distance(fit)
dfbetas(fit)
When i compare the returned values with the values that I get in SPSS,
2009 Jun 26
1
50993 point distance matrix, too big to as.matrix, looking for another way to calculate point-level summary
Hello, Im working on a 50933 point count bird abundance dataset. I've
succeeded in calculating a distance matrix for this entire set, but I don't
have sufficient memory to convert this to a matrix, as below...
abun.dist <- dist(abun.mat[1:50993,1:235)
test <- rowMeans(as.matrix(abun.dist))
Error in matrix(0, size, size) : too many elements specified
ive been able to run a hclust()
2002 Jan 25
1
Fw: Summary for Distance matrix by cosine?
Dear all,
below you find enclosed my message from January 9th and my program
(attention: beginner).
Thanks for both answers! a. However, as far as I know the cosine is not the
same as the Pearson correlation (only in special cases).
b. Reid Huntsinger's hint was very useful, however I had to transpose the
matrix first, for I want to calculate the distance of the _rows_.
Regards,
Petra
2007 Jul 24
0
Fitting the best line to the plot of distance vs. correlation matrix
Hi all,
Thanks for your help in generating the matrix of distance vs correlation. I did it using
plot(as.vector(as.matrix(cormat)), as.vector(as.matrix(distmat)))
Now I want to quantitate the same. May be on linear regression or some other statistical functions. I have tried using linmod for linear regression. But as I have two matrices in the form of the dataframes, I'm wondering if it
2013 May 02
2
Calculating distance matrix for large dataset
Dear R users
I wondered if any of you ever tried to calculate distance matrix with very
large data set, and if anyone out there can confirm this error message I
got actually mean that my data is too large for this task.
negative length vectors are not allowed
My data size and code used
dim(mydata_nor)[1] 365000 144> d <- dist(mydata_nor, method = "euclidean")
Here my
2009 Dec 01
2
Distance between sets of points in transformed environmental space
Dear friends,
I have several sets of points in a transformed environmental space. Each set
of points can be represented as a cloud in the environmental space.
This space is spanned by n coordinates, corresponding to the first n PCs of 36
PCs of some environmental variables (12 monthly minimum temperatures, 12
monthly maximum temperature, 12 monthly precipitations).
I would like to calculate
2004 Feb 24
3
Calculate Distance and Aggregate Data?
Hi all,
I've been struggling learning R and need to turn to the list again.
I've got a dataset (comma-delimited file) with the following fields: recid, latitude, longitude, population, dwelling and age. For each observation, I'd like to calculate the total number of people and dwellings and average age within 2 k.m. Distance could be Euclidean, however, a proper distance
2008 Oct 07
1
vectorization of a loop for mahalanobis distance calculation
Dear all,
We have a data frame x with n people as rows and k variables as columns.
Now, for each person (i.e., each row) we want to calculate a distance
between him/her and EACH other person in x. In other words, we want to
create a n x n matrix with distances (with zeros in the diagonal).
However, we do not want to calculate Euclidian distances. We want to calculate
Mahalanobis distances, which
2008 Jan 09
0
Distance matrix from a binary data frame
Hi,
I am trying to calculate a distance matrix on a binary data frame using
dist.binary() {ade4}. This is the code I run and the error I get:
> sjlc.dist <- dist.binary(as.data.frame(data), method=2) #D = (a+d) /
(a+b+c+d)
Error in if (any(df < 0)) stop("non negative value expected in df") :
missing value where TRUE/FALSE needed
I don't know if the problem are the
2011 Aug 08
3
Distance between a vector and matrix rows
I am trying to find the distance between a vector and each row of a
dataframe. I am using the function "distancevector" in the package "hopach"
as follows:
mydata<-as.data.frame(matrix(c(1,1,1,1,0,1,1,1,1,0),nrow=2))
V1 V2 V3 V4 V5
1 1 1 0 1 1
2 1 1 1 1 0
vec <- c(1,1,1,1,1)
d2<-distancevector(mydata,vec,d="euclid")
The Euclidean distance
2008 Feb 19
1
Calculating the distance samples using distance metics method
***********reading in data**********
data<-read.table("microarray.txt",header=T, sep="\t")
head(data)
dim(data)
attach(data)
***********creating matrix and calculating variance across probesets********
x<-1:20000
y<-2:141
data.matrix<-data.matrix(data[,y])
variableprobe<-apply(data.matrix[x,],1,var)
hist(variableprobe)
**************filter out low
2010 Jul 19
2
replacing elements of distance matrix
Hi! I am trying to implement non-bipartite matching. I have around 500 sites
which can be clustered by 10 regions. I am able to calculate pairwise
Mahalanobis distances between sites (thanks to another post in the forum).
However, I want to constrain my match to sites within the same region. Thus
I want to replace elements of the distance matrix with a high value, say
999999, for sites not of the
2011 Nov 08
1
from points in Lon/Lat to physical distance in dist class
Dear R-listers,
Here, I would like to hearing helps from you.
I have GPS data (multiple points in the geographic scale) in
longitude/latitude. I intend to calculate
distance (in kilometer) among such points and output the distance matrix in
dist class.
I have gotten some progress, but I still can not get final goal. Could
please give me any directions/advice?
This email cc. to Mr. Pierre, the
2012 Aug 30
2
self-defined distance function to be computed on matrix
Hello,
I have a self-defined function to be computed on each column in a matrix.
The basic idea is to ignore the elements that have value of 0 during
computation.
I should be able to write my own function but it could be computational
expensive, so I'd love to ask if anyone may have suggestions on how to
implement it more efficiently. Thanks in advance.
For example, there are three