
Corrado, 
this is my first attempt to reply to another message and provide help, forgive me if I've done it incorrectly. 
 
I'm been running PCA on similar data sets for regions of the US. Here are some rough guidelines I've gleaned form MV statisticians over the years. 
First, look at your PCA summary. You'll see increasing variance explained with addition of each Principal component. PC1 will likely explain around 60%...PC 2 will add 10-15%....once you reach 5-7 PC's you'll, likely have explained 80-85% of the variance. My guess is that PC1 will represent storm tracks, PC2 or 3 will be elevation or vegetation. Beyond that, you'll need to think carefully about what you want to do with the PC output. Those small PC's, while they might explain something important, will also have more noise in them if applied across your global data frame. 
 
You need to understand that the scores from your PCA output represent the SPATIAL loading patterns of those stations. I'd suggest fitting and then plotting some of them as surfaces, so that you can visualize these loading patterns, they will doubtless be interesting. 
 
HTH 
Zack
 
> From: r-sig-geo-request@stat.math.ethz.ch> Subject: R-sig-Geo Digest, Vol 64, Issue 12> To: r-sig-geo@stat.math.ethz.ch> Date: Fri, 12 Dec 2008 12:00:04 +0100> > Send R-sig-Geo mailing list submissions to> r-sig-geo@stat.math.ethz.ch> > To subscribe or unsubscribe via the World Wide Web, visit> https://stat.ethz.ch/mailman/listinfo/r-sig-geo> or, via email, send a message with subject or body 'help' to> r-sig-geo-request@stat.math.ethz.ch> > You can reach the person managing the list at> r-sig-geo-owner@stat.math.ethz.ch> > When replying, please edit your Subject line so it is more specific> than "Re: Contents of R-sig-Geo digest..."> > > Today's Topics:> > 1. Principal Component Analysis - Selecting components? + right> choice? (Corrado)> 2. Re: GSTAT - singular in meters not km (Edzer Pebesma)> 3. Re: Principal Component Analysis - Selecting components? +> right choice? (Ashton Shortridge)> 4. Re: GSTAT - singular in meters not km (Edzer Pebesma)> 5. Re: Principal Component Analysis - Selectingcomponents? +> right choice? (Kamran Safi)> 6. Re: Principal Component Analysis - Selecting components? +> right choice? (Edzer Pebesma)> 7. Re: Principal Component Analysis - Selectingcomponents? +> right choice? (Corrado)> 8. Re: Principal Component Analysis - Selectingcomponents? +> right choice? (Kamran Safi)> 9. Re: GSTAT - singular in meters not km (Zev Ross)> 10. Re: Subsetting a spatial grid (Edzer Pebesma)> 11. periodic variograms (Satterthwaite, Paul)> 12. Re: periodic variograms (Paulo Justiniano Ribeiro Jr)> 13. Re: Principal Component Analysis - Selectingcomponents? +> right choice? (G. Allegri)> 14. Re: Principal Component Analysis - Selecting components? +> right choice? (St?phane Dray)> > > ----------------------------------------------------------------------> > Message: 1> Date: Thu, 11 Dec 2008 11:46:37 +0000> From: Corrado <ct529@york.ac.uk>> Subject: [R-sig-Geo] Principal Component Analysis - Selecting> components? + right choice?> To: r-help@r-project.org, r-sig-ecology@r-project.org,> r-sig-geo@stat.math.ethz.ch> Message-ID: <200812111146.38088.ct529@york.ac.uk>> Content-Type: text/plain; charset="utf-8"> > 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 into a statistical model as co-variates, to use them to > predict a response variable.> > The climatic data are obviously correlated: precipitation for January is > correlated to precipitation for February and so on .... even precipitation > and temperature are heavily correlated. I did some correlation analysis and > they are all strongly correlated.> > I though of running PCA on them, in order to reduce the number of co-variates > I feed into the model.> > 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?> > At the moment, I am using a criteria based on threshold, but that is highly > subjective, even if there are some rules of thumb (Jolliffe,Principal > Component Analysis, II Edition, Springer Verlag,2002). > > Could you suggest something more rigorous?> > By the way, do you think I would have been better off by using something > different from PCA?> > Best,> -- > Corrado Topi> > Global Climate Change & Biodiversity Indicators> Area 18,Department of Biology> University of York, York, YO10 5YW, UK> Phone: + 44 (0) 1904 328645, E-mail: ct529@york.ac.uk> > > > ------------------------------> > Message: 2> Date: Thu, 11 Dec 2008 13:17:01 +0100> From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>> Subject: Re: [R-sig-Geo] GSTAT - singular in meters not km> To: Zev Ross <zev@zevross.com>> Cc: r-sig-geo@stat.math.ethz.ch> Message-ID: <494104BD.8050301@uni-muenster.de>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed> > 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 problems again. Something > someone (that's usually me) will have to look into more closely, I'm afraid!> > Best regards,> --> Edzer> > Zev Ross wrote:> > Edzer (and all),> >> > I don't think that it's related to an unrealistic range. I've tried a > > lot of different realistic and non-realistic values and get singular > > results each time. If I divide the X and Y coordinates by 10, 100, > > 1000 or 10000 I don't get singularity. Using Lat and Long works fine. > > Code is below and I included a link to a workspace with the "pol" data > > set at the bottom.> >> > Zev> >> > polA<-pol> > coordinates(polA)<-~x+y> > v<-variogram(pollutant~1, data=polA)> > v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40000, 0.00001))> > attributes(v.fit)$singular # TRUE> >> > polB<-pol> > polB$x<-polB$x/1000> > polB$y<-polB$y/1000> > coordinates(polB)<-~x+y> > v<-variogram(pollutant~1, data=polB)> > v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40, 0.00001))> > attributes(v.fit)$singular #FALSE> >> > polC<-pol> > coordinates(polC)<-~longitude+latitude> > v<-variogram(pollutant~1, data=polC)> > v.fit<-fit.variogram(v, vgm(0.0005, "Sph", .4, 0.00001))> > attributes(v.fit)$singular # FALSE> >> > http://www.zevross.com/temp2/singular_or_not.RData> >> > Edzer Pebesma wrote:> >> Hi Zev, it is hard to see what happens without seeing your data or R > >> commands.> >>> >> Is it possible that you passed an unrealistic value for the range > >> parameter, as starting value for the variogram model argument of > >> fit.variogram?> >> -- > >> Edzer> >>> >> Zev Ross wrote:> >>> Hi All,> >>>> >>> I'm fitting variograms in GSTAT with fit.variogram and I was > >>> surprised to find that all my fits were singular. I experimented > >>> with converting the data to unprojected data (decimal degrees) and > >>> with dividing my X and Y coordinates, which are in meters, by 1000 > >>> (to get KM). In both cases the fitting procedure worked with no > >>> singularity. Based on the numbers of pairs the bins appeared to be > >>> about the same so it appears to be a matter of the coordinates > >>> themselves.> >>>> >>> I'd prefer not to have to convert the coordinates back and forth > >>> between meters and KM, any suggestions?> >>>> >>> Zev> >>>> >>> _______________________________________________> >>> R-sig-Geo mailing list> >>> R-sig-Geo@stat.math.ethz.ch> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo> >>> >> > -- > Edzer Pebesma> Institute for Geoinformatics (ifgi), University of M?nster> Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251> 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/> http://www.springer.com/978-0-387-78170-9 e.pebesma@wwu.de> > > > ------------------------------> > Message: 3> Date: Thu, 11 Dec 2008 09:10:38 -0500> From: Ashton Shortridge <ashton@msu.edu>> Subject: Re: [R-sig-Geo] Principal Component Analysis - Selecting> components? + right choice?> To: r-sig-geo@stat.math.ethz.ch> Cc: Corrado <ct529@york.ac.uk>> Message-ID: <200812110910.38588.ashton@msu.edu>> Content-Type: text/plain; charset="iso-8859-1"> > 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, either. I am not a PCA person, but the > rule of thumb I am aware of is to plot the variability each > component 'explains' and look for a clear breakpoint. I would think about any > multivariate analysis text would have a better explanation than I can give, > though.> > As for something more rigorous, I think a lot of people are reluctant to use > PCA as a modeling approach not so much because it's hard to choose a > threshold for selecting components, but because the interpretation of the > meaning of each component is pretty subjective. If you want an explanatory > model, be careful about using PCA. You would be better served by deciding, > based perhaps on expert knowledge about the variables, which ones to use in > the model and which ones not to.> > To try to make this a bit more spatial, and therefore more relevant to the > list, I will also warn you that your various climate variables are almost > certainly spatially autocorrelated - that is, neighboring and nearby > observations in the grid are not independent. That has serious implications > for standard multivariate analysis techniques and diagnostics.> > Yours,> > Ashton> > On Thursday 11 December 2008 06:46:37 am Corrado wrote:> > 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 into a statistical model as co-variates, to use them to> > predict a response variable.> >> > The climatic data are obviously correlated: precipitation for January is> > correlated to precipitation for February and so on .... even precipitation> > and temperature are heavily correlated. I did some correlation analysis and> > they are all strongly correlated.> >> > I though of running PCA on them, in order to reduce the number of> > co-variates I feed into the model.> >> > 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?> >> > At the moment, I am using a criteria based on threshold, but that is highly> > subjective, even if there are some rules of thumb (Jolliffe,Principal> > Component Analysis, II Edition, Springer Verlag,2002).> >> > Could you suggest something more rigorous?> >> > By the way, do you think I would have been better off by using something> > different from PCA?> >> > Best,> > > > -- > Ashton Shortridge> Associate Professor ashton@msu.edu> Dept of Geography http://www.msu.edu/~ashton> 235 Geography Building ph (517) 432-3561> Michigan State University fx (517) 432-1671> > > > ------------------------------> > Message: 4> Date: Thu, 11 Dec 2008 15:24:07 +0100> From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>> Subject: Re: [R-sig-Geo] GSTAT - singular in meters not km> To: Zev Ross <zev@zevross.com>> Cc: r-sig-geo@stat.math.ethz.ch> Message-ID: <49412287.7020600@uni-muenster.de>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed> > Zev, if you do a> > v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40000, 0.00001),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 makes > the problem ill-conditioned. If you add argument fit.ranges=FALSE it > will not be singular anymore.> > In the end, this problem is similar to e.g. regression of polynomials on > coordinates without standardizing the coordinates.> > I'll add a warning message to fit.variogram to suggest the two > solutions, for this case.> --> Edzer> > Zev Ross wrote:> > Edzer (and all),> >> > I don't think that it's related to an unrealistic range. I've tried a > > lot of different realistic and non-realistic values and get singular > > results each time. If I divide the X and Y coordinates by 10, 100, > > 1000 or 10000 I don't get singularity. Using Lat and Long works fine. > > Code is below and I included a link to a workspace with the "pol" data > > set at the bottom.> >> > Zev> >> > polA<-pol> > coordinates(polA)<-~x+y> > v<-variogram(pollutant~1, data=polA)> > v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40000, 0.00001))> > attributes(v.fit)$singular # TRUE> >> > polB<-pol> > polB$x<-polB$x/1000> > polB$y<-polB$y/1000> > coordinates(polB)<-~x+y> > v<-variogram(pollutant~1, data=polB)> > v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40, 0.00001))> > attributes(v.fit)$singular #FALSE> >> > polC<-pol> > coordinates(polC)<-~longitude+latitude> > v<-variogram(pollutant~1, data=polC)> > v.fit<-fit.variogram(v, vgm(0.0005, "Sph", .4, 0.00001))> > attributes(v.fit)$singular # FALSE> >> > http://www.zevross.com/temp2/singular_or_not.RData> >> > Edzer Pebesma wrote:> >> Hi Zev, it is hard to see what happens without seeing your data or R > >> commands.> >>> >> Is it possible that you passed an unrealistic value for the range > >> parameter, as starting value for the variogram model argument of > >> fit.variogram?> >> -- > >> Edzer> >>> >> Zev Ross wrote:> >>> Hi All,> >>>> >>> I'm fitting variograms in GSTAT with fit.variogram and I was > >>> surprised to find that all my fits were singular. I experimented > >>> with converting the data to unprojected data (decimal degrees) and > >>> with dividing my X and Y coordinates, which are in meters, by 1000 > >>> (to get KM). In both cases the fitting procedure worked with no > >>> singularity. Based on the numbers of pairs the bins appeared to be > >>> about the same so it appears to be a matter of the coordinates > >>> themselves.> >>>> >>> I'd prefer not to have to convert the coordinates back and forth > >>> between meters and KM, any suggestions?> >>>> >>> Zev> >>>> >>> _______________________________________________> >>> R-sig-Geo mailing list> >>> R-sig-Geo@stat.math.ethz.ch> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo> >>> >> > -- > Edzer Pebesma> Institute for Geoinformatics (ifgi), University of M?nster> Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251> 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/> http://www.springer.com/978-0-387-78170-9 e.pebesma@wwu.de> > > > ------------------------------> > Message: 5> Date: Thu, 11 Dec 2008 14:29:27 -0000> From: "Kamran Safi" <Kamran.Safi@ioz.ac.uk>> Subject: Re: [R-sig-Geo] Principal Component Analysis -> Selectingcomponents? + right choice?> To: "Ashton Shortridge" <ashton@msu.edu>,> <r-sig-geo@stat.math.ethz.ch>> Cc: Corrado <ct529@york.ac.uk>> Message-ID: <41E1ED29E5E8E34BBDD8B82CFA1A9D040638098F@zsl26>> Content-Type: text/plain; charset="us-ascii"> > 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> divides 100% variance into your N principal components and generates a> null expectation for the distributions of randomly partioning the> original variance. You then take all those PCAs that are above the> broken stick distribution. This is by no means an agreed upon approach,> but it is at least reproducible and has some theory behind it, but is> and will remain a rule of thumb.> In terms of spatial analysis you could derive the PCAs and then go into> classic spatial analysis. Although the interpretation of PCA is> sometimes complicated or even impossible, you can calculate the values> for every grid cell and then go into multivariate analysis whereby you> have to take spatial autocorrelation into account. At least your PCA> components are orthogonal, which simplifies your analysis in contrast to> using the original variables. It also allows you to produce predictive> models. > What you could think of doing could be using PCA to derive> "environmental" variables which are uncorrelated and the use the> distance matrix and spatial filtering to "remove" spatial> autocorrelation. > > Hope this helps,> > Kami> > > > ------------------------> Kamran Safi> > Postdoctoral Research Fellow> Institute of Zoology> Zoological Society of London> Regent's Park> London NW1 4RY> > http://www.zoo.cam.ac.uk/ioz/people/safi.htm> > http://spatialr.googlepages.com> http://asapi.wetpaint.com> > -----Original Message-----> From: r-sig-geo-bounces@stat.math.ethz.ch> [mailto:r-sig-geo-bounces@stat.math.ethz.ch] On Behalf Of Ashton> Shortridge> Sent: 11 December 2008 14:11> To: r-sig-geo@stat.math.ethz.ch> Cc: Corrado> Subject: Re: [R-sig-Geo] Principal Component Analysis -> Selectingcomponents? + right choice?> > 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, either. I am not a PCA person, but> the > rule of thumb I am aware of is to plot the variability each > component 'explains' and look for a clear breakpoint. I would think> about any > multivariate analysis text would have a better explanation than I can> give, > though.> > As for something more rigorous, I think a lot of people are reluctant to> use > PCA as a modeling approach not so much because it's hard to choose a > threshold for selecting components, but because the interpretation of> the > meaning of each component is pretty subjective. If you want an> explanatory > model, be careful about using PCA. You would be better served by> deciding, > based perhaps on expert knowledge about the variables, which ones to use> in > the model and which ones not to.> > To try to make this a bit more spatial, and therefore more relevant to> the > list, I will also warn you that your various climate variables are> almost > certainly spatially autocorrelated - that is, neighboring and nearby > observations in the grid are not independent. That has serious> implications > for standard multivariate analysis techniques and diagnostics.> > Yours,> > Ashton> > On Thursday 11 December 2008 06:46:37 am Corrado wrote:> > 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 into a statistical model as co-variates, to use> them to> > predict a response variable.> >> > The climatic data are obviously correlated: precipitation for January> is> > correlated to precipitation for February and so on .... even> precipitation> > and temperature are heavily correlated. I did some correlation> analysis and> > they are all strongly correlated.> >> > I though of running PCA on them, in order to reduce the number of> > co-variates I feed into the model.> >> > 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?> >> > At the moment, I am using a criteria based on threshold, but that is> highly> > subjective, even if there are some rules of thumb (Jolliffe,Principal> > Component Analysis, II Edition, Springer Verlag,2002).> >> > Could you suggest something more rigorous?> >> > By the way, do you think I would have been better off by using> something> > different from PCA?> >> > Best,> > > > -- > Ashton Shortridge> Associate Professor ashton@msu.edu> Dept of Geography http://www.msu.edu/~ashton> 235 Geography Building ph (517) 432-3561> Michigan State University fx (517) 432-1671> > _______________________________________________> R-sig-Geo mailing list> R-sig-Geo@stat.math.ethz.ch> https://stat.ethz.ch/mailman/listinfo/r-sig-geo> > > > > Click> https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==> dsq0SUeqeT9ZUvqzszeURfMOCDRy5!TUZWDEGNPdlyNkQ== to report this email as> spam.> > > The Zoological Society of London is incorporated by Royal Charter> Principal Office England. Company Number RC000749> Registered address: > Regent's Park, London, England NW1 4RY> Registered Charity in England and Wales no. 208728 > > _________________________________________________________________________> This e-mail has been sent in confidence to the named add...{{dropped:17}}> > > > ------------------------------> > Message: 6> Date: Thu, 11 Dec 2008 15:45:28 +0100> From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>> Subject: Re: [R-sig-Geo] Principal Component Analysis - Selecting> components? + right choice?> To: Ashton Shortridge <ashton@msu.edu>> Cc: r-sig-geo@stat.math.ethz.ch, Corrado <ct529@york.ac.uk>> Message-ID: <49412788.9020803@uni-muenster.de>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed> > 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 regression. Using them, you could with the same amount of degrees > of freedom look at completely different directions.> > In addition to Ashton's remark: a variety of principle components that > tries to pick up spatial correlated patterns in addition to maximum > variability/correlation between variables is MNF (minimum nois fraction) > factors, also called min/max autocorrelation factors; see the papers by > Green, Switzer and others. I'm not aware of implementations of them in > R, but would be interested to hear.> > Best regards,> --> Edzer> > Ashton Shortridge wrote:> > 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, either. I am not a PCA person, but the > > rule of thumb I am aware of is to plot the variability each > > component 'explains' and look for a clear breakpoint. I would think about any > > multivariate analysis text would have a better explanation than I can give, > > though.> >> > As for something more rigorous, I think a lot of people are reluctant to use > > PCA as a modeling approach not so much because it's hard to choose a > > threshold for selecting components, but because the interpretation of the > > meaning of each component is pretty subjective. If you want an explanatory > > model, be careful about using PCA. You would be better served by deciding, > > based perhaps on expert knowledge about the variables, which ones to use in > > the model and which ones not to.> >> > To try to make this a bit more spatial, and therefore more relevant to the > > list, I will also warn you that your various climate variables are almost > > certainly spatially autocorrelated - that is, neighboring and nearby > > observations in the grid are not independent. That has serious implications > > for standard multivariate analysis techniques and diagnostics.> >> > Yours,> >> > Ashton> >> > On Thursday 11 December 2008 06:46:37 am Corrado wrote:> > > >> 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 into a statistical model as co-variates, to use them to> >> predict a response variable.> >>> >> The climatic data are obviously correlated: precipitation for January is> >> correlated to precipitation for February and so on .... even precipitation> >> and temperature are heavily correlated. I did some correlation analysis and> >> they are all strongly correlated.> >>> >> I though of running PCA on them, in order to reduce the number of> >> co-variates I feed into the model.> >>> >> 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?> >>> >> At the moment, I am using a criteria based on threshold, but that is highly> >> subjective, even if there are some rules of thumb (Jolliffe,Principal> >> Component Analysis, II Edition, Springer Verlag,2002).> >>> >> Could you suggest something more rigorous?> >>> >> By the way, do you think I would have been better off by using something> >> different from PCA?> >>> >> Best,> >> > >> >> >> > > > -- > Edzer Pebesma> Institute for Geoinformatics (ifgi), University of M?nster> Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251> 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/> http://www.springer.com/978-0-387-78170-9 e.pebesma@wwu.de> > > > ------------------------------> > Message: 7> Date: Thu, 11 Dec 2008 14:44:13 +0000> From: Corrado <ct529@york.ac.uk>> Subject: Re: [R-sig-Geo] Principal Component Analysis -> Selectingcomponents? + right choice?> To: "Kamran Safi" <Kamran.Safi@ioz.ac.uk>> Cc: r-sig-geo@stat.math.ethz.ch> Message-ID: <200812111444.13540.ct529@york.ac.uk>> Content-Type: text/plain; charset="iso-8859-1"> > 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 less so, though .... and the complexity of interpretation increases > with explained variance decreasing.> > I am using the approach suggested by Kamran: I have brewed down the original > climatic variables to uncorrelated "environmental variables", and I have > chosen the signification ones using a threshold. I do realise spatial > auto-correlation is going to be important (even if my sites are fairly > distant from one another, reducing the impact), but do not know anything > about spatial filtering. Whilst I have used distance matrices, I have never > used them to remove spatial auto-correlation!> > Could you please point me out to some resources please?> > Best,> > > > > On Thursday 11 December 2008 14:29:27 Kamran Safi wrote:> > 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> > divides 100% variance into your N principal components and generates a> > null expectation for the distributions of randomly partioning the> > original variance. You then take all those PCAs that are above the> > broken stick distribution. This is by no means an agreed upon approach,> > but it is at least reproducible and has some theory behind it, but is> > and will remain a rule of thumb.> > In terms of spatial analysis you could derive the PCAs and then go into> > classic spatial analysis. Although the interpretation of PCA is> > sometimes complicated or even impossible, you can calculate the values> > for every grid cell and then go into multivariate analysis whereby you> > have to take spatial autocorrelation into account. At least your PCA> > components are orthogonal, which simplifies your analysis in contrast to> > using the original variables. It also allows you to produce predictive> > models.> > What you could think of doing could be using PCA to derive> > "environmental" variables which are uncorrelated and the use the> > distance matrix and spatial filtering to "remove" spatial> > autocorrelation.> >> > Hope this helps,> >> > Kami> >> >> >> > ------------------------> > Kamran Safi> >> > Postdoctoral Research Fellow> > Institute of Zoology> > Zoological Society of London> > Regent's Park> > London NW1 4RY> >> > http://www.zoo.cam.ac.uk/ioz/people/safi.htm> >> > http://spatialr.googlepages.com> > http://asapi.wetpaint.com> >> > -----Original Message-----> > From: r-sig-geo-bounces@stat.math.ethz.ch> > [mailto:r-sig-geo-bounces@stat.math.ethz.ch] On Behalf Of Ashton> > Shortridge> > Sent: 11 December 2008 14:11> > To: r-sig-geo@stat.math.ethz.ch> > Cc: Corrado> > Subject: Re: [R-sig-Geo] Principal Component Analysis -> > Selectingcomponents? + right choice?> >> > 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, either. I am not a PCA person, but> > the> > rule of thumb I am aware of is to plot the variability each> > component 'explains' and look for a clear breakpoint. I would think> > about any> > multivariate analysis text would have a better explanation than I can> > give,> > though.> >> > As for something more rigorous, I think a lot of people are reluctant to> > use> > PCA as a modeling approach not so much because it's hard to choose a> > threshold for selecting components, but because the interpretation of> > the> > meaning of each component is pretty subjective. If you want an> > explanatory> > model, be careful about using PCA. You would be better served by> > deciding,> > based perhaps on expert knowledge about the variables, which ones to use> > in> > the model and which ones not to.> >> > To try to make this a bit more spatial, and therefore more relevant to> > the> > list, I will also warn you that your various climate variables are> > almost> > certainly spatially autocorrelated - that is, neighboring and nearby> > observations in the grid are not independent. That has serious> > implications> > for standard multivariate analysis techniques and diagnostics.> >> > Yours,> >> > Ashton> >> > On Thursday 11 December 2008 06:46:37 am Corrado wrote:> > > 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 into a statistical model as co-variates, to use> >> > them to> >> > > predict a response variable.> > >> > > The climatic data are obviously correlated: precipitation for January> >> > is> >> > > correlated to precipitation for February and so on .... even> >> > precipitation> >> > > and temperature are heavily correlated. I did some correlation> >> > analysis and> >> > > they are all strongly correlated.> > >> > > I though of running PCA on them, in order to reduce the number of> > > co-variates I feed into the model.> > >> > > 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?> > >> > > At the moment, I am using a criteria based on threshold, but that is> >> > highly> >> > > subjective, even if there are some rules of thumb (Jolliffe,Principal> > > Component Analysis, II Edition, Springer Verlag,2002).> > >> > > Could you suggest something more rigorous?> > >> > > By the way, do you think I would have been better off by using> >> > something> >> > > different from PCA?> > >> > > Best,> > > > -- > Corrado Topi> > Global Climate Change & Biodiversity Indicators> Area 18,Department of Biology> University of York, York, YO10 5YW, UK> Phone: + 44 (0) 1904 328645, E-mail: ct529@york.ac.uk> > > > ------------------------------> > Message: 8> Date: Thu, 11 Dec 2008 16:09:37 -0000> From: "Kamran Safi" <Kamran.Safi@ioz.ac.uk>> Subject: Re: [R-sig-Geo] Principal Component Analysis -> Selectingcomponents? + right choice?> To: "Corrado" <ct529@york.ac.uk>> Cc: r-sig-geo@stat.math.ethz.ch> Message-ID: <41E1ED29E5E8E34BBDD8B82CFA1A9D0406380A30@zsl26>> Content-Type: text/plain; charset="us-ascii"> > 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 pairwise distance matrix a set of principal coordinates (not be> confused with principal components). MDS is a method (old!) that> converts a pairwise distance matrix into n-1 dimensional vertical> matrix. It is implemented in R base. Have a look at cmdscale() and> isoMDS(). There I would use all those PCo which significantly predict> your dependent variable(s) (But see below).> > Another very useful and classic resource is this paper:> http://www.ufz.de/data/Dormann-et-al_Methods-Autocorrelation6834.pdf> Specifically its appendix. Spatial filtering is described there too.> > Hope this helps. Good luck.> > Kamran> > > > > ------------------------> Kamran Safi> > Postdoctoral Research Fellow> Institute of Zoology> Zoological Society of London> Regent's Park> London NW1 4RY> > http://www.zoo.cam.ac.uk/ioz/people/safi.htm> > http://spatialr.googlepages.com> http://asapi.wetpaint.com> > > -----Original Message-----> From: Corrado [mailto:ct529@york.ac.uk] > Sent: 11 December 2008 14:44> To: Kamran Safi> Cc: Ashton Shortridge; r-sig-geo@stat.math.ethz.ch> Subject: Re: [R-sig-Geo] Principal Component Analysis -> Selectingcomponents? + right choice?> > 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 less so, though .... and the complexity of interpretation> increases > with explained variance decreasing.> > I am using the approach suggested by Kamran: I have brewed down the> original > climatic variables to uncorrelated "environmental variables", and I have> > chosen the signification ones using a threshold. I do realise spatial > auto-correlation is going to be important (even if my sites are fairly > distant from one another, reducing the impact), but do not know> anything > about spatial filtering. Whilst I have used distance matrices, I have> never > used them to remove spatial auto-correlation!> > Could you please point me out to some resources please?> > Best,> > > > > On Thursday 11 December 2008 14:29:27 Kamran Safi wrote:> > 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> > divides 100% variance into your N principal components and generates a> > null expectation for the distributions of randomly partioning the> > original variance. You then take all those PCAs that are above the> > broken stick distribution. This is by no means an agreed upon> approach,> > but it is at least reproducible and has some theory behind it, but is> > and will remain a rule of thumb.> > In terms of spatial analysis you could derive the PCAs and then go> into> > classic spatial analysis. Although the interpretation of PCA is> > sometimes complicated or even impossible, you can calculate the values> > for every grid cell and then go into multivariate analysis whereby you> > have to take spatial autocorrelation into account. At least your PCA> > components are orthogonal, which simplifies your analysis in contrast> to> > using the original variables. It also allows you to produce predictive> > models.> > What you could think of doing could be using PCA to derive> > "environmental" variables which are uncorrelated and the use the> > distance matrix and spatial filtering to "remove" spatial> > autocorrelation.> >> > Hope this helps,> >> > Kami> >> >> >> > ------------------------> > Kamran Safi> >> > Postdoctoral Research Fellow> > Institute of Zoology> > Zoological Society of London> > Regent's Park> > London NW1 4RY> >> > http://www.zoo.cam.ac.uk/ioz/people/safi.htm> >> > http://spatialr.googlepages.com> > http://asapi.wetpaint.com> >> > -----Original Message-----> > From: r-sig-geo-bounces@stat.math.ethz.ch> > [mailto:r-sig-geo-bounces@stat.math.ethz.ch] On Behalf Of Ashton> > Shortridge> > Sent: 11 December 2008 14:11> > To: r-sig-geo@stat.math.ethz.ch> > Cc: Corrado> > Subject: Re: [R-sig-Geo] Principal Component Analysis -> > Selectingcomponents? + right choice?> >> > 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, either. I am not a PCA person, but> > the> > rule of thumb I am aware of is to plot the variability each> > component 'explains' and look for a clear breakpoint. I would think> > about any> > multivariate analysis text would have a better explanation than I can> > give,> > though.> >> > As for something more rigorous, I think a lot of people are reluctant> to> > use> > PCA as a modeling approach not so much because it's hard to choose a> > threshold for selecting components, but because the interpretation of> > the> > meaning of each component is pretty subjective. If you want an> > explanatory> > model, be careful about using PCA. You would be better served by> > deciding,> > based perhaps on expert knowledge about the variables, which ones to> use> > in> > the model and which ones not to.> >> > To try to make this a bit more spatial, and therefore more relevant to> > the> > list, I will also warn you that your various climate variables are> > almost> > certainly spatially autocorrelated - that is, neighboring and nearby> > observations in the grid are not independent. That has serious> > implications> > for standard multivariate analysis techniques and diagnostics.> >> > Yours,> >> > Ashton> >> > On Thursday 11 December 2008 06:46:37 am Corrado wrote:> > > 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 into a statistical model as co-variates, to use> >> > them to> >> > > predict a response variable.> > >> > > The climatic data are obviously correlated: precipitation for> January> >> > is> >> > > correlated to precipitation for February and so on .... even> >> > precipitation> >> > > and temperature are heavily correlated. I did some correlation> >> > analysis and> >> > > they are all strongly correlated.> > >> > > I though of running PCA on them, in order to reduce the number of> > > co-variates I feed into the model.> > >> > > 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?> > >> > > At the moment, I am using a criteria based on threshold, but that is> >> > highly> >> > > subjective, even if there are some rules of thumb> (Jolliffe,Principal> > > Component Analysis, II Edition, Springer Verlag,2002).> > >> > > Could you suggest something more rigorous?> > >> > > By the way, do you think I would have been better off by using> >> > something> >> > > different from PCA?> > >> > > Best,> > > > -- > Corrado Topi> > Global Climate Change & Biodiversity Indicators> Area 18,Department of Biology> University of York, York, YO10 5YW, UK> Phone: + 44 (0) 1904 328645, E-mail: ct529@york.ac.uk> > > This message has been scanned for viruses by MailControl -> www.mailcontrol.com> > Click> https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==> vm6C4VtfQHmif9hp5cCl61pOCDRy5!TUZWDEGNPdlyNkQ== to report this email as> spam.> > > The Zoological Society of London is incorporated by Royal Charter> Principal Office England. Company Number RC000749> Registered address: > Regent's Park, London, England NW1 4RY> Registered Charity in England and Wales no. 208728 > > _________________________________________________________________________> This e-mail has been sent in confidence to the named addressee(s).> If you are not the intended recipient, you must not disclose or distribute> it in any form, and you are asked to contact the sender immediately.> Views or opinions expressed in this communication may not be those> of The Zoological Society of London and, therefore, The Zoological> Society of London does not accept legal responsibility for the contents> of this message. The recipient(s) must be aware that e-mail is not a> secure communication medium and that the contents of this mail may> have been altered by a third party in transit.> If you have any issues regarding this mail please contact:> administrator@zsl.org.> > > > ------------------------------> > Message: 9> Date: Thu, 11 Dec 2008 11:16:13 -0500> From: Zev Ross <zev@zevross.com>> Subject: Re: [R-sig-Geo] GSTAT - singular in meters not km> To: Edzer Pebesma <edzer.pebesma@uni-muenster.de>> Cc: r-sig-geo@stat.math.ethz.ch> Message-ID: <49413CCD.5050103@zevross.com>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed> > 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", 40000, > > 0.00001),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 > > makes the problem ill-conditioned. If you add argument > > fit.ranges=FALSE it will not be singular anymore.> >> > In the end, this problem is similar to e.g. regression of polynomials > > on coordinates without standardizing the coordinates.> >> > I'll add a warning message to fit.variogram to suggest the two > > solutions, for this case.> > -- > > Edzer> >> > Zev Ross wrote:> >> Edzer (and all),> >>> >> I don't think that it's related to an unrealistic range. I've tried a > >> lot of different realistic and non-realistic values and get singular > >> results each time. If I divide the X and Y coordinates by 10, 100, > >> 1000 or 10000 I don't get singularity. Using Lat and Long works fine. > >> Code is below and I included a link to a workspace with the "pol" > >> data set at the bottom.> >>> >> Zev> >>> >> polA<-pol> >> coordinates(polA)<-~x+y> >> v<-variogram(pollutant~1, data=polA)> >> v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40000, 0.00001))> >> attributes(v.fit)$singular # TRUE> >>> >> polB<-pol> >> polB$x<-polB$x/1000> >> polB$y<-polB$y/1000> >> coordinates(polB)<-~x+y> >> v<-variogram(pollutant~1, data=polB)> >> v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40, 0.00001))> >> attributes(v.fit)$singular #FALSE> >>> >> polC<-pol> >> coordinates(polC)<-~longitude+latitude> >> v<-variogram(pollutant~1, data=polC)> >> v.fit<-fit.variogram(v, vgm(0.0005, "Sph", .4, 0.00001))> >> attributes(v.fit)$singular # FALSE> >>> >> http://www.zevross.com/temp2/singular_or_not.RData> >>> >> Edzer Pebesma wrote:> >>> Hi Zev, it is hard to see what happens without seeing your data or R > >>> commands.> >>>> >>> Is it possible that you passed an unrealistic value for the range > >>> parameter, as starting value for the variogram model argument of > >>> fit.variogram?> >>> -- > >>> Edzer> >>>> >>> Zev Ross wrote:> >>>> Hi All,> >>>>> >>>> I'm fitting variograms in GSTAT with fit.variogram and I was > >>>> surprised to find that all my fits were singular. I experimented > >>>> with converting the data to unprojected data (decimal degrees) and > >>>> with dividing my X and Y coordinates, which are in meters, by 1000 > >>>> (to get KM). In both cases the fitting procedure worked with no > >>>> singularity. Based on the numbers of pairs the bins appeared to be > >>>> about the same so it appears to be a matter of the coordinates > >>>> themselves.> >>>>> >>>> I'd prefer not to have to convert the coordinates back and forth > >>>> between meters and KM, any suggestions?> >>>>> >>>> Zev> >>>>> >>>> _______________________________________________> >>>> R-sig-Geo mailing list> >>>> R-sig-Geo@stat.math.ethz.ch> >>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo> >>>> >>> >> > > > ------------------------------> > Message: 10> Date: Thu, 11 Dec 2008 18:23:23 +0100> From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>> Subject: Re: [R-sig-Geo] Subsetting a spatial grid> To: rob.robinson@bto.org> Cc: r-sig-geo@stat.math.ethz.ch> Message-ID: <49414C8B.4050406@uni-muenster.de>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed> > 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> > satellite data from which I would like to extract an arbitrary (but simple> > rectangular) portion for subsequent analysis (which I'll need to do for many> > images). I have the data as a (projected) SpatialGridDataFrame and have> > tried two approaches: create a SpatialPolygon and overlay it (but I don't> > think overlay does what I would like it to do), or access the coords slot of> > the data set and pick those within the range. I haven't been able to get> > either to work - presumably because my R is not good enough! It seems a> > fairly common task, but I haven't yet stumbled across an FAQ or page in> > ASDAR which seems to help. Any pointers anyone?> > Many thanks for any help> > Cheers> > rob> >> > *** Want to know about Britain's birds? Try www.bto.org/birdfacts ***> >> > Dr Rob Robinson, Senior Population Biologist> > British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU> > Ph: +44 (0)1842 750050 E: rob.robinson@bto.org> > Fx: +44 (0)1842 750030 W: www.bto.org/cv/rob_robinson.htm> >> > ==== "How can anyone be enlightened, when truth is so poorly lit" =====> >> > _______________________________________________> > R-sig-Geo mailing list> > R-sig-Geo@stat.math.ethz.ch> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo> > > > -- > Edzer Pebesma> Institute for Geoinformatics (ifgi), University of M?nster> Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251> 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/> http://www.springer.com/978-0-387-78170-9 e.pebesma@wwu.de> > > > ------------------------------> > Message: 11> Date: Thu, 11 Dec 2008 13:10:54 -0800> From: "Satterthwaite, Paul" <Paul.Satterthwaite@oregonstate.edu>> Subject: [R-sig-Geo] periodic variograms> To: <r-sig-geo@stat.math.ethz.ch>> Message-ID:> <D7B94F0B40246740A3EFF9DBBD921B7BB89880@SAGE.forestry.oregonstate.edu>> Content-Type: text/plain> > Hello, > > > > I am a beginner with R, and have 2 questions concerning> spatial/geostatistics. I doing a little exercise investigating> periodicity in artificial patch landscapes and resulting periodicity of> semivariograms. > > > > Does anyone know if there is an already-existing model semivariogram> that contains a "hole effect" that can dampen with increasing lag, i.e.,> includes some periodicity in the model semivariogram fit to the> empirical data? > > > > Any ideas would be GREATLY appreciated!> > Cheers!> > > > Sincerely, > > > > Paul M. Satterthwaite> > > > > > Paul M. Satterthwaite> > MS Student, Forest Science> > Richardson 201A> > Oregon State University> > Corvallis, OR 97331> > paul.satterthwaite@oregonstate.edu> <mailto:paul.satterthwaite@oregonstate.edu> > > > > > [[alternative HTML version deleted]]> > > > ------------------------------> > Message: 12> Date: Thu, 11 Dec 2008 21:16:41 -0200 (BRST)> From: Paulo Justiniano Ribeiro Jr <paulojus@c3sl.ufpr.br>> Subject: Re: [R-sig-Geo] periodic variograms> To: "Satterthwaite, Paul" <Paul.Satterthwaite@oregonstate.edu>> Cc: r-sig-geo@stat.math.ethz.ch> Message-ID: <Pine.LNX.4.58.0812112115470.9169@talisker.c3sl.ufpr.br>> Content-Type: TEXT/PLAIN; charset=US-ASCII> > You could try with the wave model:> > require(geoR)> > plot(c(0,100), c(0,1.5), type="n")> > lines.variomodel(1:100,"wave", cov.pars=c(1, 5), nug=0.2)> > which is algo implemented by other packages> > > > > Paulo Justiniano Ribeiro Jr> LEG (Laboratorio de Estatistica e Geoinformacao)> Universidade Federal do Parana> Caixa Postal 19.081> CEP 81.531-990> Curitiba, PR - Brasil> Tel: (+55) 41 3361 3573> Fax: (+55) 41 3361 3141> e-mail: paulojus AT ufpr br> http://www.leg.ufpr.br/~paulojus> > > > On Thu, 11 Dec 2008, Satterthwaite, Paul wrote:> > > Hello,> >> >> >> > I am a beginner with R, and have 2 questions concerning> > spatial/geostatistics. I doing a little exercise investigating> > periodicity in artificial patch landscapes and resulting periodicity of> > semivariograms.> >> >> >> > Does anyone know if there is an already-existing model semivariogram> > that contains a "hole effect" that can dampen with increasing lag, i.e.,> > includes some periodicity in the model semivariogram fit to the> > empirical data?> >> >> >> > Any ideas would be GREATLY appreciated!> >> > Cheers!> >> >> >> > Sincerely,> >> >> >> > Paul M. Satterthwaite> >> >> >> >> >> > Paul M. Satterthwaite> >> > MS Student, Forest Science> >> > Richardson 201A> >> > Oregon State University> >> > Corvallis, OR 97331> >> > paul.satterthwaite@oregonstate.edu> > <mailto:paul.satterthwaite@oregonstate.edu>> >> >> >> >> > [[alternative HTML version deleted]]> >> > _______________________________________________> > R-sig-Geo mailing list> > R-sig-Geo@stat.math.ethz.ch> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo> >> > > > ------------------------------> > Message: 13> Date: Fri, 12 Dec 2008 01:13:15 +0100> From: "G. Allegri" <giohappy@gmail.com>> Subject: Re: [R-sig-Geo] Principal Component Analysis -> Selectingcomponents? + right choice?> To: "Kamran Safi" <Kamran.Safi@ioz.ac.uk>> Cc: r-sig-geo@stat.math.ethz.ch, Corrado <ct529@york.ac.uk>> Message-ID:> <e12429640812111613x1f89db7nc282758ae487db51@mail.gmail.com>> Content-Type: text/plain; charset=ISO-8859-1> > I just share a link to a paper I've recently read, about the thread> object: http://dx.doi.org/10.1016/j.csda.2004.06.015> > giovanni> > 2008/12/11 Kamran Safi <Kamran.Safi@ioz.ac.uk>:> > 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 pairwise distance matrix a set of principal coordinates (not be> > confused with principal components). MDS is a method (old!) that> > converts a pairwise distance matrix into n-1 dimensional vertical> > matrix. It is implemented in R base. Have a look at cmdscale() and> > isoMDS(). There I would use all those PCo which significantly predict> > your dependent variable(s) (But see below).> >> > Another very useful and classic resource is this paper:> > http://www.ufz.de/data/Dormann-et-al_Methods-Autocorrelation6834.pdf> > Specifically its appendix. Spatial filtering is described there too.> >> > Hope this helps. Good luck.> >> > Kamran> >> >> >> >> > ------------------------> > Kamran Safi> >> > Postdoctoral Research Fellow> > Institute of Zoology> > Zoological Society of London> > Regent's Park> > London NW1 4RY> >> > http://www.zoo.cam.ac.uk/ioz/people/safi.htm> >> > http://spatialr.googlepages.com> > http://asapi.wetpaint.com> >> >> > -----Original Message-----> > From: Corrado [mailto:ct529@york.ac.uk]> > Sent: 11 December 2008 14:44> > To: Kamran Safi> > Cc: Ashton Shortridge; r-sig-geo@stat.math.ethz.ch> > Subject: Re: [R-sig-Geo] Principal Component Analysis -> > Selectingcomponents? + right choice?> >> > 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 less so, though .... and the complexity of interpretation> > increases> > with explained variance decreasing.> >> > I am using the approach suggested by Kamran: I have brewed down the> > original> > climatic variables to uncorrelated "environmental variables", and I have> >> > chosen the signification ones using a threshold. I do realise spatial> > auto-correlation is going to be important (even if my sites are fairly> > distant from one another, reducing the impact), but do not know> > anything> > about spatial filtering. Whilst I have used distance matrices, I have> > never> > used them to remove spatial auto-correlation!> >> > Could you please point me out to some resources please?> >> > Best,> >> >> >> >> > On Thursday 11 December 2008 14:29:27 Kamran Safi wrote:> >> 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> >> divides 100% variance into your N principal components and generates a> >> null expectation for the distributions of randomly partioning the> >> original variance. You then take all those PCAs that are above the> >> broken stick distribution. This is by no means an agreed upon> > approach,> >> but it is at least reproducible and has some theory behind it, but is> >> and will remain a rule of thumb.> >> In terms of spatial analysis you could derive the PCAs and then go> > into> >> classic spatial analysis. Although the interpretation of PCA is> >> sometimes complicated or even impossible, you can calculate the values> >> for every grid cell and then go into multivariate analysis whereby you> >> have to take spatial autocorrelation into account. At least your PCA> >> components are orthogonal, which simplifies your analysis in contrast> > to> >> using the original variables. It also allows you to produce predictive> >> models.> >> What you could think of doing could be using PCA to derive> >> "environmental" variables which are uncorrelated and the use the> >> distance matrix and spatial filtering to "remove" spatial> >> autocorrelation.> >>> >> Hope this helps,> >>> >> Kami> >>> >>> >>> >> ------------------------> >> Kamran Safi> >>> >> Postdoctoral Research Fellow> >> Institute of Zoology> >> Zoological Society of London> >> Regent's Park> >> London NW1 4RY> >>> >> http://www.zoo.cam.ac.uk/ioz/people/safi.htm> >>> >> http://spatialr.googlepages.com> >> http://asapi.wetpaint.com> >>> >> -----Original Message-----> >> From: r-sig-geo-bounces@stat.math.ethz.ch> >> [mailto:r-sig-geo-bounces@stat.math.ethz.ch] On Behalf Of Ashton> >> Shortridge> >> Sent: 11 December 2008 14:11> >> To: r-sig-geo@stat.math.ethz.ch> >> Cc: Corrado> >> Subject: Re: [R-sig-Geo] Principal Component Analysis -> >> Selectingcomponents? + right choice?> >>> >> 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, either. I am not a PCA person, but> >> the> >> rule of thumb I am aware of is to plot the variability each> >> component 'explains' and look for a clear breakpoint. I would think> >> about any> >> multivariate analysis text would have a better explanation than I can> >> give,> >> though.> >>> >> As for something more rigorous, I think a lot of people are reluctant> > to> >> use> >> PCA as a modeling approach not so much because it's hard to choose a> >> threshold for selecting components, but because the interpretation of> >> the> >> meaning of each component is pretty subjective. If you want an> >> explanatory> >> model, be careful about using PCA. You would be better served by> >> deciding,> >> based perhaps on expert knowledge about the variables, which ones to> > use> >> in> >> the model and which ones not to.> >>> >> To try to make this a bit more spatial, and therefore more relevant to> >> the> >> list, I will also warn you that your various climate variables are> >> almost> >> certainly spatially autocorrelated - that is, neighboring and nearby> >> observations in the grid are not independent. That has serious> >> implications> >> for standard multivariate analysis techniques and diagnostics.> >>> >> Yours,> >>> >> Ashton> >>> >> On Thursday 11 December 2008 06:46:37 am Corrado wrote:> >> > 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 into a statistical model as co-variates, to use> >>> >> them to> >>> >> > predict a response variable.> >> >> >> > The climatic data are obviously correlated: precipitation for> > January> >>> >> is> >>> >> > correlated to precipitation for February and so on .... even> >>> >> precipitation> >>> >> > and temperature are heavily correlated. I did some correlation> >>> >> analysis and> >>> >> > they are all strongly correlated.> >> >> >> > I though of running PCA on them, in order to reduce the number of> >> > co-variates I feed into the model.> >> >> >> > 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?> >> >> >> > At the moment, I am using a criteria based on threshold, but that is> >>> >> highly> >>> >> > subjective, even if there are some rules of thumb> > (Jolliffe,Principal> >> > Component Analysis, II Edition, Springer Verlag,2002).> >> >> >> > Could you suggest something more rigorous?> >> >> >> > By the way, do you think I would have been better off by using> >>> >> something> >>> >> > different from PCA?> >> >> >> > Best,> >> >> >> > --> > Corrado Topi> >> > Global Climate Change & Biodiversity Indicators> > Area 18,Department of Biology> > University of York, York, YO10 5YW, UK> > Phone: + 44 (0) 1904 328645, E-mail: ct529@york.ac.uk> >> >> > This message has been scanned for viruses by MailControl -> > www.mailcontrol.com> >> > Click> > https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==> > vm6C4VtfQHmif9hp5cCl61pOCDRy5!TUZWDEGNPdlyNkQ== to report this email as> > spam.> >> >> > The Zoological Society of London is incorporated by Royal Charter> > Principal Office England. Company Number RC000749> > Registered address:> > Regent's Park, London, England NW1 4RY> > Registered Charity in England and Wales no. 208728> >> > _________________________________________________________________________> > This e-mail has been sent in confidence to the named addressee(s).> > If you are not the intended recipient, you must not disclose or distribute> > it in any form, and you are asked to contact the sender immediately.> > Views or opinions expressed in this communication may not be those> > of The Zoological Society of London and, therefore, The Zoological> > Society of London does not accept legal responsibility for the contents> > of this message. The recipient(s) must be aware that e-mail is not a> > secure communication medium and that the contents of this mail may> > have been altered by a third party in transit.> > If you have any issues regarding this mail please contact:> > administrator@zsl.org.> >> > _______________________________________________> > R-sig-Geo mailing list> > R-sig-Geo@stat.math.ethz.ch> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo> >> > > > ------------------------------> > Message: 14> Date: Fri, 12 Dec 2008 09:19:21 +0100> From: St?phane Dray <dray@biomserv.univ-lyon1.fr>> Subject: Re: [R-sig-Geo] Principal Component Analysis - Selecting> components? + right choice?> To: Edzer Pebesma <edzer.pebesma@uni-muenster.de>> Cc: r-sig-geo@stat.math.ethz.ch, Corrado <ct529@york.ac.uk>> Message-ID: <49421E89.6080300@biomserv.univ-lyon1.fr>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed> > multispati function in ade4 implements a method wich is very similar to > SFA of Switzer et al. It find linear combination of the variables that > maximize the product variance by autocorrelation when PCA maximize only > the first part and SFA only the second one. Relations between SFA and > multispati are described in the paper:> > *S. Dray*, S. Sa?d, and F. D?bias. Spatial ordination of vegetation data > using a generalization of Wartenberg's multivariate spatial correlation. > /Journal of Vegetation Science/, 19:45-56, 2008.> > Edzer Pebesma wrote:> > 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 regression. Using them, you could with the same amount of > > degrees of freedom look at completely different directions.> >> > In addition to Ashton's remark: a variety of principle components that > > tries to pick up spatial correlated patterns in addition to maximum > > variability/correlation between variables is MNF (minimum nois > > fraction) factors, also called min/max autocorrelation factors; see > > the papers by Green, Switzer and others. I'm not aware of > > implementations of them in R, but would be interested to hear.> >> > Best regards,> > -- > > Edzer> >> > Ashton Shortridge wrote:> >> 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, either. I am not a PCA > >> person, but the rule of thumb I am aware of is to plot the > >> variability each component 'explains' and look for a clear > >> breakpoint. I would think about any multivariate analysis text would > >> have a better explanation than I can give, though.> >>> >> As for something more rigorous, I think a lot of people are reluctant > >> to use PCA as a modeling approach not so much because it's hard to > >> choose a threshold for selecting components, but because the > >> interpretation of the meaning of each component is pretty subjective. > >> If you want an explanatory model, be careful about using PCA. You > >> would be better served by deciding, based perhaps on expert knowledge > >> about the variables, which ones to use in the model and which ones > >> not to.> >>> >> To try to make this a bit more spatial, and therefore more relevant > >> to the list, I will also warn you that your various climate variables > >> are almost certainly spatially autocorrelated - that is, neighboring > >> and nearby observations in the grid are not independent. That has > >> serious implications for standard multivariate analysis techniques > >> and diagnostics.> >>> >> Yours,> >>> >> Ashton> >>> >> On Thursday 11 December 2008 06:46:37 am Corrado wrote:> >> > >>> 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 into a statistical model as co-variates, to use > >>> them to> >>> predict a response variable.> >>>> >>> The climatic data are obviously correlated: precipitation for > >>> January is> >>> correlated to precipitation for February and so on .... even > >>> precipitation> >>> and temperature are heavily correlated. I did some correlation > >>> analysis and> >>> they are all strongly correlated.> >>>> >>> I though of running PCA on them, in order to reduce the number of> >>> co-variates I feed into the model.> >>>> >>> 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?> >>>> >>> At the moment, I am using a criteria based on threshold, but that is > >>> highly> >>> subjective, even if there are some rules of thumb (Jolliffe,Principal> >>> Component Analysis, II Edition, Springer Verlag,2002).> >>>> >>> Could you suggest something more rigorous?> >>>> >>> By the way, do you think I would have been better off by using > >>> something> >>> different from PCA?> >>>> >>> Best,> >>> > >>> >>> >>> >> > >> > -- > St?phane DRAY (dray@biomserv.univ-lyon1.fr )> Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I> 43, Bd du 11 Novembre 1918, 69622 Villeurbanne Cedex, France> Tel: 33 4 72 43 27 57 Fax: 33 4 72 43 13 88> http://biomserv.univ-lyon1.fr/~dray/> > > > ------------------------------> > _______________________________________________> R-sig-Geo mailing list> R-sig-Geo@stat.math.ethz.ch> https://stat.ethz.ch/mailman/listinfo/r-sig-geo> > > End of R-sig-Geo Digest, Vol 64, Issue 12> *****************************************
	[[alternative HTML version deleted]]


