[R-sig-Geo] adehabitatHR kernalBB batch processing

SheilaD sheila_dufford at fws.gov
Mon Jul 22 22:10:04 CEST 2013


Roman,
Thank you for responding so quickly. My problem is in scripting the
kernalbb function to pull the appropriate sig1 value for each bounce. The
liker function works fine. I get the following results:

## Maximization of the log-likelihood for Brownian Motion Variance
parameter (sig2)
lik_all <- liker(S000all, sig2 = 14.6, rangesig1 = c(1, 10),byburst =
FALSE, plotit = F)
lik_all

## RESULTS - Maximization of the log-likelihood for parameter sig1 of
brownian bridge

#F05 : Sig1 = 7.1622 Sig2 = 14.6
#F06 : Sig1 = 4.6757 Sig2 = 14.6
#F07 : Sig1 = 4.8649 Sig2 = 14.6
#L05 : Sig1 = 7.1622 Sig2 = 14.6
#L06 : Sig1 = 6.1261 Sig2 = 14.6
#L07 : Sig1 = 7.2613 Sig2 = 14.6
#L08 : Sig1 = 4.8198 Sig2 = 14.6
#R04 : Sig1 = 2.7568 Sig2 = 14.6
#R05 : Sig1 = 2.9279 Sig2 = 14.6
#R06 : Sig1 = 2.5946 Sig2 = 14.6
#R07 : Sig1 = 2.4234 Sig2 = 14.6
#S05 : Sig1 = 6.3604 Sig2 = 14.6
#S06 : Sig1 = 5.1802 Sig2 = 14.6
#S07 : Sig1 = 6.8649 Sig2 = 14.6
#S08 : Sig1 = 4.9099 Sig2 = 14.6
#W05 : Sig1 = 3.1261 Sig2 = 14.6
#W06 : Sig1 = 3.027 Sig2 = 14.6
#W07 : Sig1 = 3.4775 Sig2 = 14.6
#W08 : Sig1 = 2.3243 Sig2 = 14.6

I tried the following script and it seemed to work, except it appears to
have pulled the first sig1 value and applied this same value to every
burst. I am a bit of a novice at R and realize I need some form of a loop,
but I have no Idea how to script it.

sig1 <- c(7.1622, 4.6757, 4.8649, 7.1622, 6.1261, 7.2613, 4.8198, 2.7568,
2.9279, 2.5946, 2.4234, 6.3604, 5.1802, 5.1802, 6.8649, 4.9099, 3.1261,
3.027, 3.4775, 2.234)
S000allBB2 <- kernelbb(S000all, sig1=SIG1, sig2 = 14.6, grid = 800,
same4all = TRUE, byburst = TRUE)

I also tried to apply the script suggested be Johannes Signer (See below).
But I could note get past the error messages and either did not get a
result or would get a warning that some of  the arguments were ignored.

sig255 <- liker(ltraj, sig2 = 255, rangesig1 = c(0, 1000))
tataall <- lapply(seq_along(ltraj), function(x) kernelbb(ltraj[x],
sig1=sig255[[x]]$sig1, sig2=sig255[[x]]$sig2, grid=100, byburst=T))

My data if for a single Dall sheep partitioned by year and season.  I would
like the grids to be all the same. I would simplify further analysis using
raster math. It seemed logical to me that if you could calculate the
individual sig1 values by-burst, you could apply them in the kernelbb
function by-burst. If it can not be easily done, I am ready to use a single
Sig1 value, calculated for the whole dataset, and run the kernelbb
by-burst. Running each burst individually results in rasters with different
spatial resolutions, because the animals seasonal home range varies. I am
also not sure if there is much difference in the results for the
methodologies.

My inexperience is glaringly obvious.

Thanks again.

Sheila


On Fri, Jul 19, 2013 at 10:21 PM, Roman Luštrik [via R-sig-geo] <
ml-node+s2731867n7584206h16 at n2.nabble.com> wrote:

