similar to: k nearest neighbours between two matrix

Displaying 20 results from an estimated 6000 matches similar to: "k nearest neighbours between two matrix"

2004 Jun 22
1
k nearest neighbours
Hi there fellow R-users, Does anyone know of a function which does exactly what knearneigh{spdep} (finds the k nearest neighbours) does in the package spdep but for more than 2D data? Regards Wayne KSS Ltd Seventh Floor St James's Buildings 79 Oxford Street Manchester M1 6SS England Company Registration Number 2800886 Tel: +44 (0) 161 228 0040 Fax: +44 (0) 161 236 6305
2004 Apr 06
1
k nearest neighbours
I want to 1) Select for each of the n points in a matrix A, those of the m points in B that lay within a given radius. 2) Of those points within the radius, select the k nearest ones. What I now do is 1) Create an n*m matrix C were I put the distances from all the points in B to the points in A and make NA those cells were the distance is larger than the radius. (The points are geographical
2010 Mar 09
1
create picture (k -the nearest neighbours)
Hi I want to create a nice picture about my result of k -the nearest neighbours algorithm. Here is my easy code: ################################# library(klaR) library(ipred) library(mlbench) data(PimaIndiansDiabetes2) dane=na.omit(PimaIndiansDiabetes2)[,c(2,5,9)] dane[,2]=log(dane[,2]) dane[,1:2]=scale(dane[,1:2]) zbior.uczacy=sample(1:nrow(dane),nrow(dane)/2,F)
2004 Feb 02
2
Nearest Neighbor Algorithm in R -- again.
Several of the methods I use for analyzing large data sets, such as WinGamma: determining the level of noise in data Relief-F: estimating the influence of variables depend on finding the k nearest neighbors of a point in a data frame or matrix efficiently. (For large data sets it is not feasible to compute the 'dist' matrix anyway.) Seeing the proposed solution to "[R] distance
2012 Jul 24
3
Nearest Neighbors
I was wondering if there is a way in R to find k nearest neighbors of various orders, say order 2, 3, or 4. In otherwords neighbors of neighbors of neighbors. You get the idea. I know that I can use knearneigh(matrix.data, k) but this only gives me the k nearest neighbors and not of a particular order. Thanks in advance. -- View this message in context:
2012 Jun 20
1
nearest neighbours and their ID
Dear R users, I used nndist() to gain the distance of 2 nearest neighbours of the points in my dataset. Is there a way of getting the ID numbers of these nearest neighbours (along with their distances). The command I used: nn2 <- nndist(X2, k=1:2). This is the output of the nearest neighbour distances I got (the IDs of the given points are there but their IDs aren't). Any help or
2009 Oct 30
1
Applying a function on n nearest neighbours
I'm having a problem where I have to apply a function to a subset of a variable, where the subset is defined by the n nearest neighbours of a second variable. Here's an example applied to the 'iris' dataset: $ head(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4
2012 Jul 24
1
unable to run spatial lag and error models on large data
Hi: First my apologies for cross-posting. A few days back I posted my queries ar R-sig-geo but did not get any response. Hence this post. I am working on two parcel-level housing dataset to estimate the impact of various variables on home sale prices. I created the spatial weight metrics in ArcGIS 10 using sale year of four nearest houses to assign weights.  Next, I ran LM tests and then ran
2004 Jul 08
1
k nearest neighbor prediction
Hi there fellow R-users, Does anyone know if there is a package for k nearest neighbours prediction as opposed to classification? I have found the package knncat but can't see a way to adjust it to predict a continuous variable. Any help would be great, Regards Wayne Jones KSS Ltd Seventh Floor St James's Buildings 79 Oxford Street Manchester M1 6SS England Company
2003 Jun 30
2
spatial correlation test
hello, I want to do a test for spatial correlation. I tried it with geary.test() but I don't understand the required input. x= a numeric vector the same length as the neighbours list in listw (my sampled data, I assume) listw= a listw object created for example by nb2listw (well when I check nb2listw() I get to "neighbours - an object of class nb" - but I couldn't figure
2013 Apr 16
1
Spatial Ananlysis: zero.policy=TRUE doesn't work for no neighbour regions??
Hello, I'm new to R and to Spatial Analysis and got a problem trying to create a Spatial Weights Matrix. *I us the following code to create the Neighbourslist:* >library(maptools) >library(spdep) >library(rgdal) >location_County<- readShapePoly("....") >proj4string(location_County)<- CRS("+proj=longlat ellps=WGS84") >location_nbq<-
2011 Sep 08
1
error in knn: too many ties in knn
Hello. I found the behavior of knn( http://stat.ethz.ch/R-manual/R-devel/library/class/html/knn.html) function looking very strange. Consider the toy example. > library(class) > train <- matrix(nrow=5000,ncol=2,data=rnorm(10000,0,1)) > test <- matrix(nrow=10,ncol=2,data=rnorm(20,0,1)) > cl <- rep(c(0,1),2500) > knn(train,test,cl,1) [1] 1 1 0 0 1 0 1 1 0 1 Levels: 0 1 It
2003 Jan 30
2
nearest neighbour interpolation
Dear Help List, My name is Matt Oliver. I have been using R for about a year and find it very helpful. However, I have a need for a function that I cannot find. I am not very good at programming so I thought I would ask the group. I have an irregular grid of data (x = Longitude, y = Latitude). Each pair of my x,y has a categorical value. Obviously linear or any other numerically based
2009 Nov 17
0
Re place NA values in matrix with the value of Nearest Neighbour
I am extracting climate data for coastal areas from 5km grid data for specific xy coordinates that relates to individual study sites (SQ). Code so far: setwd("/Users/roblewis/Documents/PhD/Climate Data") fnamestemp=read.table("Path_Directory_Maxt") fnames=paste(fnamestemp[,1],fnamestemp[,2]) nfiles = length(fnames) xy=as.matrix(read.table("xy_.txt"))
2011 Sep 26
3
Nearest neighbour in a matrix
Hello all, I am brand new to R and doing an exercise for a class. I need to find the nearest neighbour for points in the following matrix: > DistanceMatrix x1 x2 x3 x4 x5 [1,] 0.000000 2.828427 1.581139 2.236068 2.000000 [2,] 2.828427 0.000000 1.581139 4.123106 2.000000 [3,] 1.581139 1.581139 0.000000 2.549510 2.121320 [4,] 2.236068 4.123106 2.549510
2009 May 14
1
KNN script: Identity of specific K samples chosen?
I am currently doing some prediction work using the knn script in the 'class' package. Does anyone know a way of having R return the IDs (sample IDs, or column IDs of the training matrix) of the 'k' samples that are chosen by the algorithm as being nearest to a given test sample? I have searched/read everything I can about the script, however have not found anything other than the
2004 Feb 19
1
How to create a "nb" object?
Hi group, I'd like to do spatial analysis of my data using the spdep package. It appears that a file of class nb is necessary, but I do not find what that should look like and if there is a function that creates such file for me. How can I create a nb-object of my data points? Thanks, René Eschen. [[alternative HTML version deleted]]
2001 Dec 06
0
3D spatial statistics
Dear R Users, This is only partly an R question, but I would be very grateful if anyone could offer some suggestions for approaches or packages I could use in R. I have 11 sets of points in 3D (synapses in a region of a fly's brain for 11 different kinds of neurons as it happens); each set has between 80-250 points distributed in an irregularly shaped cloud. I would like to calculate a) a
2003 Nov 05
1
fast nearest-neighbor in R?
Is fast nearest-neighbor functionality available in R? I was thinking of something along the lines of what's currently in S+SPATIALSTATS. Thanks for any information anyone might have on this. - MZ
2011 Aug 31
8
!!!function to do the knn!!!
hi, r users i have a problem with KNN. i have 2 datasets, X0 and X1. >dim(X0) >1471*13 dim(X1) >5221*13 and for every instances in the dataset X1, i want to find the nearest neighbour(1nn) in the dataset X0. and i dont have the true classifications of dataset X1. but the function knn() need true classifications(cl) to do prediction. i just curious if there are some other function