Re: Standard deviations and Confidence intervals with respect to
- To: mathgroup at smc.vnet.net
- Subject: [mg101844] Re: Standard deviations and Confidence intervals with respect to
- From: Ray Koopman <koopman at sfu.ca>
- Date: Sun, 19 Jul 2009 07:14:36 -0400 (EDT)
- References: <h3n5sr$2ed$1@smc.vnet.net> <h3pes0$oha$1@smc.vnet.net>
On Jul 18, 4:59 am, Alexey <lehi... at gmail.com> wrote: > On Jul 17, 13:05, Ray Koopman <koop... at sfu.ca> wrote: > >> See the thread "linear regression with errors in both variables", >> that ran Feb 10-16, 2009: >> http://groups.google.ca/group/comp.soft-sys.math.mathematica/msg/4058d9702aa71824 > > Thank you. It looks like that I need. But the formulae for Standard > deviations and Confidence intervals of paramaters {a,b} are not > presented there. And what assumptions underlie that method? The model is x_i = z_i + xs*ex_i, y_i = alpha + beta*z_i + sy*ey_i, where ex_i and ey_i are assumed to be independent standard normal. (Those assumptions are sufficient, but may be stronger than is strictly necessary.) Also, note that nothing is assumed about z. For making confidence statements about alpha and beta, I would jackknife the estimate (ab) produced by worals. Here is a new version of worals, that accepts an optional initial ab. worals[x_,y_,sx_,sy_,ab_:{}] := Block[ {a,b,f,z, u = 1/sx, v = 1/sy, w = (sy/sx)^2}, {a,b} = If[ab == {}, (y*v).PseudoInverse@{v,x*v}, ab]; f = #.#&[(a+b*x-y)v]; While[f > (z = (x*w + (y-a)b)/(b^2 + w); {a,b} = (y*v).PseudoInverse@{v,z*v}; f = #.#&@Join[(z-x)u,(a+b*z-y)v])]; {f,{a,b}}] In the following code, jab is the jackknifed ab, and jc is the corresponding estimate of the covariance matrix: n = Length@x; {f,ab} = worals[x,y,sx,sy]; {jab,jc} = {ab+(n-1)(ab-Mean@#),(n-1)^2/n CovarianceMatrix@#}& @ Table[Last@worals[Sequence@@(Delete[#,i]&/@{x,y,dx,dy}),ab],{i,n}] The standard errors are the square roots of the diagonals of jc. For confidence intervals for alpha and beta separately, use the t distribution in the usual way, with df = n-1. For a confidence region for alpha and beta jointly, use the F distribution. This seems to be less well known, so I'll give it here: the 100p% confidence region for {alpha,beta} is ({alpha,beta}-jab).Inverse[jc].({alpha,beta}-jab) < Quantile[FRatioDistribution[2,n-2],p]*2(n-1)/(n(n-2)).