# cvp: Class 'cvps' In nspmix: Nonparametric and Semiparametric Mixture Estimation

## Description

These functions can be used to study a common variance problem (CVP), where univariate observations fall in known groups. Observations in each group are assumed to have the same mean, but different groups may have different means. All observations are assumed to have a common variance, despite their different means, hence giving the name of the problem. It is a random-effects problem.

Class `cvps` is used to store the CVP data in a summarized form.

Function `cvps` creates an object of class `cvps`, given a matrix that stores the values (column 2) and their grouping information (column 1).

Function `rcvp` generates a random sample in the raw form for a common variance problem, where the means follow a discrete distribution.

Function `rcvps` generates a random sample in the summarized form for a common variance problem, where the means follow a discrete distribution.

Function `print.cvps` prints the CVP data given in the summarized form.

## Usage

 ```1 2 3 4 5``` ```cvps(x) rcvp(k, ni=2, mu=0, pr=1, sd=1) rcvps(k, ni=2, mu=0, pr=1, sd=1) ## S3 method for class 'cvps' print(x, ...) ```

## Arguments

 `x` CVP data in the raw form as an argument in `cvps`, or an object of class `cvps` in `print.cvps`. `k` the number of groups. `ni` a numeric vector that gives the sample size in each group. `mu` a numeric vector for all the theoretical means. `pr` a numeric vector for all the probabilities associated with the theoretical means. `sd` a scalar for the standard deviation that is common to all observations. `...` arguments passed on to function `print`.

## Details

The raw form of the CVP data is a two-column matrix, where each row represents an observation. The two columns along each row give, respectively, the group membership (`group`) and the value (`x`) of an observation.

The summarized form of the CVP data is a four-column matrix, where each row represents the summarized data for all observations in a group. The four columns along each row give, respectively, the group number (`group`), the number of observations in the group (`ni`), the sample mean of the observations in the group (`mi`), and the residual sum of squares of the observations in the group (`ri`).

## Author(s)

Yong Wang <[email protected]>

## References

Neyman, J. and Scott, E. L. (1948). Consistent estimates based on partially consistent observations. Econometrica, 16, 1-32.

Kiefer, J. and Wolfowitz, J. (1956). Consistency of the maximum likelihood estimator in the presence of infinitely many incidental parameters. Ann. Math. Stat., 27, 886-906.

Wang, Y. (2010). Maximum likelihood computation for fitting semiparametric mixture models. Statistics and Computing, 20, 75-86.

`nnls`, `cnmms`.
 ```1 2 3``` ```mix = disc(pt=c(0,4), pr=c(0.3,0.7)) x = rcvp(100, ni=3:10, mu=mix\$pt, pr=mix\$pr, sd=1) cnmms(cvps(x)) ```