sumsmnw {lazy.irt} | R Documentation |
Distribution of the Weighted Sum of Several Independent Scored Multinomial Distributions
sumsmnw(P, V = NULL, w = rep(1, ncol(P)), ncat = NULL, compress = 0, print = 0, plot = 0, debug = 0)
P |
matrix of probabilities (max # of categories x # of r.v.) |
V |
matrix of domain values (max # of categories x # of r.v.) or NULL |
w |
vector of weights (1 x # of r.v.) |
ncat |
max # of categories (1 x # of r.v) or NULL |
compress |
= 1 to remove the zero probability categories |
print |
= 1 to print result |
plot |
= 1 to plot result |
debug |
= 1 to print intemediate result |
( V[,i], P[,i], w[i] ), i=1,2,...,n is the set of
( domain or category weight ,probability, and weight ) for the i-th r.v.
Non integer V and w will be first converted to integer by linear
transformation and converted back at the very end.
ncat[i] = max # of categories for the i-th r.v and
P[(ncat[i]+1):nrow(P),i] == NA
This program calculats the distrobution of
X = sum_{i=1}^n w[i] X_i
where
X_i is distributed as Scored Multinomial with (V[,i],P[,i])
,i=1,2,...,n
V[1,i] <= X_i <= V[ncat[i],i] or 0 <= X_i <= ncat[i]
That is, this program calculates the probability that
Pr( X = a ) ,
where
sum_{i=1}^n V[1,i]*w[i] <= a <= sum_{i=1}^n V[ncat[i],i]*w[i]
A matrix of (score, prob)
Mayekawa, S., & Arai, S. (2008). Distribution of the Sum of Scored Multinomial Random Variables and Its Application to the Item Response Theory. In K. Shigemasu, A. Okada, T.Imaizumi, & T. Hoshino (Eds.) New Trends in Psychometrics. Tokyo: University Academic Press.
# category x variable matrix of probability: colSums(P)=c(1,1,1...) P <- matrix(c(1,2,3,2, 1,2,1,0, 1,2,0,0), 4,3) P <- t(t(P)/colSums(P)) ncat <- c(4,3,2) # category x variable matrix of category weight V <- NULL # variable weight w <- c(.5,1,1) res <- sumsmnw( P, V, w, compress=0, print=1, plot=1, ncat=ncat ) # category x variable matrix of category weight V <- matrix(c(0,1,2,3, 1,2,3,0, 1,1,0,0), 4,3) # variable weight w <- c(.5,1,1) res <- sumsmnw( P, V, w, compress=0, print=1, plot=1, ncat=ncat )