
group
to
model the probability of two samples being analogues conditional upon
the dissimilarity between the two samples.logitreg(object, groups, k = 1, ...)## S3 method for class 'default':
logitreg(object, groups, k = 1, ...)
## S3 method for class 'analog':
logitreg(object, groups, k = 1, ...)
## S3 method for class 'logitreg':
summary(object, p = 0.9, ...)
logitreg
; a full dissimilarity matrix. For
summary.logitreg
an object of class "logitreg"
, the
result of a call to logitreg
.object
.k
closest analogues to use in the model
fitting.logitreg
returns an object of class "logitreg"
; a list
whose components are objects returned by glm
. See
glm
for further details on the returned objects. The components of this list take their names from group
.
For summary.logitreg
an object of class
"summary.logitreg"
, a data frame with summary statistics of the
model fits. The components of this data frame are:
dose.p
.group
to
model the probability of two samples being analogues (i.e. in the same
group) conditional upon the dissimilarity between the two samples. This function can be seen as a way of directly modelling the
probability that two sites are analogues, conditional upon
dissimilarity, that can also be done less directly using
roc
and bayesF
.
roc
, bayesF
, glm
.## load the example data
data(swapdiat, swappH, rlgh)
## merge training and test set on columns
dat <- join(swapdiat, rlgh, verbose = TRUE)
## extract the merged data sets and convert to proportions
swapdiat <- dat[[1]] / 100
rlgh <- dat[[2]] / 100
## fit an analogue matching (AM) model using the squared chord distance
## measure - need to keep the training set dissimilarities
swap.ana <- analog(swapdiat, rlgh, method = "SQchord",
keep.train = TRUE)
## fit the ROC curve to the SWAP diatom data using the AM results
## Generate a grouping for the SWAP lakes
clust <- hclust(as.dist(swap.ana$train), method = "ward")
grps <- cutree(clust, 6)
## fit the logit models to the analog object
swap.lrm <- logitreg(swap.ana, grps)
swap.lrm
## summary statistics
summary(swap.lrm)
## plot the fitted logit curves
plot(swap.lrm, conf.type = "polygon")
## extract fitted posterior probabilities for training samples
## for the individual groups
fit <- fitted(swap.lrm)
head(fit)
## compute posterior probabilities of analogue-ness for the rlgh
## samples. Here we take the dissimilarities between fossil and
## training samples from the `swap.ana` object rather than re-
## compute them
pred <- predict(swap.lrm, newdata = swap.ana$analogs)
head(pred)
Run the code above in your browser using DataLab