.- help for ^optfixn^ (STB-58: sxd2) .- Optimal sampling design for 2-stage study with fixed second stage sample size ------------------------------------------------------------------------- ^optfixn^ depvar [indepvars] [^if^ exp] [^in^ range] [^, first(^varlist^)^ ^n1(^vecname^)^ ^n2(^#^)^ ^var(^#^)^ ^coding(^#^)^ Options ------- ^first(^varlist^)^ specifies the first stage variables. ^n1(^vecname^)^ specifies the vector of first stage sample sizes for each stratum formed by different levels of dependent variable and first stage covariates. (See Description below for how to enter this vector.) ^n2(^#^)^ specifies the second stage sample sizes. ^var(^#^)^ specifies the position in the logistic regression model of the covariate whose variance is to be minimized (i.e. optimized). For example, in the simple model Y = b0 + b1X1 + b2X2, if we want to minimize the variance of X1, then ^var^ = 2. ^coding(^#^)^ is a logical flag; the default of 0 (FALSE) means that prior to calling the ^optfixn^ function, you have run the ^coding^ function (help @coding@ for details) to create the vector ^grp_yz^, which contains the distinct groups (strata) formed by the different levels of response (Y) and first stage covariates (Z). If you have not run ^coding^ and you call the ^optfixn^ function with ^coding=1^, the ^grp_yz^ vector will be created within the ^optfixn^ function, but it is imperative that the vector vecname is provided to ^optfixn^ in the correct order! For this reason, we strongly suggest that any call to ^optfixn^ is preceded by a call to ^coding^. Description ------------ The ^optfixn^ function calculates the optimal sampling fraction in each of the strata at the second stage, for situations where first stage data is available and the total number of second-stage observations has been decided. Before running the ^optfixn^ function you should run the ^coding^ function, (see help @coding@), to see the order in which you must supply the vector of first stage sample sizes in the various strata. Examples -------- As an illustration, we provide the pilot data described in Table 1 of Reilly (Am. J. Epi, 143, 92-100, 1996), and the following commands produce the sampling fractions of Table 3 in that paper. . ^use pilotcas^ . ^coding mort sex^ . ^matrix fstsamp=(6666, 1228, 144, 58)'^ . ^optfixn mort sex age,first(sex) n1(fstsamp) n2(1000) var(3)^ The ^coding^ command identifies the strata formed by levels of the dependent variable (mort) and first stage covariate (sex), and the matrix "fstsamp" contains the first stage sample sizes in the correct order. Author ------ Marie Reilly, Dept. of Epidemiology & Public Health and Agus Salim, Dept. of Statistics, University College Cork, Cork, Ireland marie.reilly@@ucc.ie Also see -------- STB: STB-58: sxd2 Manual: [R] logit, glm On-line: help for @logit@, @glm@, @coding@, @optbud@, @optprec@