Picon
Favicon

hole-effect model variograms and moving average variograms

Hello, 

I am a beginner with R, and have 2 questions concerning
spatial/geostatistics. 

I have an artificial landscape composed of a binary grid of patches
(patch=1) or gaps (patch=0), which leads to very periodic empirical
semivariograms. 

1)Is there an already-existing model semivariogram that contains a "hole
effect", i.e., includes some periodicity in the model semivariogram fit
to the empirical data? 

2) Is there a way I can smooth this periodicity using a local/moving
average of values in a local neighborhood around each point in the grid?

Any ideas would be GREATLY appreciated!

Cheers!

Sincerely, 

Paul M. Satterthwaite

MS Student, Forest Science

Richardson 201A

Oregon State University

(Continue reading)

Gavin Simpson | 1 Dec 20:30
Picon
Picon
Favicon

Re: Problems with vegdist in Vegan

I don't understand your data? Dissimilarities are computed with
vegdist() in vegan on an n x m matrix of n samples and m variables. The
m variables could be species or any other set of descriptor variables.

Is your data like this? Or did you mean that your data are n samples
with a single column of numbers representing the count of a single thing
at each of the n samples? If so, are some counts zero? This doesn't
sound like a community matrix as I describe above to me.

I think the error message is reasonably clear; You have some samples
(rows) with no positive values in them (i.e. some all-zero counts for a
given sample (row)). In such cases, the Jaccard distance is not defined
- the warning is coming from the Bray-Curtis routine [as these two
dissimilarities are equivalent] and hence the ambiguity there ("...may
be..."), as the connoisseur may know what they are doing and know what
to do with such results. 

The second message is a consequence of the first; as the Jaccard is not
defined for empty rows, you get NA values for those comparisons
concerning this/those sample(s).

So I think yes, it is a problem and you need to consider how to proceed.
Perhaps taking a look at rowSums(yourData) might indicate which samples
are causing the problem.

HTH

G

On Thu, 2008-11-27 at 16:40 -0600, Manuel SpĂ­nola wrote:
(Continue reading)

Gavin Simpson | 1 Dec 21:06
Picon
Picon
Favicon

Re: Problems with vegdist in Vegan

On Mon, 2008-12-01 at 19:30 +0000, Gavin Simpson wrote:
> I don't understand your data? Dissimilarities are computed with
> vegdist() in vegan on an n x m matrix of n samples and m variables. The
> m variables could be species or any other set of descriptor variables.
> 
> Is your data like this? Or did you mean that your data are n samples
> with a single column of numbers representing the count of a single thing
> at each of the n samples? If so, are some counts zero? This doesn't
> sound like a community matrix as I describe above to me.
> 
> I think the error message is reasonably clear; You have some samples
> (rows) with no positive values in them (i.e. some all-zero counts for a
> given sample (row)). In such cases, the Jaccard distance is not defined
> - the warning is coming from the Bray-Curtis routine [as these two
> dissimilarities are equivalent] and hence the ambiguity there ("...may
> be..."), as the connoisseur may know what they are doing and know what
> to do with such results.

[sorry should have checked rather than rely on my memory; never a good
thing after a 5am start...]

The warning is actually coming from your use of 'dist = "jaccard"'.
There is no argument 'dist' in vegdist() hence the default 'method =
"bray"' is used, and hence the warning is raised from the initial checks
in vegdist()

Where I was misremembering is that it is in the C source that the bray
routine *is* used even if you want/ask for Jaccard. vegdist() sorts out
the difference to be the Bray-Curtis distances into Jaccard ones.

(Continue reading)

Jeffrey_Warren | 1 Dec 22:49
Favicon

RMark Burnham Ananlysis


I'm currently conducting an analysis of seasonal survival in RMark using
Burnham's joint analysis model.  The year is broken into the non-breeding
season (Sept. - April) and the breeding season (May-August).  Capture
periods occur in May, June, and August, so that the breeding season is
divided into 2 intervals (mid-May to mid-June and mid-June to late August)
and the non-breeding season is a single interval from September to April.
In MARK I could go into the PIMS and 'constrain' the 2 intervals of a
breeding season to have the same survival, but I can't figure out how to do
this in RMark.  It seems that adding a factor for breeding season and
non-breeding season may be the only way to do this.  This would require a
new factor for each model of interest (e.g., nbs(.) bs(.) vs. nbs(t) bs(t))
- I wanted to see if there were other options before going further.  Any
ideas would be appreciated.

Thanks,

Jeff Warren
Wildlife Biologist
Red Rock Lakes NWR
Lima, Montana 59739
(406) 276-3536
Jeff Laake | 2 Dec 16:07
Picon
Favicon

Re: RMark Burnham Ananlysis

Best place to post questions about RMark is on the phidot MARK forum.  I 
do get postings from this list but in digest form but I don't always 
review carefully.  Also, since RMark is not on CRAN many on this list 
may not be aware of RMark.

Now to your question.  You are on the right track to add another factor 
variable but not for groups.  I didn't quite understand your notation 
but you need to add a factor variable to the design data for S that you 
can use in place of the default time field.  I don't know how you have 
your time intervals set up but let's say it is something like below 
where time starts at beginning of "year" and end of breeding is after .2 
of a year (not sure arithmetic is correct here). Because S is an 
interval paramter, time will be given the value of the beginning of the 
interval.  Thus, records in the design data with values of 
1.0,1.1,2.0,2.1  etc are breeding season periods and the periods 
1.2,2.2,... will be non-breeding periods

ddl$S
time
1.0    breeding
1.1    breeding
1.2    non-breeding
2.0    breeding
2.1    breeding
2.2    non-breeding
.
.

So you can create 2 factor variables. One could be B or N for breeding 
non-breeding that would allow you to fit a model with differences 
(Continue reading)

Corrado | 3 Dec 10:29
Picon
Favicon

Raster file from ascii file and flattening Africa .... :)

Dear friends,

I am a kind of advanced newbie, if that makes sense.

I have a text file of the form

coordinate x,coordinate y,cat={real number between 250 and 450}

where coordinate are expressed in latitude and longitude. The files represents 
measurements of the size of a skulls on sites all over Africa.

>From it, I would like to build a raster file, 100 km by 100km.  There are 2 
problems:

1) Unfortunately,  in some 100km x 100km squares, there is one of the points 
whilst in others there are maybe 20. How do I average, so that in each square 
I only have 1 value representing the average?

