<p style="border:0; padding:0; margin:0; font-family:'굴림'; font-size:10pt; cursor: text;"><p id="ext-gen523" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'>By using gstat package, I can do 5-fold cross validation. How can I write the code/create the loop for "Repeated 5-fold cross validation" for 10 repeat. Code for 5-fold cross validation is given below. I knew about 'repeated k-fold cross validation' from <a id="ext-gen529" href="http://stats.stackexchange.com/questions/103459/how-do-i-know-which-method-of-cross-validation-is-best">here</a>.</p><p id="ext-gen523" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'><br></p><p id="ext-gen523" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'>library(sp)<br>data(meuse)  <br>coordinates(meuse) <- ~x+y<br>m <- vgm(.59, "Sph", 874, .04)</p><p id="ext-gen523" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'><br># five-fold cross validation:<br>x <- krige.cv(log(zinc)~1, meuse, m, nmax = 40, nfold=5)<br>str(x)<br>(R <-cor(x$observed, x$var1.pred))<br>(RMSE<- sqrt(mean((x$var1.pred-x$observed)^2)))</p><p id="ext-gen523" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'><br></p><p id="ext-gen523" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'>Orpheus<br></p><p><div id="ext-gen528" style="color: rgb(0, 102, 204); font-family: 돋움,arial; font-size: 12px; font-weight: bold; margin-top: 30px; margin-left: 0.8em;">--------- 원본 메일 ---------</div><blockquote id="ext-gen524" style="margin: 0pt 0pt 0pt 0.8em; padding-left: 1em; font-size: 12px; border-left-width: 2px; border-left-style: solid;"><div id="ext-gen525" style="line-height: 1.5; font-family: arial,돋움;"><b>보낸사람</b> :  <uzzal@gist.ac.kr><br><b>받는사람</b> : r-sig-geo <r-sig-geo@r-project.org><br><b id="ext-gen527">받은날짜</b> : 2016년 Apr 4일(Mon) 22:02:51<br><b id="ext-gen526">제목</b> : [R-sig-Geo] Is there option for 'repeated K-fold cross validation' in gstat package?<br><!-- original content --><div style="margin-top: 5px;"><p style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; font-family: "굴림"; font-size: 10pt; cursor: text;'><p id="ext-gen434" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'>I am working with spatial dataset. I have done ordinary kriging on this dataset using gstat package in R. I want to do 'repeated K-fold cross validation' using krige.cv function of gstat package. as far as I know using krige.cv function K-fold/n-fold cross validation is possible. Is there any option of doing 'repeated K-fold cross validation'  in gstat? or K-fold cross validation is enough to check the relation between observed values and kriging predicted values?</p><p id="ext-gen434" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'><br></p><p id="ext-gen434" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'>I came to know about 'repeated K-fold cross validation'  from <a id="ext-gen438" href="http://stats.stackexchange.com/questions/103459/how-do-i-know-which-method-of-cross-validation-is-best">here.</a> Any kind help will be appreciable.</p><p id="ext-gen434" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'><br></p><p id="ext-gen434" style='margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 1.5; font-family: "굴림"; font-size: 10pt; cursor: text;'>Orpheus<br></p><p><div id="ext-gen435" style="color: rgb(0, 102, 204); font-family: 돋움,arial; font-size: 12px; font-weight: bold; margin-top: 30px; margin-left: 0.8em;">--------- 원본 메일 ---------</div><blockquote style="margin: 0pt 0pt 0pt 0.8em; padding-left: 1em; font-size: 12px; border-left-width: 2px; border-left-style: solid;"><div id="ext-gen436" style="line-height: 1.5; font-family: arial,돋움;"><b>보낸사람</b> : Tom Philippi <tephilippi@gmail.com><br><b>받는사람</b> : Karla Shikev <karlashikev@gmail.com><br><b>참조</b> : r-sig-geo <r-sig-geo@r-project.org><br><b>받은날짜</b> : 2016년 Apr 4일(Mon) 05:17:16<br><b>제목</b> : Re: [R-sig-Geo] generating object with multiple polygons<br><!-- original content --><div style="margin-top: 5px;"><pre id="ext-gen437">Karla--
If you want a SpatialPolygonsDataFrame with both slices of polygons, you
can use spatial rbind.  The issue that may trip you up is that your slice1
and slice2 objects might not have unique polygon IDs.  Perhaps the simplest
solution is to use the spChFIDs in sp, with some prefix distinguishing
slice1 from slice2.  I assume you're generating some attributes as
variables in the data frame to distinguish the different polygons; you can
use those values as the prefix.  You can google this, or start with:
http://www.inside-r.org/packages/cran/sp/docs/as.data.frame.SpatialPolygonsDataFrame
http://gis.stackexchange.com/questions/32732/proper-way-to-rbind-spatialpolygonsdataframes-with-identical-polygon-ids

Tom 2

On Sun, Apr 3, 2016 at 6:53 AM, Karla Shikev <karlashikev@gmail.com> wrote:

> Dear all,
>
> This might be a newbie question, so I'd appreciate your patience with this.
>
> I'm obtaining climatic data from worldclim and generating polygons based on
> different climatic limits:
>
> library(raster)
> xx<-getData('worldclim', var='bio', res=10)$bio1
> slice1 <- rasterToPolygons(xx, fun = function(x) {x > 200 & x < 260})
> slice2 <- rasterToPolygons(xx, fun = function(x) {x > 250 & x < 300})
>
> Now, I'd like to combine "slice1" and "slice2" into the same
> "SpatialPolygonsDataFrame" object, but I do not want to merge them.
>
> Any help will be greatly appreciated.
>
> Karla
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
</karlashikev@gmail.com></pre></div><!-- original content --><br></div></blockquote><p></p><p></p><p><br></p><p><br></p><p><br></p>
<img width="1" height="1" src="https://mail.gist.ac.kr:443/checkread/NTAxNzA=/ci1zaWctZ2VvQHItcHJvamVjdC5vcmc=/"><img width="600" height="75" src="https://mail.gist.ac.kr:443/resources/theme/default/images/sign/mail_banner.jpg">
</div><!-- original content --><br></div></blockquote><p></p></p><p><br/></p><p><br/></p><p><br/></p>
<img src='https://mail.gist.ac.kr:443/checkread/NTEyNTc=/ci1zaWctZ2VvQHItcHJvamVjdC5vcmc=/' width='1px' height='1px' /><img src="https://mail.gist.ac.kr:443/resources/theme/default/images/sign/mail_banner.jpg" width="600px" height="75px">