## Description

This function facilitates the creation of either a set of quadrature weights or weights based on a set of theta values for use in the function `plink `

## Usage

 ```1 2``` ```as.weight(n, theta, weight, quadrature = FALSE, normal.wt = FALSE, dimensions = 1, ...) ```

## Arguments

 `n` numeric value or vector identifying the number of theta values to use for each dimension. If only one value is supplied but `dimensions` is greater than one, `n` will be the same for all dimensions. `theta` vector or list of theta values. If `dimensions` is greater than one, list elements should correspond to each dimension, otherwise the single vector will be repeated for all dimensions. `weight` vector or list of weights. If `dimensions` is greater than one, list elements should correspond to each dimension, otherwise the single vector will be repeated for all dimensions. `quadrature` if `TRUE`, quadrature points and weights will be computed for the corresponding number of points `n` for each dimension respectively. See `gauss.quad.prob` for more information on creating quadrature points and weights. `normal.wt` if `TRUE` and `weight` is `missing`, the weights for `theta` will be computed to correspond to the densities from a normal distribution. `dimensions` number of dimensions for which the weights should be created `...` further arguments passed to other methods

## Details

When weighting expected response probabilities at different theta values using characteristic curve linking methods, there are a variety of approaches one can take. These range from uniform weights to normal weights, to quadrature weights corresponding to some a priori specified distribution. The purpose of this function is to facilitate the creation of these weights for use in `plink `.

For all approaches, when more than one dimension is specified, the weights for each combined set of theta values will be a multiplicative weight. For example, if there are two dimensions and the specified weights corresponding to two specific theta values on each dimension respectively are 0.8 and 1.2, the final weight for this pair of theta values will be 0.96.

Uniform Weights

Five general approaches can be used to create uniform weights.

• If no arguments are supplied, a set of weights (all equal to one) will be returned for a single dimension, for 40 equal interval theta values ranging from -4 to 4. If `dimensions` is greater than one, seven equal interval theta values ranging from -4 to 4 will be specified for each dimension. For instance, for two dimensions, there will be weights for 7 x 7 (49) points.

• If only a value for `n` is supplied, uniform weights (all equal to one) will be created for `n` points ranging from -4 to 4 for each dimension specified.

• If values are only specified for `theta`, uniform weights (all equal to one) will be created for each of these values for each dimension specified.

• If values are only specified for `weight` where the values are all equal. In this case, equal interval theta values will be selected from -4 to 4 to correspond to the number of specified weights.

• If values are specified for `theta` and uniform values are specified for `weight`.

Non-Uniform Weights

Four general approaches can be used to create non-uniform weights.

• If values are only specified for `weight` where the values are not equal. In this case, equal interval theta values will be selected from -4 to 4 to correspond to the number of specified weights.

• If values are specified for `theta` and varying values are specified for `weight`.

• If `quadrature` is equal to `TRUE`, and no other arguments are specified `n` will default to 40. if `dimensions` is greater than one, `n` will default to seven for each dimension. In either case `n` quadrature points and weights will be selected from a standard normal distribution. To change the mean and/or standard deviation of this distribution, values for `mu` and `sigma` respectively should be specified. See `gauss.quad.prob` for more information. Different means and/or SDs can be supplied for each dimension. If values are specified for `theta` or `weight`, the quadrature approach will not be used.

• If `quadrature` equals `TRUE` other distributions can be specified for `n` points. See `gauss.quad.prob` for more information.

• If `normal.wt` equals `TRUE`, normal densities will be created for the specified `theta` values (if supplied) or equal interval values. The default distribution will be standard normal, but different means and/or standard deviations can be specified by passing arguments for `mean` and `sd` respectively. Different means and/or SDs can be supplied for each dimension. If no values are included for `theta`, equal interval theta values will be created for the range of three SDs above and below the mean. If values are specified for `weight`, the `normal.wt` argument will be ignored.

## Value

Returns a list of length two. The first list element is an n x m matrix of theta values for m dimensions. The second list element is a vector of weights corresponding to the theta values in the first list element.

## Author(s)

Jonathan P. Weeks weeksjp@gmail.com

## References

Kolen, M. J., & Brennan, R. L. (2004) Test Equating, Scaling, and Linking. New York: Springer

`plink`, `gauss.quad.prob`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43``` ```###### Unidimensional Examples ###### # Create a set of 40 (default) theta values and uniform weights wt <- as.weight() # Create a set of 40 quadrature points and weights using a standard # normal distribution wt <- as.weight(quadrature=TRUE) # Create a set of 30 quadrature points and weights using a normal # distribution with a mean of 0.5 wt <- as.weight(n=30, quadrature=TRUE, mu=0.5) # Create weights for a set of random normal theta values wt <- as.weight(theta=rnorm(100)) # Create an object with equal interval theta values and standard # normal density weights wt <- as.weight(theta=seq(-4,4,0.05), normal.wt=TRUE) # Create an object with equal interval theta values and normal # density weights with a mean of 0.5 and SD equal to .92 wt <- as.weight(theta=seq(-4,4,0.05), normal.wt=TRUE, mean=0.5, sd=0.92) ###### Multidimensional Examples ###### # Create a set of 49 theta values and uniform weights # (based on seven points for each dimension) wt <- as.weight(dimensions=2) # Create a set of 100 quadrature points and weights using a normal # distribution with a means of 0 and 0.5 for the two dimensions respectively wt <- as.weight(n=10, quadrature=TRUE, mu=c(0,0.5), dimensions=2) # Create an object with equal interval theta values and standard # normal density weights for three dimensions wt <- as.weight(theta=seq(-3,3), normal.wt=TRUE, dimensions=3) # Create an object with two sets of equal interval theta values for # two dimensions wt <- as.weight(theta=list(seq(-4,4),seq(-3,3)), dimensions=2) # Create an object with two sets of random normal theta values and # standard normal density weights for two dimensions wt <- as.weight(theta=list(rnorm(10),rnorm(10)), normal.wt=TRUE, dimensions=2) ```