2) How do we "flatten" Africa so that we may use 100km x 100km squares instead 
of 1 degree x 1 degree, without committing a geographical crime? What we need 
is to respect the areas ....

Best regards and apologies for the silliness of the questions.
--

-- 
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 <at> york.ac.uk
(Continue reading)

Kamran Safi | 3 Dec 11:26
Picon

Re: Raster file from ascii file and flattening Africa ....:)

Hi Corrado,

Being a advanced newbie myself, I first of all understand what you mean
by that and secondly ask you to qualify my answer.

I would, tackling your problem, create a raster polygon in a metric
equal area projection, such as Mollweide. Then you use overlay() and get
for each polygon the set of points that are within each raster polygon.
You need to import the xyz file in R and convert it into a Spatialpoints
data frame. 

Here's the first bit
This reads a coast line shapefile and extracts africa from it. Then uses
the boundings boxes to produce a grid at the extent of africa. Then it
projects that raster back to longlat for the overlay() procedure. 

map <- readShapePoly("E:/Science/continent.shp", ID="CONTINENT",
proj4string = CRS("+proj=longlat"))
africa <- as.SpatialPolygons.PolygonsList(map <at> polygons[1])
africa.proj <- spTransform(africa, CRS("+proj=moll"))
grd <- GridTopology(c(bbox(africa.proj)[1,1]+5000,
bbox(africa.proj)[2,1]+50000), c(100000,100000),
c(ceiling((bbox(africa.proj)[1,2] - bbox(africa.proj)[1,1]) /
100000),ceiling((bbox(africa.proj)[1,2] - bbox(africa.proj)[1,1]) /
100000)))

