Th Varanc-Covaranc Marx Our bggs a so-ar has bn ng a lnar uncon o a s o daa by mnmzng h las squars drncs rom h o h daa wh mnsarch. Whn analyzng non-lnar daa you hav o us a program l Malab as many yps o daa canno b lnarzd such ha Excl can analyz. Ths also mans ha you do no hav a drc rou o calculang h rror o your as you hav bn usng h rror calculad rom h lnar las squars rsul hs dosn wor on non-lnar daa!. ow you can ma on o wo assumpons- rror canno b calculad rom a non-lnar or rror can b calculad rom a non-lnar I jus don now how. Unlss you r a r@ *ћ *n moron you should pc. Hr s how! Th varanc-covaranc marx. I wll no covr h drvaon no ha I don undrsand I so oally do bu s svral pags o algbra long. I wll show you h ormula or h rror analyss and prov wors by applyng o a lnar s o daa. Thn w wll us or ohr problms Sp : dn a marx o paral drvavs. Ths s h only sm-hard par you hav o calcula h paral drvav o h uncon you ar ng your daa o or ach varabl ha you ar mnmzng n your las squars rmmbr mnsarch rom h prvous lsson?. L s say you ar ng daa o a uncon m whch has wo varabls ha wr my mnmzng h rror wh mnsarch call hm m and b. Th rs sp o calcula m and b s o drv h paral drvav marx: M= m b m m m b b b Whr s h paral drvav wh rspc o h varabl your ng m and m lws or wh varabl b. o ha h dagonal and lmns ar OT b qual o h scond drvav m bu ar n ac jus h rs drvav squard... Th o-dagonal lmns ar h paral drvavs mulpld by ach ohr. I m hs s conusng now w wll ma a lo mor clar wh an xampl on h nx pag. For now l m smply h marx M as: m b m m m b b
ow l m b oally hons hr: h marx M s acually a sum ovr all daa pons and s proprly xprssd as: m b m m b b ow bor hs gs conusng l s cmn vryhng wh a smpl xampl. Rmmbr h xampl o h lnar las squars Excl on h Handous scon? W ha daa hr: x y 0.9 4. 5.9 3 7.8 4 5. 6 4. Ths daa ar also savd on h wb as mydaa3.x. So l s sar wh a lnar ; rs w dn h paral drvavs o h uncon x = y = m x +b: = x. Don. x m no h marx: =. Don! Mony-Dony-Supr Don! L s pu hs b m b m m b b whch s now: x x x x
Smplyng gvs: x x x L s calcula ach lmn wh Malab o show you how smpl hs ormulas ar: To dn h -by- marx abov calld m: >> load mydaa3.x; >> m=0; or =:7 m=m+mydaa3^; nd; >> m=0; or =:7 m=m+mydaa3; nd; >> m=0; or =:7 m=m+mydaa3; nd; >> m=0; or =:7 m=m+; nd; >> m m = 9 7 YOU RE OW DOE WITH THE HRD PRT!! Sp - Ths marx mus b nvrd. ow wha dos man o nvr a marx? For a marx M h nvrs o h marx calld M - has h propry such ha M M - =. o qu h numbr bu a marx wh h sam numbr o lmns as M ach dagonal lmn bng h numbr ohrs ar 0. So n hs xampl: a c b d Th nvrs s s hp://mahworld.wolram.com/marxinvrs.hml or mor no: d - b ad bc ad bc - c ad bc a ad bc Mulply h marx wh s nvrs usng h ruls o marx algbra and you g: 0 0
Hr s h gra hng- don worry abou any o hs- Malab dos vryhng or you! >> m_nv=nvm m_nv = 0.0357-0.07-0.07 0.4643 Ls doubl chc : >> m_nv*m ans = 0 0 S onc you s up h M marx and s nvrs you don hav o do anyhng ls! YY! YY MTLB!! Sp 3- Ls rs al abou h daa w ar ng: w wll dn as h numbr o daa pons o and ls call h acual daa w wsh o y. In our cas hr ar varabls o h uncon w ar ng h daa o m and so l s dn p as hs quany p=. For sp hr w hav o now somhng abou h dvaon o h daa rom h ; ha obvously mus play a par n h rrors o m and b. To do hs par dn s y as: s y = y p. lmos don! Dn h bs rom mnsarch or h ln whch ar h sam paramrs o my Excl spradsh oddly nough: >> or =:7 =.06074*mydaa3+.975; nd; x sp: >> sy=0; >> p=7-; >> or =:7 sy=sy+mydaa3-^/p; nd; >>sy sy = 0.748 >> varcovar=m_nv*sy varcovar = 0.006-0.087-0.087 0.08
Ths s! Th Varanc-Covaranc Marx!! cually hs s nda l larnng ha h ulma answr o h ulma quson n h unvrs s h numbr 4. You hav o ully undrsand h quson o ruly g h answr. Th varanc-covaranc s acually qual o: m b b m b m So you wan o now h rror o h slop you yp: >> sqrvarcovar ans = 0.0790 Lws or h nrcp: >>sqrvarcovar ans = 0.849 Rmmr h rsul rom h Excl spradsh? Th lnar las squars rsul was: slop =.0607 ± 0.0790 nrcp:.975 ± 0.85. Loos l h varanc-covaranc marx wors! Las b l s loo bac a h varanc-covaranc marx: >> varcovar varcovar = 0.006-0.087-0.087 0.08 How dd w now ha h squar roo o h lmn uppr l handd s h rror n h slop? Easy ha was dnd whn you oo h drvav o h quaon or a ln wh rspc o h slop as: lws or h nrcp. m ow wha do h o-dagonal lmns m b and b m man? Frs h o-dagonal lmns ar h covarancs. Th covaranc lmns ll you ha your calculad slop s oo low hn your calculad nrcp oo hgh as n hs cas h covarancs ar ngav.. I hy ar posv hn an undrsma n h slop mans ha your nrcp s also undrsmad.. hy ar gong-oghr. larg o-dagonal lmn mans ha hr s a lo o cross-al bwn h m and b varabls. Idally h covarancs ar 0 manng ha you mad a bad o h nrcp dd nohng o your sma o h slop. Thus h varabls ar ndpndn. Ths s unorunaly rarly h cas wh ral daa.
Hr s h mos mporan par- sarng rom h bgnnng who h hc sz you hav o wor wh lnar s? YOU OW C CLULCTE THE ERROR OF Y FUCTIO YOU CHOOSE S THE BEST TO FIT YOUR DT nohr xampl an xponnal dcay. n xponnal dcay s dscrbd by h quaon whr s h amplud s m and s h dcay consan. L s gur ou how o ma a varanc-covaranc marx rom hs quaon. ong ha w ar only ng wo varabls and sarng rom h bgnnng: M = ow ls ll n h ndvdual pcs: and. ow ls plug hs no h marx and w g M= Ths can b smpld as: ow you wll nsh h rs or your nx assgnmn.