The main purpose of this function is to draw categories using scores and profiles by their gravity center. Confidence intervals of the average position (issued from a multinomial distribution) can be superimposed.
s.multinom(dfxy, dfrowprof, translate = FALSE, xax = 1, yax = 2,
labelcat = row.names(dfxy), clabelcat = 1, cpointcat = if (clabelcat == 0) 2 else 0,
labelrowprof = row.names(dfrowprof), clabelrowprof = 0.75,
cpointrowprof = if (clabelrowprof == 0) 2 else 0, pchrowprof = 20,
coulrowprof = grey(0.8), proba = 0.95, n.sample = apply(dfrowprof, 1, sum),
axesell = TRUE, ...)
dfxy
is a data frame containing at least two numerical variables.
The rows of dfxy
are categories such as 1,2 and 3 in the triangular plot.
dfrowprof
is a data frame whose the columns are the rows of dfxy
.
The rows of dfxy
are profiles or frequency distributions on the categories.
The column number of dfrowprof
must be equal to the row number of dfxy
.
row.names(dfxy)
and names(dfrowprof)
must be identical.
a logical value indicating whether the plot should be translated(TRUE) or not. The origin becomes the gravity center weighted by profiles.
the column number of dfxy
for the x-axis
the column number of dfxy
for the y-axis
a vector of strings of characters for the labels of categories
an integer specifying the character size for the labels of categories,
used with par("cex")*clabelcat
an integer specifying the character size for the points showing the categories,
used with par("cex")*cpointcat
a vector of strings of characters for the labels of profiles (rows of dfrowprof
)
an integer specifying the character size for the labels of profiles used with par("cex")*clabelrowprof
an integer specifying the character size for the points representative of the profiles used with par("cex")*cpointrowprof
either an integer specifying a symbol or a single character to be used for the profile labels
a vector of colors used for ellipses, possibly recycled
a value lying between 0.500 and 0.999 to draw a confidence interval
a vector containing the sample size, possibly recycled. Used n.sample = 0
if the profiles
are not issued from a multinomial distribution and that confidence intervals have no sense.
a logical value indicating whether the ellipse axes should be drawn
further arguments passed from the s.label
for the initial scatter plot.
Returns in a hidden way a list of three components :
a vector with two values giving the done original translation.
a matrix, with 5 columns and for rows the number of profiles, giving the means,
the variances and the covariance of the profile for the used
numerical codes (column of dfxy
)
the matched call
# NOT RUN {
par(mfrow = c(2,2))
par(mar = c(0.1,0.1,0.1,0.1))
proba <- matrix(c(0.49,0.47,0.04,0.4,0.3,0.3,0.05,0.05,0.9,0.05,0.7,0.25), ncol = 3, byrow = TRUE)
proba.df <- as.data.frame (proba)
names(proba.df) <- c("A","B","C") ; row.names(proba.df) <- c("P1","P2","P3","P4")
w.proba <- triangle.plot(proba.df, clab = 2, show = FALSE)
box()
w.tri = data.frame(x = c(-sqrt(1/2),sqrt(1/2),0), y = c(-1/sqrt(6),-1/sqrt(6),2/sqrt(6)))
L3 <- c("A","B","C")
row.names(w.tri) <- L3
s.multinom(w.tri, proba.df, n.sample = 0, coulrowprof = "black", clabelrowprof = 1.5)
s.multinom(w.tri, proba.df, n.sample = 30, coul = palette()[5])
s.multinom(w.tri, proba.df, n.sample = 60, coul = palette()[6], add.p = TRUE)
s.multinom(w.tri, proba.df, n.sample = 120, coul = grey(0.8), add.p = TRUE)
print(s.multinom(w.tri, proba.df[-3,], n.sample = 0, translate = TRUE)$tra)
# }
Run the code above in your browser using DataLab