# if you should not have a coastline of africa:
# these are the values you'll need to produce the raster you need to
proceed
# bbox(africa.proj)
(Continue reading)

Jeffrey_Warren | 3 Dec 17:46
Favicon

Selecting levels from a list


I'm trying to select multiple levels from a list of factors but have not
been able to.  Here is the list:

 lesc.ddl$p$time
 [1] 0.75  0.833 1     1.75  1.833 2     2.75  2.833 3     3.75  3.833 4
0.833 1     1.75  1.833 2     2.75  2.833 3     3.75  3.833 4     1
1.75
[26] 1.833 2     2.75  2.833 3     3.75  3.833 4     1.75  1.833 2     2.75
2.833 3     3.75  3.833 4     1.833 2     2.75  2.833 3     3.75  3.833 4
[51] 2     2.75  2.833 3     3.75  3.833 4     2.75  2.833 3     3.75
3.833 4     2.833 3     3.75  3.833 4     3     3.75  3.833 4     3.75
3.833 4
[76] 3.833 4     4
Levels: 0.75 0.833 1 1.75 1.833 2 2.75 2.833 3 3.75 3.833 4

And the code I've tried so far:

lesc.ddl$p$time==0.75 | 1.75 | 2.75  #returns all 'TRUE' values

lesc.ddl$p$time==c(0.75 | 1.75 | 2.75)  #returns all 'FALSE' values

Any help would be greatly appreciated.

Cheers,

Jeff Warren
Wildlife Biologist
Red Rock Lakes NWR
Lima, Montana 59739
(Continue reading)

Owen Jones | 3 Dec 17:59
Picon

Re: Selecting levels from a list

Try the %in% notation which works like this:

> x<-as.factor(LETTERS[1:10])
> x
 [1] A B C D E F G H I J
Levels: A B C D E F G H I J
> x[x%in%c("C","J")]
[1] C J
Levels: A B C D E F G H I J

Cheers,
Owen

On Wed, Dec 3, 2008 at 4:46 PM, <Jeffrey_Warren@...> wrote:

>
> I'm trying to select multiple levels from a list of factors but have not
> been able to.  Here is the list:
>
>  lesc.ddl$p$time
>  [1] 0.75  0.833 1     1.75  1.833 2     2.75  2.833 3     3.75  3.833 4
> 0.833 1     1.75  1.833 2     2.75  2.833 3     3.75  3.833 4     1
> 1.75
> [26] 1.833 2     2.75  2.833 3     3.75  3.833 4     1.75  1.833 2     2.75
> 2.833 3     3.75  3.833 4     1.833 2     2.75  2.833 3     3.75  3.833 4
> [51] 2     2.75  2.833 3     3.75  3.833 4     2.75  2.833 3     3.75
> 3.833 4     2.833 3     3.75  3.833 4     3     3.75  3.833 4     3.75
> 3.833 4
> [76] 3.833 4     4
> Levels: 0.75 0.833 1 1.75 1.833 2 2.75 2.833 3 3.75 3.833 4
(Continue reading)

tyler | 3 Dec 19:13
Picon

Re: Selecting levels from a list

Jeffrey_Warren@... writes:

> I'm trying to select multiple levels from a list of factors but have not
> been able to.  Here is the list:
>
>
> And the code I've tried so far:
>
> lesc.ddl$p$time==0.75 | 1.75 | 2.75  #returns all 'TRUE' values
>
> lesc.ddl$p$time==c(0.75 | 1.75 | 2.75)  #returns all 'FALSE' values
>

Owen already gave you the solution. FYI, Your code didn't work because R
didn't see what you thought it saw.

  lesc.ddl$p$time==0.75 | 1.75 | 2.75

gets interpreted as 

  (lesc.ddl$p$time==0.75) | 1.75 | 2.75

The first part is true when time == 0.75. The second part, 1.75, is
always true (i.e., not zero or false), so the expression as a whole is
always true. Similarly,

  lesc.ddl$p$time==c(0.75 | 1.75 | 2.75)

gets interpreted as

(Continue reading)


Gmane