Re: [R-sig-Geo] resampling grids

2008-12-11 Thread Tomislav Hengl
A quick way to rescale a set of maps is to use the grid tools of SAGA GIS (see rsaga.get.usage(grid_tools, 0)). First, download all ASCII file maps to a working directory, then obtain the list of maps in the folder, and then automate: ascmaps - list.files(getwd(), pattern=\\.asc$, full=F)

[R-sig-Geo] Principal Component Analysis - Selecting components? + right choice?

2008-12-11 Thread Corrado
Dear R gurus, I have some climatic data for a region of the world. They are monthly averages 1950 -2000 of precipitation (12 months), minimum temperature (12 months), maximum temperature (12 months). I have scaled them to 2 km x 2km cells, and I have around 75,000 cells. I need to feed them

Re: [R-sig-Geo] GSTAT - singular in meters not km

2008-12-11 Thread Edzer Pebesma
Thanks for the reproducalbe example, Zev; the whole thing looks very strange to me; it seems to be the combination of very large distance values and very small semivariance values that triggers this -- when I multiply v$gamma with 1000, many different initial variogram values are fit without

Re: [R-sig-Geo] Principal Component Analysis - Selecting components? + right choice?

2008-12-11 Thread Ashton Shortridge
Hi Corrado, I run the PCA using prcomp, quite successfully. Now I need to use a criteria to select the right number of PC. (that is: is it 1,2,3,4?) What criteria would you suggest? that's an interesting and probably controversy-generating question. It's probably not an R-sig-geo question,

Re: [R-sig-Geo] GSTAT - singular in meters not km

2008-12-11 Thread Edzer Pebesma
Zev, if you do a v.fit-fit.variogram(v, vgm(0.0005, Sph, 4, 0.1),debug.level=32) you'll see that the X matrix of the Gauss-Newton iteration with the derivatives of the parameters to the error sum of squares is nearly singular. The condition number of this matrix is so large that it

Re: [R-sig-Geo] Principal Component Analysis - Selectingcomponents? + right choice?

2008-12-11 Thread Kamran Safi
Hi all, I agree with Ashton. The issue is very complex and far from resolved. But sometimes we have to go down the PCA path. Among the many possible solutions is the broken stick approach, for which you find an R solution (bstick()) in the package vegan. Technically the broken stick randomly

Re: [R-sig-Geo] Principal Component Analysis - Selecting components? + right choice?

2008-12-11 Thread Edzer Pebesma
Principle components don't search for directions that best explain your dependent variable, but rather try to capture variability and/or correlation in the predictors. Methods that look for subspaces that best predict the dependent are for instance are partial least squares and ridge

Re: [R-sig-Geo] Principal Component Analysis - Selectingcomponents? + right choice?

2008-12-11 Thread Corrado
Hi all, I used a rule of thumb as reported by the book quoted, but I am not completely happy with it, because it is not really a statistical justification. I will try the broken stick approach, thanks! Concerning the interpretation, luckily enough PC1 has a clear interpretation. PC2 a bit

Re: [R-sig-Geo] Principal Component Analysis - Selectingcomponents? + right choice?

2008-12-11 Thread Kamran Safi
Hi Corrado, A useful reference is: Diniz-Filho J.A.F. Bini L.M. (2005). Modelling geographical patterns in species richness using eigenvector-based spatial filters. Global Ecology and Biogeography, 14, 177-185. So what they do basically is using multidimensional scaling to derive from the

Re: [R-sig-Geo] GSTAT - singular in meters not km

2008-12-11 Thread Zev Ross
Edzer, Glad to hear that I wasn't crazy -- thanks so much for looking into this (and so quickly). For now I'll divide by 1000 and use KM which is an easy and reasonable solution. Zev Edzer Pebesma wrote: Zev, if you do a v.fit-fit.variogram(v, vgm(0.0005, Sph, 4,

Re: [R-sig-Geo] Subsetting a spatial grid

2008-12-11 Thread Edzer Pebesma
For SpatialGridDataFrames, row and col selection can be done by object[firstrow:lastrow, firstcol:lastcol,] after the last , you can optionally select attributes. -- Edzer Rob Robinson wrote: Help - please! :-) I have what I thought was a really simple problem. I have a raster image of