[R] Struggeling with svydesign()

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Wed Apr 7 15:29:26 CEST 2010


Dear all,

We are analysing some survey data and we are not sure if we are using
the correct syntax for our design.

The population of interest is a set of 4416 polygons with different
sizes ranging from 0.003 to 45.6 ha, 7460 ha in total. Each polygon has
a binary attribute (presence/absence) and we want to estimate the
probability of presence in the population.

We used sampling with replacement weighted by the area of the polygon.
The population was stratified using 2 variables: block and type. Each of
the 14 blocks is a 20 by 50 km geographical region. Type is a two level
factor. Not every level is present in each block. Each block has a
Status attribute with two levels: medium (9 blocks) or good (5 blocks).
Besides the overall ratio, we would like the estimate the ratio per
Status.
The samplesize per stratum was calculated with epi.stratasize() from the
epiR package. The population size in the 21 strata ranges from 1 to
1158. The sample size ranges from 0 in the blocks with very few polygons
(<20), 1 in blocks with a low number of polygon (20 - 50) and up to 25
polygons in the largest strata.

Does the syntax below represents the data structure above? Any comments
are welcome.

library(survey)
svydesign(
	id = ~ 1, #no clustering
	weights = ~ Area, #weighted by the area of the polygon
	strata = ~ Status + Block + Type,
	nest = TRUE
)
# Is Area a correct weighting factor? Or should we use the area divided
by the sum of the total area (per stratum?)
# The code above runs. But when we omit "Status" from the strata, then
we get an error: "a stratum has only 1 PSU". Shouldn't we get the same
error with the code above?

#with finity population correction
svydesign(
	id = ~ 1, #no clustering
	weights = ~ Area, #weighted by the area of the polygon
	strata = ~ Status + Block + Type,
	fpc ~ nStatus + nBlock + nType,
	nest = TRUE
)
#We are not sure what to use for nStatus, nBlock and nType. Is it the
number of levels of that stratum (nStatus = 2)? The number of levels in
the stratum below (nStatus = length(unique(Block)) per level of Status,
nType = number of polygons per Status:Block:Type)? The total number of
polygons in that stratum?

Best regards,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey


Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.



More information about the R-help mailing list