help mata mm_jk()-------------------------------------------------------------------------------

Title

mm_jk() -- Jackknife estimation

Syntax

jk=mm_jk(f,X[,w,nodots,strata,cluster,subpop,fpcvar,stat,...])where

f:pointer scalarcontaining address of function to be bootstrapped, i.e.f=&functionname()X:real matrixcontaining data (rows are observations, columns variables)w:real colvectorcontaining weightsnodots:real scalarindicating that replication dots be suppressedstrata:real colvectorcontaining (ordered) strata ID variablecluster:real colvectorcontaining (ordered) cluster ID variablesubpop:real colvectorcontaining subpopulation identifierfpcvar:real colvectorcontaining sampling fractions for finite population correctionstat:real rowvectorcontaining the results offusing the original data, i.e., the "observed" value off...: up to 10 optional arguments to pass through tof

real matrixmm_jk_report(jk[,what,level,mse,fpc])where

what:string vectorcontaining statistics to be reported, where the available statistics are:"b"or"theta"("observed" value),"pseudo"(jackknife pseudovalues),"mean"(jackknife mean),"bias"(jackknife mean - observed value),"v"(variance-covariance matrix),"se"(standard error; the default),"ci"(confidence interval)level:real scalarcontaining the confidence level for confidence intervals (default is 95 or as set byset level)mse:real scalarindicating that the mean squared errors formula be usedfpc:real vectorcontaining sampling fractions for finite population correction

jkis a variable used for communication betweenmm_jk()andmm_jk_report(). If you declarejk, declare it to betransmorphic.

Description

mm_jk(f,X,w)computes the jackknife (leave-one-out) replicates of functionfapplied to the dataX(and weightsw; omitw, or specifywas 1 to obtain unweighted results) and returns the results as a structure. To be precise,fis a pointer to a function, i.e.f=&functionname(), e.g.f=&mean()(see[M-2] ftof).mm_jk()expects functionfto return areal rowvectorof parameter estimates to be jackknifed. Furthermore, functionfmust take the data as the first argument and weights as the second argument. Note thatmm_jk()leaves out observations by setting their weights to zero. Make sure that functionfproperly handles these observations. The results fromfshould be the same as if the observation would have been deleted.

nodots!=0 indicates that replication dots be suppressed. By default, a single dot character is displayed for each successful replication and a single red 'x' is displayed for each unsuccessful replication. A replication is considered unsuccessful if the replication result contains one or more missing values.mm_jk()only returns results from successful replications.

strataandclustermay be used to specify a strata ID variable and a cluster ID variable.mm_jk()will then produce jackknife results for stratified and clustered data. Note thatmm_jk()does not sort the data: A new stratum begins each timestratachanges from one row to the next, a new cluster begins each timecluster(orstrata) changes from one row to the next. Omitstrataor specifystrata=. if the sample is unstratified; omitclusteror specifycluster=. if the sample does not contain clusters.

subpopspecifies that estimates be computed for the subpopulation for whichsubpop!=0. Providing only the data for whichsubpop!=0 and omittingsubpopproduces different results than providing all data and specifyingsubpop. See[SVY] subpopulation estimationfor information. Omitsubpopor specifysubpop=. if the estimates be based on all observations.

fpcvarprovides sampling fractions to be stored with the jackknife replicates. The stored sampling rates are then used bymm_jk_report()for finite population correction of variance estimates. Note thatfpcvarshould contain the same number of rows asxand is assumed to be constant within each stratum. You may specifyfpcvar=. to set the sampling fractions to zero (and, therefore, omit finite population correction).By default,

mm_jk()first appliesfto the original data to obtain the "observed" value offgivenXandw. Alternatively, the "observed" value may be provided asstat, wherestatis areal rowvectorof point estimates. Omitstator specifystat=. if you do not want to provide the "observed" value.

mm_jk_report()is used to analyze the jackknife replicates computed bymm_jk(). It returns a matrix of statistics such as jackknife means, jackknife standard errors, or jackknife confidence intervals (see thewhatargument above). Multiple statistics are arranged beneath one another in the specified order. For example,mm_jk_report(jk,("b","se","ci"))will return the observed values in the first row, the standard errors in the second row, and the lower and upper bounds of the confidence intervals in the third and forth row.

levelspecifies the confidence level, as a percentage, for confidence intervals. The default islevel=95 or as set byset level.

mse!=0 indicates that variances and standard errors be computed using deviations of the replicates from the "observed" value. By default, variances and standard errors are computed using deviations of the pseudovalues from their mean.

fpcmay be used to provide sampling fractions for finite population correction of variance estimates. The length offpcshould equal the number of strata.fpccan be omitted iffpcvarwas provided tomm_jk().

RemarksThe following example illustrates the basic usage of

mm_jk()andmm_jk_report():: x = uniform(75,2) : J = mm_jk(&mean(), x, 1) Jackknife replications (75) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 .................................................. 50 .........................

: mm_jk_report(J, ("b", "se")) 1 2 +-----------------------------+ 1 | .4512322009 .4951004972 | 2 | .032499494 .0333034185 | +-----------------------------+

: mm_jk_report(J, "ci") 1 2 +-----------------------------+ 1 | .3864755455 .4287419872 | 2 | .5159888562 .5614590071 | +-----------------------------+

mm_jk()first produces the 75 jackknife leave-one-out estimates of the means of the two variables contained inx.mm_jk_report()then reports the "observed" values, i.e. the means of the two variables inx(first row) and the jackknife standard errors of the means (second row). The second call ofmm_jk_report()displays the 95% jackknife confidence intervals for the two means (lower bound in first row, upper bound in second row).Methods and formulas are as described in

[R] jackknifeand[SVY] varianceestimation. Delete-kjackknife is not supported.

Conformability

mm_jk(f,X,w,nodots,strata,cluster,subpop,fpcvar,stat,...):f: 1x1X:n x kw:n x1 or 1x1nodots: 1x1strata:n x1 orstrata=.cluster:n x1 orcluster=.subpop:n x1 orsubpop=.fpcvar:n x1 orfpcvar=.stat:1 x por2 x porstat=....: (depending onf)result:struct mm_jkstats

(*f)(X,w,...):X:n x kw:n x1 or 1x1...: (depending onf)result:1 x por2 x p

mm_jk_report(jk,what,level,mse,fpc):bs:struct mm_jkstatswhat:s x1 or 1x slevel: 1x1mse: 1x1fpc:m x1 orfpc=. (m: n. of strata)result:r x p

DiagnosticsNone.

Source codemm_jk.mata

AuthorBen Jann, ETH Zurich, jann@soz.gess.ethz.ch

Also seeOnline: help for

jackknife,svy jackknife,mm_bs(),moremata