> What part is tripping you up? AFAIK, you "just" need to feed it a
> trajectory and some estimates from liker(). Are you having trouble
> extracting the data from those objects (objects `ltraj` and `sig255` in
> Phil's question)?
>
> Cheers,
> Roman
>
>
> On Sat, Jul 20, 2013 at 2:28 AM, SheilaD <[hidden email]<http://user/SendEmail.jtp?type=node&node=7584206&i=0>>
> wrote:
>
> > Has anyone been able to batch process the kernelbb function from
> > adehabitatHR
> > with individual sig1 values?
> >
> > p.s. im running
> > R version 2.15.2 (2012-10-26)
> > Platform: x86_64-w64-mingw32/x64 (64-bit)
> > adehabitatHR_0.4.7 adehabitatLT_0.3.11?
> >
> > Sheila
> >
> >
> > Phil H wrote
> > > I am attempting to use the kernalBB function from adehabitatHR. Now it
> > > works just fine with just one fish, however I have quite a number of
> > > fish and would like to run the analysis on all the fish in one
> > > go-while maintaining individual sig 1 estimates. See below for example
> > > coding...
> > >
> > > library(adehabitatHR)
> > > library(adehabitatLT)
> > > data(puechabonsp)
> > >
> > > loc$DT <-as.POSIXct(strptime(loc$Date, format='%y%m%d' ))
> > > ltraj <- as.ltraj(coordinates(loc), loc$DT, id = loc$Name, burst =
> > > loc$Name,
> > > + typeII = TRUE)
> > >
> > > sig255<-liker(ltraj, sig2 = 255, rangesig1 = c(0, 1000))
> > >
> > > *****************************************
> > >
> > > Maximization of the log-likelihood for parameter
> > > sig1 of brownian bridge
> > >
> > > Brock : Sig1 = 2.002 Sig2 = 255
> > > Calou : Sig1 = 0 Sig2 = 255
> > > Chou : Sig1 = 1.001 Sig2 = 255
> > > Jean : Sig1 = 2.002 Sig2 = 255
> > >
> > > ##so now I would like to run the kernalBB on all 4 fish individually.
> > > ##so i tried...
> > >
> > >> tataall <- kernelbb(ltraj, sig1 = sig255, sig2 = 255, grid =
> > >> 100,byburst=T)
> > >
> > > #Error in sig1^2 : non-numeric argument to binary operator
> > >
> > > ##I dont have a great deal of experience working with list formats-
> > > can anyone ##assist me in calling the relevent sig 1 for each fish?
> > >
> > >
> > >
> > > #now if I know I can used a fixed sig 1 for all fine ie
> > >> tataall <- kernelbb(ltraj, sig1 = 1, sig2 = 255, grid =
> 100,byburst=T)
> > >
> > >
> > > ##I am sure it is something stupid and easy....
> > >
> > > ##I see that when you do a similar thing for the D function in the BRB
> > > function it seems to work fine  (I assume that this is using differing
> > > D levels for each fish..)
> > >
> > > vv2<- BRB.likD(ltraj, Dr=c(1,50000), Tmax = 5*(24*60*60) + 1, Lmin =
> 0.1)
> > > testud <-BRB(ltraj, D =vv2, Tmax =5*(24*60*60) + 1, Lmin =0.1, hmin =
> > 100)
> > >
> > >
> > > finally, I notice that we get some zero sig 1 values both in my
> > > dataset and in the example of Calou. Is this an issue?
> > >
> > > Thanks for any help
> > >
> > > Phil H.
> > >
> > > p.s. im running
> > > R version 2.15.2 (2012-10-26)
> > > Platform: x86_64-w64-mingw32/x64 (64-bit)
> > > adehabitatHR_0.4.2 adehabitatLT_0.3.6
> > >
> > > _______________________________________________
> > > R-sig-Geo mailing list
> >
> > > R-sig-Geo@
> >
> > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://r-sig-geo.2731867.n2.nabble.com/adehabitatHR-kernalBB-batch-processing-tp7583119p7584205.html
> > Sent from the R-sig-geo mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=7584206&i=1>
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
>
>
> --
> In God we trust, all others bring data.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=7584206&i=2>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://r-sig-geo.2731867.n2.nabble.com/adehabitatHR-kernalBB-batch-processing-tp7583119p7584206.html
>  To unsubscribe from adehabitatHR kernalBB batch processing, click here<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7583119&code=c2hlaWxhX2R1ZmZvcmRAZndzLmdvdnw3NTgzMTE5fC05NTYyNjI5NDk=>
> .
> NAML<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
*Sheila J. Dufford*
*Biologist / GIS Specialist*
*Yukon Flats National Wildlife Refuge*
*101 12th Avenue, Room 264*
*Fairbanks, AK  99701*
*907-456-0307*
*sheila_dufford at fws.gov*
*
*
*"Most people are about as happy as they make up their minds to be.**"--Abraham
Lincoln*




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/adehabitatHR-kernalBB-batch-processing-tp7583119p7584225.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list