typprob | R Documentation |
calculate typicality probabilities
typprob(
x,
data,
small = FALSE,
method = c("chisquare", "wilson"),
center = NULL,
cova = NULL,
robust = c("classical", "mve", "mcd"),
...
)
typprobClass(
x,
data,
groups,
small = FALSE,
method = c("chisquare", "wilson"),
outlier = 0.01,
sep = FALSE,
cv = TRUE,
robust = c("classical", "mve", "mcd"),
...
)
x |
vector or matrix of data the probability is to be calculated. |
data |
Reference data set. If missing x will be used. |
small |
adjustion of Mahalanobis D^2 for small sample sizes as suggested by Wilson (1981), only takes effect when method="wilson". |
method |
select method for probability estimation. Available options are "chisquare" (or any abbreviation) or "wilson". "chisquare" exploits simply the chisquare distribution of the mahalanobisdistance, while "wilson" uses the methods suggested by Wilson(1981). Results will be similar in general. |
center |
vector: specify custom vector to calculate distance to. If not defined, group mean will be used. |
cova |
covariance matrix to calculate mahalanobis-distance: specify custom covariance matrix to calculate distance. |
robust |
character: determines covariance estimation methods, allowing for robust estimations using |
... |
additional parameters passed to |
groups |
vector containing grouping information. |
outlier |
probability threshold below which a specimen will not be assigned to any group- |
sep |
logical: if TRUE, probability will be calculated from the pooled within group covariance matrix. |
cv |
logical: if data is missing and |
get the probability for an observation belonging to a given multivariate nromal distribution
typprob: returns a vector of probabilities.
typprobClass:
probs |
matrix of probabilities for each group |
groupaffin |
vector of groups each specimen has been assigned to. Outliers are classified "none" |
probsCV |
cross-validated matrix of probabilities for each group |
groupaffinCV |
cross-validated vector of groups each specimen has been assigned to. Outliers are classified "none" |
self |
logical: if TRUE, the data has been classified by self-inference. |
Stefan Schlager
Albrecht G. 1992. Assessing the affinities of fossils using canonical variates and generalized distances Human Evolution 7:49-69.
Wilson S. 1981. On comparing fossil specimens with population samples Journal of Human Evolution 10:207 - 214.
if (require(shapes)) {
data <- procSym(gorf.dat)$PCscores[,1:3]
probas <- typprob(data,data,small=TRUE)### get probability for each specimen
### now we check how this behaves compared to the mahalanobis distance
maha <- mahalanobis(data,colMeans(data),cov(data))
plot(probas,maha,xlab="Probability",ylab="Mahalanobis D^2")
data2 <- procSym(abind(gorf.dat,gorm.dat))$PCscores[,1:3]
fac <- as.factor(c(rep("female",dim(gorf.dat)[3]),rep("male",dim(gorm.dat)[3])))
typClass <- typprobClass(data2,groups=fac,method="w",small=TRUE,cv=TRUE)
## only 59 specimen is rather small.
typClass2 <- typprobClass(data2,groups=fac,method="c",cv=TRUE)## use default settings
### check results for first method:
typClass
### check results for second method:
typClass2
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.