search for: gdist

Displaying 11 results from an estimated 11 matches for "gdist".

Did you mean: dist
2004 Nov 09
1
gdist and gower distance
Dear All, I would like to ask clarifications on the gower distnce matrix calculated by the function gdistin the library mvpart. Here is a dummy example: > library(mvpart) Loading required package: survival Loading required package: splines mvpart package loaded: extends rpart to include multivariate and distance-based partitioning > x=matrix(1:6, byrow=T, ncol=2) > x [,1] [,2] [1,]...
2006 Mar 08
1
function gdist, dist and vegdist in mvpart
Dear R community, I am analyzing plant communities with the function mvpart, using a dissimilarit matrix as input. The matrix is calculated with the funtion gdist. fit <- mvpart(gdist (ba12[,18:29], meth="maximum", full=TRUE, sq=F) ~ beers + slope_dem + elev_dem+ plc_dem + pr_curv+ +curv+max_depth+doc_rocks+ abandon+land_use+ca_old, data=ba12, xv="p") This works fine. Now I would like to use other dissimilarity measures as...
2010 Feb 26
2
Error in mvpart example
Dear all, I'm getting an error in one of the stock examples in the 'mvpart' package. I tried: require(mvpart) data(spider) fit3 <- rpart(gdist(spider[,1:12],meth="bray",full=TRUE,sq=TRUE)~water+twigs+reft+herbs+moss+sand,spider,method="dist") #directly from ?rpart summary(fit3) ...which returned the following: Error in apply(formatg(yval, digits - 3), 1, paste, collapse = ",", sep = "") : dim(X...
2010 Apr 16
2
managing data and removing lines
Hi, I am very new to R and I've been trying to work through the R book to gain a better idea of the code (which is also completely new to me). Initially I imputed my data from a text file and that seemed to work ok, but I'm trying to examine linear relationships between gdist and gair, gdist and gsub, m6dist and m6air, etc. This didn't work and I think it might have something to do with the n/a's in my dataset. > habitat gdist gair gsub m6dist m6air m6sub m7dist m7air m7sub m8dist m8air m8sub 1 20 8 14 -0.5 24 19 7 12.1 16.1 2...
2006 Nov 17
3
gower distance calculation
Hello I have 2 rows in a matrix and I want to calculate the Gower Distance between the 2 , how can I do it? I searched and found nothing that can help me, and my program doesn't know the gdist function and I couldn't find it on the R help site. Can anyone help me plz Thank u all [[alternative HTML version deleted]]
2005 Aug 12
6
evaluating string variables
...irst variable for computation #loop over matrices, Open it , calculate property and put into data frame for(i in 0:6){ m<-matrix(scan('C:/R/i.mat', n=5*5),5,5, byrow=TRUE) # load matrix f1<-geodist(m) f2<-sum(colSums(f1$gdist)) l <-f0*f2 # Calculate property L[i+1, ]<-c(i,l) # Fill data frame } but the matrix cannot be loaded, because it try to ope...
2010 Nov 19
2
Calculating distance between longitude,latitude of 2 points
Hi all, I would like to know a way of calculating the distance between 2 points when I already have the longitude and latitude of the points. For example : Point 1 : 52? 9'54.00"N 4?25'8.40"E Point 2 : 52?27'46.80"N 4?33'18.00"E Distance between point 1 and point in km .... Is there any functions already available for this ? Any help will be much
2006 Aug 13
1
Gower Similarity Coefficient
I'm interested in clustering my data using the Gower Similarity Coefficient, and I was wondering if R is capable of using that metric Timothy Rye [[alternative HTML version deleted]]
2012 Mar 01
0
Memory problem in R
...y size upto 2047Mb. This problem has been discussed in 2008 (archives) but no profitable answers were delievered. I am sending the programming and bit of data. Thanks in advance for your help. model<-mnp(choice~1+Asso+FP+BEV+IAA+CER+FrtVeg+Meat+Others+lnADH+lnTO+Emp+LT50inReg+lnEXinEU+lnEXoutEU+GDist+RET+WS+LT50SC+Others_hotel, base=4, n.draws=10000, burnin=2000, thin=3, verbose=TRUE, trace=FALSE, p.scale=1, coef.start=0, invcdf=FALSE, cov.start=1) AssoFPCGIAABEVCERFrtVegMeatMilkOilOtherslnADHlnTOEmpLT50inReglnEXinEUlnEXoutEUGDistRETWSLT50SCOthers_hotelchoice 00011000003,68897,55331,0000,00000...
1999 Mar 22
0
Extension to outer()
...then outer(A, B, BIND = c(i, j)) computes an array with extent j of B bound along extent i of A. For example, if A and B are both matrices and V is the result with BIND=c(1,1), then V[i, j, k] = FUN(A[i, j], B[i, k], ...). One use for the BIND argument is in computing Euclidean distances: "gdist" <- function(X, Y) { X <- as.matrix(X) Y <- as.matrix(Y) sqrt(apply(outer(X, Y, "-", BIND = c(2,2))^2, c(1,3), sum)) } which, unlike dist() from `mva' can provide submatrices of the full distance matrix -- very useful for covariances. This BIND argument to outer tur...
2007 Oct 16
2
Canberra distance
...m amap, Canberra distance between vectors x and y, d(x,y), is : d(x,y) = sum(abs(x-y)/(x+y)) But in use, through simple examples, we find that the formula is : d(x,y) = (NZ + 1)/NZ * sum(abs(x-y)/(x+y)) with NZ = nb of pairs of coordinates that are different from (0,0) (Non Zeros) Functions vegdist() from vegan and gdist() from mvpart, like documentation of ADE4 software, use (for positive variables) : d(x,y) = 1/NZ * sum(abs(x-y)/(x+y)) Can someone help me to understand the differences in the choice of the formula and why there's a difference between calculus and explaination for di...