Page 1 of 1

[SOLVED] Setting "w" in db for plot and calculations

PostPosted: Wed Mar 09, 2016 10:55 pm
by bethyp
Dear RGeoS Developers and Users,

I'm creating a db and setting a field to "w" to use as weighting for calculating CG, I and GIC. I set the field to "w" using the code:

anch.db <- db.locate(anch.db,12,"w")

When I check, field 12 (CPUE) is indeed weighted (listed with "w" for Locator). However, when I go to plot the data, using simply:

plot(anch.db)

The point sizes are not weighted by CPUE (they are all the same size and small). I can't figure out why the "w" isn't being used in the plot call (it worked for a previous plot with identical settings).

Is there 1) a way to manually weight the size of the points by "w" (e.g., "cex") for a db? or 2) a step that I am missing to ensure the weights are being incorporated in calculations?

The plots were really just a check for me, but now I am concerned that the weighted variable isn't being used when calculating CG either.

I attached the plots for your reference.

Thanks in advance,

Elizabeth

Anch_w.jpeg
Anch_w.jpeg (23.96 KiB) Viewed 6861 times
Anch_nw.jpeg
Anch_nw.jpeg (23.12 KiB) Viewed 6861 times

Re: Setting "w" in db for plot and calculations

PostPosted: Mon Mar 28, 2016 8:48 pm
by Didier Renard
Hello

My first answer if that indeed the weight (when defined as a "w" locator for a given attribute) is considered as a weight taken into account for the calculations of all spatial indices.

My second answer is that NO, the weight ("w" locator) is NOT used during the plot. The standard plot function is using the target variable (locator "z") to provide a proportional display. It would be confusing to add the contribution of a second variable.

Moreover, when using the plot facility, the display by default represents the target variable in proportional representation. However, the user can modify the represented variable by using the 'name' argument.

Let me illustrate this by a pseudo-example:

Let us imagine that we have a db (called 'mydb') with the following attributes:
1: Sample rank (locator rank)
2: Coordinate along X (locator x1)
3: Coordinate along Y (locator x2)
4: Variable ... say "length" (locator z1)
5: Variable weight (locator W)

When using plot(mydb), the display represents variable "length" with proportional symbols
When using plot(mydb,name=5), the display represents the variable "weight".

Hope this will help.

Re: [SOLVED] Setting "w" in db for plot and calculations

PostPosted: Tue Dec 13, 2016 10:09 pm
by bethyp
Apologies for my delayed response.

This was very helpful, and reassuring!

Thanks,
Elizabeth