sdMean: Estimates for standard deviations and CI for weighted means...

Description Usage Arguments Details Value See Also Examples

Description

sdMean calculates estimates of standard deviatitions and confidence intervals for weighted means with minimax weights by observations from the mixture with varying concentrations.

Usage

1
2
sdMean(x, p, comp = 1:ncol(p), means = FALSE, CI = FALSE,
  alpha = 0.05)

Arguments

x

numeric vector with the observed sample or a wtsamp object.

p

matrix (or data frame) of mixing probabilities with rows corresponding to subjects and columns coresponding to the mixture components.

comp

a numeric vector with numbers of components for which the standard deviations are estimated.

means

logical, if TRUE then the estimates for components' means are included in the function value.

CI

logical, if TRUE then confidence bounds for components' means are inculded in the function value.

alpha

confidense level for the confidence interval.

Details

If CI=TRUE then the function calculates confidence intervals for the components' means with covering probability 1-alpha.

If x is a vector then the weights for components' means and variances are calculated as lsweight(p). If x is a wtsamp object than its own weights are used.

Value

if CI & means =FALSE the function returns a vector of the estimated standard deviations with NA for the components which were not estimated. Else a data frame is returned in which there can be variables: sd are standard deviations of estimates; means are the estimates of means; lower and upper are lower and upper bounds of the confidence intervals for means.

See Also

Maiboroda R. and Kubaichuk O. Asymptotic normality of improved weighted empirical distribution functions. Theor. Probability and Math. Statist. 69 (2004), 95-102

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(3)
M<-3 # number of mixture components
p <- genunifp(1000,M) # create mixing probabilities
m<-c(0,1,2)      # true means of components
sd<-c(1,1,0.5)   # true sd of components
x<-genormixt(p,m,sd) # sample generation
# Calculate sd only:
sdMean(x,p)
# the same:
sdMean(wtsamp(x,indiv=lsweight(p)),p)
# Calculate confidence intervals:
sdMean(x,p,means=TRUE,CI=TRUE)
# Plot confidence intervals:
CI<-sdMean(x,p,means=TRUE,CI=TRUE)
library(plotrix)
plotCI(1:M,CI$means,ui=CI$upper,li=CI$lower,
       xlab=" ",ylab="means",xaxt="n")
axis(1,at=1:M,labels=row.names(CI))

RostyslavMaiboroda/mixvconc documentation built on June 12, 2019, 12:34 a.m.