1 Star 1 Fork 2

连享会/lassopack

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cs_cvlasso.smcl 182.57 KB
一键复制 编辑 原始数据 按行查看 历史
kahrens 提交于 2020-12-12 18:50 . new version: 1.4.1
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678
{smcl}
{com}{sf}{ul off}{txt}{.-}
name: {res}<unnamed>
{txt}log: {res}C:\Users\ecomes\Documents\GitHub\lassopack\lassopack_v141incomplete\cs_cvlasso.smcl
{txt}log type: {res}smcl
{txt}opened on: {res}27 Sep 2020, 20:21:45
{txt}r; t=0.02 20:21:45
{com}. about
{txt}Stata/SE 16.1 for Windows (64-bit x86-64)
Revision 30 Jun 2020
Copyright 1985-2019 StataCorp LLC
Total physical memory: {res} 16.00 GB
{txt}Available physical memory: {res} 5.19 GB
{txt}Stata license: {res}5-user network perpetual
{txt}Serial number: {res}401606228165
{txt}Licensed to: {res}Mark Schaffer
Heriot-Watt University
{txt}r; t=0.01 20:21:45
{com}. which cvlasso
{txt}.\cvlasso.ado
{res}*! cvlasso 1.0.11 27sept2020
*! lassopack package 1.4.1
*! authors aa/ms
{txt}r; t=0.00 20:21:45
{com}. which lasso2
{txt}.\lasso2.ado
{res}*! lasso2 1.0.12 27sept2020
*! lassopack package 1.4.1
*! authors aa/ms
{txt}r; t=0.00 20:21:45
{com}. which lasso2_p
{txt}.\lasso2_p.ado
{res}*! lasso2_p 1.0.06 14oct2019
*! lassopack package 1.4
*! authors aa/ms
{txt}r; t=0.00 20:21:45
{com}. which lassoutils
{txt}.\lassoutils.ado
{res}*! lassoutils 1.2.03 27sept2020
*! lassopack package 1.4.1
*! authors aa/cbh/ms
{txt}r; t=0.01 20:21:45
{com}.
. * data source
. * global prostate prostate.data
. global prostate https://web.stanford.edu/~hastie/ElemStatLearn/datasets/prostate.data
{txt}r; t=0.00 20:21:45
{com}.
. * program to compare two matrices in terms of avg abs deviation
. cap program drop comparemat
{txt}r; t=0.00 20:21:45
{com}. program define comparemat , rclass
{txt} 1{com}. syntax anything [, tol(real 10e-3)]
{txt} 2{com}. local A : word 1 of `0'
{txt} 3{com}. local B : word 2 of `0'
{txt} 4{com}. tempname Amat Bmat
{txt} 5{com}. mat `Amat' = `A'
{txt} 6{com}. mat `Bmat' = `B'
{txt} 7{com}. local diff=mreldif(`Amat',`Bmat')
{txt} 8{com}. di as text "mreldif=`diff'. tolerance = `tol'"
{txt} 9{com}. mat list `Amat'
{txt} 10{com}. mat list `Bmat'
{txt} 11{com}. return scalar mreldif = `diff'
{txt} 12{com}. assert `diff'<`tol'
{txt} 13{com}. end
{txt}r; t=0.00 20:21:45
{com}.
.
. set seed 123456
{txt}r; t=0.00 20:21:45
{com}.
. ********************************************************************************
. *** compare with glmnet ***
. ********************************************************************************
.
. * load example data
. insheet using "$prostate", tab clear
{txt}(11 vars, 97 obs)
r; t=1.50 20:21:47
{com}. drop if _n==97 // to ensure same size for each fold
{txt}(1 observation deleted)
r; t=0.00 20:21:47
{com}.
. global model lpsa lcavol lweight age lbph svi lcp gleason pgg45
{txt}r; t=0.00 20:21:47
{com}.
. * generate fold variable
. gen myfid = 1 if _n<=32
{txt}(64 missing values generated)
r; t=0.00 20:21:47
{com}. replace myfid = 2 if _n>32 & _n<=64
{txt}(32 real changes made)
r; t=0.00 20:21:47
{com}. replace myfid = 3 if _n>64
{txt}(32 real changes made)
r; t=0.00 20:21:47
{com}.
. cvlasso $model, foldvar(myfid) lambda(150 15 1.5)
{txt}Use user-specified fold variable.
K-fold cross-validation with 3 folds. Elastic net with alpha=1.
Fold {res}1 2 3
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 150 {space 3} {res} 2.3865184 {space 3} {res} 1.1559279
{txt} 2{c |} {space 3} {res} 15 {space 3} {res} 1.4635023 {space 3} {res} .42894674 *^
{txt} 3{c |} {space 3} {res} 1.5 {space 3} {res} 1.485229 {space 3} {res} .36948736
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=0.77 20:21:48
{com}. mat L = e(mmspe)
{txt}r; t=0.00 20:21:48
{com}. /*
> c<-cv.glmnet(X,y,foldid=fid,lambda=c(150, 15, 1.5)/(2*n),keep=TRUE, intercept=TRUE,standardize=TRUE)
> > c$cvm # mean-squared prediction error
> [1] 2.386518 1.463497 1.484953
> > var(predict(c,newx=X,s="lambda.min"))
> 1
> 1 0.608541
> */
. mat G = ( 2.38651835211576 \ 1.46349718052732 \ 1.48495268875459 )
{txt}r; t=0.00 20:21:48
{com}. comparemat L G // compare coeffs
{txt}mreldif=.0001112103968545. tolerance = .01
{res}
{txt}__000000[3,1]
r1
c1 {res} 2.3865184
{txt}c2 {res} 1.4635023
{txt}c3 {res} 1.485229
{reset}{res}
{txt}__000001[3,1]
c1
r1 {res} 2.3865184
{txt}r2 {res} 1.4634972
{txt}r3 {res} 1.4849527
{reset}r; t=0.04 20:21:48
{com}. cap drop xb
{txt}r; t=0.00 20:21:48
{com}. predict double xb, lopt
{txt}Estimate lasso with lambda=15 (lopt).
{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.4705447 0.4939937
{txt}{space 10}lweight {c |}{col 21}{res} 0.4738822 0.5463838
{txt}{space 13}lbph {c |}{col 21}{res} 0.0222266 0.0675109
{txt}{space 14}svi {c |}{col 21}{res} 0.4597209 0.5816563
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0021287 0.0033429
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} -0.0467006 -0.4001276
{txt}{hline 18}{c BT}{hline 32}
No xb or residuals options specified. Assume xb (fitted values).
Use e(b) from previous lasso2 estimation (lambda=15).
r; t=0.10 20:21:48
{com}. sum xb
{txt} Variable {c |} Obs Mean Std. Dev. Min Max
{hline 13}{c +}{hline 57}
{space 10}xb {c |}{res} 96 2.446048 .7801003 .9116189 4.111986
{txt}r; t=0.00 20:21:48
{com}. assert reldif(0.608541,r(Var))<0.001 // compare predicted values
{txt}r; t=0.00 20:21:48
{com}.
.
. cvlasso $model, foldvar(myfid) lambda(150 15 1.5) prestd
{txt}Use user-specified fold variable.
K-fold cross-validation with 3 folds. Elastic net with alpha=1.
Fold {res}1 2 3
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 150 {space 3} {res} 2.3865184 {space 3} {res} 1.1559279
{txt} 2{c |} {space 3} {res} 15 {space 3} {res} 1.4635023 {space 3} {res} .42894674 *^
{txt} 3{c |} {space 3} {res} 1.5 {space 3} {res} 1.485229 {space 3} {res} .36948736
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=0.03 20:21:48
{com}. mat L = e(mmspe)
{txt}r; t=0.00 20:21:48
{com}. /*
> c<-cv.glmnet(X,y,foldid=fid,lambda=c(150, 15, 1.5)/(2*n),keep=TRUE, intercept=TRUE,standardize=TRUE)
> > c$cvm # mean-squared prediction error
> [1] 2.386518 1.463497 1.484953
> > var(predict(c,newx=X,s="lambda.min"))
> 1
> 1 0.608541
> */
. mat G = ( 2.38651835211576 \ 1.46349718052732 \ 1.48495268875459 )
{txt}r; t=0.00 20:21:48
{com}. comparemat L G // compare coeffs
{txt}mreldif=.0001112103968545. tolerance = .01
{res}
{txt}__000000[3,1]
r1
c1 {res} 2.3865184
{txt}c2 {res} 1.4635023
{txt}c3 {res} 1.485229
{reset}{res}
{txt}__000001[3,1]
c1
r1 {res} 2.3865184
{txt}r2 {res} 1.4634972
{txt}r3 {res} 1.4849527
{reset}r; t=0.00 20:21:48
{com}. cap drop xb
{txt}r; t=0.00 20:21:48
{com}. predict double xb, lopt
{txt}Estimate lasso with lambda=15 (lopt).
{res}
{txt}{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.4705447 0.4939937
{txt}{space 10}lweight {c |}{col 21}{res} 0.4738822 0.5463838
{txt}{space 13}lbph {c |}{col 21}{res} 0.0222266 0.0675109
{txt}{space 14}svi {c |}{col 21}{res} 0.4597209 0.5816563
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0021287 0.0033429
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} -0.0467006 -0.4001276
{txt}{hline 18}{c BT}{hline 32}
No xb or residuals options specified. Assume xb (fitted values).
Use e(b) from previous lasso2 estimation (lambda=15).
r; t=1.44 20:21:49
{com}. sum xb
{txt} Variable {c |} Obs Mean Std. Dev. Min Max
{hline 13}{c +}{hline 57}
{space 10}xb {c |}{res} 96 2.446048 .7801003 .9116189 4.111986
{txt}r; t=0.00 20:21:49
{com}. assert reldif(0.608541,r(Var))<0.001 // compare predicted values
{txt}r; t=0.00 20:21:49
{com}.
.
. cvlasso $model, foldvar(myfid) lambda(150 15 1.5) unitload
{txt}Use user-specified fold variable.
K-fold cross-validation with 3 folds. Elastic net with alpha=1.
Fold {res}1 2 3
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 150 {space 3} {res} 2.1036977 {space 3} {res} .86238904
{txt} 2{c |} {space 3} {res} 15 {space 3} {res} 1.4298598 {space 3} {res} .47710985 ^
{txt} 3{c |} {space 3} {res} 1.5 {space 3} {res} 1.4275375 {space 3} {res} .35365915 *
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{err}Warning: lopt is at the limit of the lambda range.
{txt}r; t=0.03 20:21:49
{com}. mat L = e(mmspe)
{txt}r; t=0.00 20:21:49
{com}. /*
> > # cross-validation with intercept & standardisation
> > c<-cv.glmnet(X,y,foldid=fid,lambda=c(150, 15, 1.5)/(2*n),keep=TRUE, intercept=TRUE,standardize=FALSE)
> > c$cvm # mean-squared prediction error
> [1] 2.103697 1.429934 1.427561
> > var(predict(c,newx=X,s="lambda.min"))
> 1
> 1 0.7840688
> */
. mat G = ( 2.10369705382686 \ 1.42993421234064 \ 1.42756055333919 )
{txt}r; t=0.00 20:21:49
{com}. comparemat L G // compare coeffs
{txt}mreldif=.0000306155184697. tolerance = .01
{res}
{txt}__000000[3,1]
r1
c1 {res} 2.1036977
{txt}c2 {res} 1.4298598
{txt}c3 {res} 1.4275375
{reset}{res}
{txt}__000001[3,1]
c1
r1 {res} 2.1036971
{txt}r2 {res} 1.4299342
{txt}r3 {res} 1.4275606
{reset}r; t=0.00 20:21:49
{com}. cap drop xb
{txt}r; t=0.00 20:21:49
{com}. predict double xb, lopt
{txt}Estimate lasso with lambda=1.5 (lopt).
{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.5568426 0.5653571
{txt}{space 10}lweight {c |}{col 21}{res} 0.5707438 0.6139211
{txt}{space 14}age {c |}{col 21}{res} -0.0208973 -0.0224946
{txt}{space 13}lbph {c |}{col 21}{res} 0.0911393 0.0935981
{txt}{space 14}svi {c |}{col 21}{res} 0.6204808 0.7149700
{txt}{space 14}lcp {c |}{col 21}{res} -0.1126800 -0.1447125
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0068648 0.0071245
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} 0.6415930 0.5426554
{txt}{hline 18}{c BT}{hline 32}
No xb or residuals options specified. Assume xb (fitted values).
Use e(b) from previous lasso2 estimation (lambda=1.5).
r; t=0.02 20:21:49
{com}. sum xb
{txt} Variable {c |} Obs Mean Std. Dev. Min Max
{hline 13}{c +}{hline 57}
{space 10}xb {c |}{res} 96 2.446048 .8854875 .513909 4.598263
{txt}r; t=0.00 20:21:49
{com}. assert reldif(0.7840688,r(Var))<0.001 // compare predicted values
{txt}r; t=0.00 20:21:49
{com}.
.
. cvlasso $model, foldvar(myfid) lambda(150 15 1.5) nocons unitload
{txt}Use user-specified fold variable.
K-fold cross-validation with 3 folds. Elastic net with alpha=1.
Fold {res}1 2 3
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 150 {space 3} {res} 1.9998833 {space 3} {res} .72964224
{txt} 2{c |} {space 3} {res} 15 {space 3} {res} 1.26607 {space 3} {res} .39073554 ^
{txt} 3{c |} {space 3} {res} 1.5 {space 3} {res} 1.246129 {space 3} {res} .28903645 *
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{err}Warning: lopt is at the limit of the lambda range.
{txt}r; t=0.14 20:21:49
{com}. mat L = e(mmspe)
{txt}r; t=0.00 20:21:49
{com}. /*
> > c<-cv.glmnet(X,y,foldid=fid,lambda=c(150, 15, 1.5)/(2*n),keep=TRUE, intercept=FALSE,standardize=FALSE)
> > c$cvm # mean-squared prediction error
> [1] 1.999806 1.266384 1.246805
> > var(predict(c,newx=X,s="lambda.min"))
> 1
> 1 0.7919695
> */
. mat G = ( 1.99980614859113 \ 1.26638436668758 \ 1.24680539174676 )
{txt}r; t=0.00 20:21:49
{com}. comparemat L G // compare coeffs
{txt}mreldif=.0003010647418424. tolerance = .01
{res}
{txt}__000000[3,1]
r1
c1 {res} 1.9998833
{txt}c2 {res} 1.26607
{txt}c3 {res} 1.246129
{reset}{res}
{txt}__000001[3,1]
c1
r1 {res} 1.9998061
{txt}r2 {res} 1.2663844
{txt}r3 {res} 1.2468054
{reset}r; t=0.00 20:21:49
{com}. cap drop xb
{txt}r; t=0.00 20:21:49
{com}. predict double xb, lopt
{txt}Estimate lasso with lambda=1.5 (lopt).
{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.5473610 0.5569029
{txt}{space 10}lweight {c |}{col 21}{res} 0.6258035 0.6453516
{txt}{space 14}age {c |}{col 21}{res} -0.0188110 -0.0217852
{txt}{space 13}lbph {c |}{col 21}{res} 0.0801178 0.0880196
{txt}{space 14}svi {c |}{col 21}{res} 0.6260775 0.7250462
{txt}{space 14}lcp {c |}{col 21}{res} -0.1142476 -0.1460891
{txt}{space 10}gleason {c |}{col 21}{res} 0.0505847 0.0620963
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0059407 0.0060062
{txt}{hline 18}{c BT}{hline 32}
No xb or residuals options specified. Assume xb (fitted values).
Use e(b) from previous lasso2 estimation (lambda=1.5).
r; t=0.03 20:21:49
{com}. sum xb
{txt} Variable {c |} Obs Mean Std. Dev. Min Max
{hline 13}{c +}{hline 57}
{space 10}xb {c |}{res} 96 2.443933 .8905195 .5327895 4.561406
{txt}r; t=0.00 20:21:49
{com}. assert reldif(0.7919695,r(Var))<0.001 // compare predicted values
{txt}r; t=0.00 20:21:49
{com}.
. cvlasso $model, foldvar(myfid) lambda(150 15 1.5) nocons
{txt}Use user-specified fold variable.
K-fold cross-validation with 3 folds. Elastic net with alpha=1.
Fold {res}1 2 3
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 150 {space 3} {res} 1.9069161 {space 3} {res} .92525083
{txt} 2{c |} {space 3} {res} 15 {space 3} {res} 1.2339936 {space 3} {res} .35347077 *^
{txt} 3{c |} {space 3} {res} 1.5 {space 3} {res} 1.309495 {space 3} {res} .3270498
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=0.15 20:21:49
{com}. mat L = e(mmspe)
{txt}r; t=0.00 20:21:49
{com}. /*
> c<-cv.glmnet(X,y,foldid=fid,lambda=c(150, 15, 1.5)/(2*n),keep=TRUE, intercept=FALSE,standardize=TRUE)
> > c$cvm # mean-squared prediction error
> [1] 1.906526 1.232220 1.310531
> > var(predict(c,newx=X,s="lambda.min"))
> 1
> 1 0.6062457
> */
. mat G = ( 1.90652583524832 \ 1.23222044017428 \ 1.31053116174191 )
{txt}r; t=0.00 20:21:49
{com}. comparemat L G // compare coeffs
{txt}mreldif=.0007943382600103. tolerance = .01
{res}
{txt}__000000[3,1]
r1
c1 {res} 1.9069161
{txt}c2 {res} 1.2339936
{txt}c3 {res} 1.309495
{reset}{res}
{txt}__000001[3,1]
c1
r1 {res} 1.9065258
{txt}r2 {res} 1.2322204
{txt}r3 {res} 1.3105312
{reset}r; t=0.00 20:21:49
{com}. cap drop xb
{txt}r; t=0.00 20:21:49
{com}. predict double xb, lopt
{txt}Estimate lasso with lambda=15 (lopt).
{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.4712765 0.5002634
{txt}{space 10}lweight {c |}{col 21}{res} 0.4608978 0.4351342
{txt}{space 13}lbph {c |}{col 21}{res} 0.0239597 0.0823598
{txt}{space 14}svi {c |}{col 21}{res} 0.4613426 0.5955516
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0021037 0.0031282
{txt}{hline 18}{c BT}{hline 32}
No xb or residuals options specified. Assume xb (fitted values).
Use e(b) from previous lasso2 estimation (lambda=15).
r; t=0.02 20:21:49
{com}. sum xb
{txt} Variable {c |} Obs Mean Std. Dev. Min Max
{hline 13}{c +}{hline 57}
{space 10}xb {c |}{res} 96 2.446541 .7785216 .9124108 4.1091
{txt}r; t=0.00 20:21:49
{com}. assert reldif(0.6062457,r(Var))<0.001 // compare predicted values
{txt}r; t=0.00 20:21:49
{com}.
. cvlasso $model, foldvar(myfid) lambda(150 15 1.5) nocons prestd
{txt}Use user-specified fold variable.
K-fold cross-validation with 3 folds. Elastic net with alpha=1.
Fold {res}1 2 3
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 150 {space 3} {res} 1.9069161 {space 3} {res} .92525083
{txt} 2{c |} {space 3} {res} 15 {space 3} {res} 1.2339936 {space 3} {res} .35347077 *^
{txt} 3{c |} {space 3} {res} 1.5 {space 3} {res} 1.309495 {space 3} {res} .3270498
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=0.15 20:21:50
{com}. mat L = e(mmspe)
{txt}r; t=0.00 20:21:50
{com}. /*
> c<-cv.glmnet(X,y,foldid=fid,lambda=c(150, 15, 1.5)/(2*n),keep=TRUE, intercept=FALSE,standardize=TRUE)
> > c$cvm # mean-squared prediction error
> [1] 1.906526 1.232220 1.310531
> > var(predict(c,newx=X,s="lambda.min"))
> 1
> 1 0.6062457
> */
. mat G = ( 1.90652583524832 \ 1.23222044017428 \ 1.31053116174191 )
{txt}r; t=0.00 20:21:50
{com}. comparemat L G // compare coeffs
{txt}mreldif=.0007943382600105. tolerance = .01
{res}
{txt}__000000[3,1]
r1
c1 {res} 1.9069161
{txt}c2 {res} 1.2339936
{txt}c3 {res} 1.309495
{reset}{res}
{txt}__000001[3,1]
c1
r1 {res} 1.9065258
{txt}r2 {res} 1.2322204
{txt}r3 {res} 1.3105312
{reset}r; t=0.00 20:21:50
{com}. cap drop xb
{txt}r; t=0.00 20:21:50
{com}. predict double xb, lopt
{txt}Estimate lasso with lambda=15 (lopt).
{res}
{txt}{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.4712765 0.5002634
{txt}{space 10}lweight {c |}{col 21}{res} 0.4608978 0.4351342
{txt}{space 13}lbph {c |}{col 21}{res} 0.0239597 0.0823598
{txt}{space 14}svi {c |}{col 21}{res} 0.4613426 0.5955516
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0021037 0.0031282
{txt}{hline 18}{c BT}{hline 32}
No xb or residuals options specified. Assume xb (fitted values).
Use e(b) from previous lasso2 estimation (lambda=15).
r; t=0.02 20:21:50
{com}. sum xb
{txt} Variable {c |} Obs Mean Std. Dev. Min Max
{hline 13}{c +}{hline 57}
{space 10}xb {c |}{res} 96 2.446541 .7785216 .9124108 4.1091
{txt}r; t=0.00 20:21:50
{com}. assert reldif(0.6062457,r(Var))<0.001 // compare predicted values
{txt}r; t=0.00 20:21:50
{com}.
.
. ********************************************************************************
. *** validate ***
. ********************************************************************************
.
. * load example data
. insheet using "$prostate", tab clear
{txt}(11 vars, 97 obs)
r; t=0.18 20:21:50
{com}.
. global model lpsa lcavol lweight age lbph svi lcp gleason pgg45
{txt}r; t=0.00 20:21:50
{com}. gen sample = _n<70
{txt}r; t=0.00 20:21:50
{com}.
. foreach type of newlist lopt lse {c -(}
{txt} 2{com}.
. local type lse
{txt} 3{com}.
. // check that right beta is used for predict
. // also validates that "if" works
. cvlasso $model if sample
{txt} 4{com}. local mylopt = e(`type')
{txt} 5{com}. cap drop myxb
{txt} 6{com}. predict double myxb if !sample, xb `type' postres
{txt} 7{com}. mat A = e(b)
{txt} 8{com}.
. lasso2 $model if sample, lambda(`mylopt')
{txt} 9{com}. cap drop myxb2
{txt} 10{com}. predict double myxb2 if !sample, xb
{txt} 11{com}. mat B = e(b)
{txt} 12{com}.
. comparemat A B
{txt} 13{com}. assert myxb2==myxb
{txt} 14{com}.
. // and now with alpha list
. // use lglmnet option
. cvlasso $model if sample, alpha(0 0.3 0.7 1) lglmnet
{txt} 15{com}. local mylopt = e(`type')
{txt} 16{com}. local myalpha = e(alphamin)
{txt} 17{com}. cap drop myr
{txt} 18{com}. predict double myr if !sample, r `type' postres
{txt} 19{com}. mat A = e(b)
{txt} 20{com}.
. lasso2 $model if sample, lambda(`mylopt') alpha(`myalpha') lglmnet
{txt} 21{com}. cap drop myr2
{txt} 22{com}. predict double myr2 if !sample, r
{txt} 23{com}. mat B = e(b)
{txt} 24{com}.
. comparemat A B
{txt} 25{com}. assert myr2==myr
{txt} 26{com}.
. {c )-}
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 64.86388 {space 3} {res} .70214335 {space 3} {res} .13668767
{txt} 2{c |} {space 3} {res} 59.101552 {space 3} {res} .68166758 {space 3} {res} .13770442
{txt} 3{c |} {space 3} {res} 53.851133 {space 3} {res} .65032545 {space 3} {res} .13589084
{txt} 4{c |} {space 3} {res} 49.067147 {space 3} {res} .61368184 {space 3} {res} .12902249
{txt} 5{c |} {space 3} {res} 44.708157 {space 3} {res} .57648569 {space 3} {res} .11951189
{txt} 6{c |} {space 3} {res} 40.736407 {space 3} {res} .5455564 {space 3} {res} .11125054
{txt} 7{c |} {space 3} {res} 37.117497 {space 3} {res} .52022373 {space 3} {res} .10413738
{txt} 8{c |} {space 3} {res} 33.820081 {space 3} {res} .49994965 {space 3} {res} .09808444
{txt} 9{c |} {space 3} {res} 30.815598 {space 3} {res} .48394209 {space 3} {res} .09299888
{txt} 10{c |} {space 3} {res} 28.078025 {space 3} {res} .4715922 {space 3} {res} .08866583 ^
{txt} 11{c |} {space 3} {res} 25.583651 {space 3} {res} .46159647 {space 3} {res} .08503773
{txt} 12{c |} {space 3} {res} 23.31087 {space 3} {res} .45319845 {space 3} {res} .0819249
{txt} 13{c |} {space 3} {res} 21.239997 {space 3} {res} .44655158 {space 3} {res} .07921285
{txt} 14{c |} {space 3} {res} 19.353094 {space 3} {res} .43989318 {space 3} {res} .07690231
{txt} 15{c |} {space 3} {res} 17.633818 {space 3} {res} .43416143 {space 3} {res} .07503205
{txt} 16{c |} {space 3} {res} 16.067278 {space 3} {res} .42831327 {space 3} {res} .07332298
{txt} 17{c |} {space 3} {res} 14.639906 {space 3} {res} .42328622 {space 3} {res} .07186312
{txt} 18{c |} {space 3} {res} 13.339337 {space 3} {res} .41909404 {space 3} {res} .07059609
{txt} 19{c |} {space 3} {res} 12.154307 {space 3} {res} .41541784 {space 3} {res} .06940436
{txt} 20{c |} {space 3} {res} 11.074552 {space 3} {res} .41239688 {space 3} {res} .06842274
{txt} 21{c |} {space 3} {res} 10.090719 {space 3} {res} .41115051 {space 3} {res} .06762829 *
{txt} 22{c |} {space 3} {res} 9.1942875 {space 3} {res} .41125524 {space 3} {res} .06734084
{txt} 23{c |} {space 3} {res} 8.3774923 {space 3} {res} .41189673 {space 3} {res} .06726297
{txt} 24{c |} {space 3} {res} 7.633259 {space 3} {res} .41299996 {space 3} {res} .06716497
{txt} 25{c |} {space 3} {res} 6.9551413 {space 3} {res} .41535333 {space 3} {res} .06772844
{txt} 26{c |} {space 3} {res} 6.3372657 {space 3} {res} .41747426 {space 3} {res} .06851425
{txt} 27{c |} {space 3} {res} 5.7742805 {space 3} {res} .41770086 {space 3} {res} .06978754
{txt} 28{c |} {space 3} {res} 5.2613093 {space 3} {res} .41811876 {space 3} {res} .07107378
{txt} 29{c |} {space 3} {res} 4.7939091 {space 3} {res} .41867378 {space 3} {res} .07229779
{txt} 30{c |} {space 3} {res} 4.3680314 {space 3} {res} .41856902 {space 3} {res} .07315811
{txt} 31{c |} {space 3} {res} 3.9799876 {space 3} {res} .41856329 {space 3} {res} .07409234
{txt} 32{c |} {space 3} {res} 3.6264164 {space 3} {res} .418418 {space 3} {res} .07512313
{txt} 33{c |} {space 3} {res} 3.3042556 {space 3} {res} .41815181 {space 3} {res} .0761924
{txt} 34{c |} {space 3} {res} 3.0107146 {space 3} {res} .41800644 {space 3} {res} .07722359
{txt} 35{c |} {space 3} {res} 2.743251 {space 3} {res} .41780862 {space 3} {res} .07813846
{txt} 36{c |} {space 3} {res} 2.4995482 {space 3} {res} .41776606 {space 3} {res} .07897215
{txt} 37{c |} {space 3} {res} 2.2774952 {space 3} {res} .41784915 {space 3} {res} .07973505
{txt} 38{c |} {space 3} {res} 2.0751688 {space 3} {res} .4178434 {space 3} {res} .0803494
{txt} 39{c |} {space 3} {res} 1.8908165 {space 3} {res} .41783315 {space 3} {res} .08086973
{txt} 40{c |} {space 3} {res} 1.7228416 {space 3} {res} .4177931 {space 3} {res} .08133498
{txt} 41{c |} {space 3} {res} 1.5697891 {space 3} {res} .41780825 {space 3} {res} .08175923
{txt} 42{c |} {space 3} {res} 1.4303334 {space 3} {res} .4178703 {space 3} {res} .08214655
{txt} 43{c |} {space 3} {res} 1.3032665 {space 3} {res} .41796691 {space 3} {res} .08250007
{txt} 44{c |} {space 3} {res} 1.1874879 {space 3} {res} .41808819 {space 3} {res} .0828227
{txt} 45{c |} {space 3} {res} 1.0819947 {space 3} {res} .41822631 {space 3} {res} .08311707
{txt} 46{c |} {space 3} {res} .98587331 {space 3} {res} .41837509 {space 3} {res} .08338564
{txt} 47{c |} {space 3} {res} .89829104 {space 3} {res} .41872946 {space 3} {res} .08363953
{txt} 48{c |} {space 3} {res} .81848934 {space 3} {res} .41907617 {space 3} {res} .08387238
{txt} 49{c |} {space 3} {res} .745777 {space 3} {res} .41940754 {space 3} {res} .08408564
{txt} 50{c |} {space 3} {res} .67952423 {space 3} {res} .41972231 {space 3} {res} .08428089
{txt} 51{c |} {space 3} {res} .61915717 {space 3} {res} .42001978 {space 3} {res} .08445959
{txt} 52{c |} {space 3} {res} .56415295 {space 3} {res} .42029967 {space 3} {res} .08462309
{txt} 53{c |} {space 3} {res} .51403516 {space 3} {res} .42056204 {space 3} {res} .08477263
{txt} 54{c |} {space 3} {res} .46836969 {space 3} {res} .4208072 {space 3} {res} .08490936
{txt} 55{c |} {space 3} {res} .42676102 {space 3} {res} .42103565 {space 3} {res} .08503435
{txt} 56{c |} {space 3} {res} .38884875 {space 3} {res} .42124801 {space 3} {res} .08514857
{txt} 57{c |} {space 3} {res} .3543045 {space 3} {res} .42144499 {space 3} {res} .08525293
{txt} 58{c |} {space 3} {res} .32282906 {space 3} {res} .42162738 {space 3} {res} .08534826
{txt} 59{c |} {space 3} {res} .29414982 {space 3} {res} .42179596 {space 3} {res} .08543531
{txt} 60{c |} {space 3} {res} .26801836 {space 3} {res} .42195157 {space 3} {res} .08551481
{txt} 61{c |} {space 3} {res} .24420835 {space 3} {res} .42209501 {space 3} {res} .08558737
{txt} 62{c |} {space 3} {res} .22251355 {space 3} {res} .42222708 {space 3} {res} .08565361
{txt} 63{c |} {space 3} {res} .20274606 {space 3} {res} .42234856 {space 3} {res} .08571407
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
Estimate lasso with lambda=28.078 (lse).
{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.2177045 0.3782994
{txt}{space 10}lweight {c |}{col 21}{res} 0.4397825 0.8391637
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} 0.1812277 -1.3919237
{txt}{hline 18}{c BT}{hline 32}
Use e(b) from previous lasso2 estimation (lambda=28.07802540248).
(69 missing values generated)
{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.2177045 0.3782994
{txt}{space 10}lweight {c |}{col 21}{res} 0.4397825 0.8391637
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} 0.1812277 -1.3919237
{txt}{hline 18}{c BT}{hline 32}
Use e(b) from previous lasso2 estimation (lambda=28.07802540248).
(69 missing values generated)
mreldif=0. tolerance = .01
{res}
{txt}__000000[1,3]
lcavol lweight _cons
y1 {res} .21770447 .43978251 .18122774
{reset}{res}
{txt}__000001[1,3]
lcavol lweight _cons
y1 {res} .21770447 .43978251 .18122774
{reset}
K-fold cross-validation with 10 folds. Elastic net with alpha=0.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} .47002812 {space 3} {res} .41012597 {space 3} {res} .06401609 ^
{txt} 2{c |} {space 3} {res} .42827212 {space 3} {res} .40728618 {space 3} {res} .06307755
{txt} 3{c |} {space 3} {res} .3902256 {space 3} {res} .40470048 {space 3} {res} .06225597
{txt} 4{c |} {space 3} {res} .35555903 {space 3} {res} .40236398 {space 3} {res} .06155117
{txt} 5{c |} {space 3} {res} .32397215 {space 3} {res} .40027036 {space 3} {res} .06096131
{txt} 6{c |} {space 3} {res} .29519136 {space 3} {res} .39841194 {space 3} {res} .06048296
{txt} 7{c |} {space 3} {res} .26896737 {space 3} {res} .39677969 {space 3} {res} .06011112
{txt} 8{c |} {space 3} {res} .24507305 {space 3} {res} .39536326 {space 3} {res} .05983949
{txt} 9{c |} {space 3} {res} .22330144 {space 3} {res} .39415121 {space 3} {res} .05966063
{txt} 10{c |} {space 3} {res} .20346395 {space 3} {res} .39313106 {space 3} {res} .05956626
{txt} 11{c |} {space 3} {res} .18538878 {space 3} {res} .39228957 {space 3} {res} .05954754
{txt} 12{c |} {space 3} {res} .16891935 {space 3} {res} .3916129 {space 3} {res} .05959536
{txt} 13{c |} {space 3} {res} .15391302 {space 3} {res} .39108687 {space 3} {res} .05970059
{txt} 14{c |} {space 3} {res} .14023981 {space 3} {res} .39069715 {space 3} {res} .05985432
{txt} 15{c |} {space 3} {res} .12778129 {space 3} {res} .39042948 {space 3} {res} .06004803
{txt} 16{c |} {space 3} {res} .11642955 {space 3} {res} .3902699 {space 3} {res} .06027379
{txt} 17{c |} {space 3} {res} .10608627 {space 3} {res} .39020487 {space 3} {res} .06052428 *
{txt} 18{c |} {space 3} {res} .09666186 {space 3} {res} .3902215 {space 3} {res} .06079293
{txt} 19{c |} {space 3} {res} .08807469 {space 3} {res} .3903076 {space 3} {res} .0610739
{txt} 20{c |} {space 3} {res} .08025038 {space 3} {res} .39045184 {space 3} {res} .06136209
{txt} 21{c |} {space 3} {res} .07312115 {space 3} {res} .39064375 {space 3} {res} .06165314
{txt} 22{c |} {space 3} {res} .06662527 {space 3} {res} .39087384 {space 3} {res} .06194337
{txt} 23{c |} {space 3} {res} .06070647 {space 3} {res} .39113356 {space 3} {res} .06222972
{txt} 24{c |} {space 3} {res} .05531347 {space 3} {res} .39141529 {space 3} {res} .06250972
{txt} 25{c |} {space 3} {res} .05039957 {space 3} {res} .39171237 {space 3} {res} .0627814
{txt} 26{c |} {space 3} {res} .04592222 {space 3} {res} .39201899 {space 3} {res} .06304327
{txt} 27{c |} {space 3} {res} .04184261 {space 3} {res} .3923302 {space 3} {res} .06329421
{txt} 28{c |} {space 3} {res} .03812543 {space 3} {res} .39264181 {space 3} {res} .06353346
{txt} 29{c |} {space 3} {res} .03473847 {space 3} {res} .39295034 {space 3} {res} .06376053
{txt} 30{c |} {space 3} {res} .0316524 {space 3} {res} .39325295 {space 3} {res} .06397518
{txt} 31{c |} {space 3} {res} .02884049 {space 3} {res} .39354738 {space 3} {res} .06417738
{txt} 32{c |} {space 3} {res} .02627838 {space 3} {res} .39383186 {space 3} {res} .06436723
{txt} 33{c |} {space 3} {res} .02394388 {space 3} {res} .39410506 {space 3} {res} .06454499
{txt} 34{c |} {space 3} {res} .02181677 {space 3} {res} .39436605 {space 3} {res} .064711
{txt} 35{c |} {space 3} {res} .01987863 {space 3} {res} .39461421 {space 3} {res} .06486568
{txt} 36{c |} {space 3} {res} .01811267 {space 3} {res} .39484918 {space 3} {res} .06500951
{txt} 37{c |} {space 3} {res} .01650359 {space 3} {res} .39507085 {space 3} {res} .06514299
{txt} 38{c |} {space 3} {res} .01503746 {space 3} {res} .39527928 {space 3} {res} .06526666
{txt} 39{c |} {space 3} {res} .01370157 {space 3} {res} .39547467 {space 3} {res} .06538108
{txt} 40{c |} {space 3} {res} .01248436 {space 3} {res} .39565737 {space 3} {res} .06548677
{txt} 41{c |} {space 3} {res} .01137528 {space 3} {res} .39582777 {space 3} {res} .0655843
{txt} 42{c |} {space 3} {res} .01036473 {space 3} {res} .39598637 {space 3} {res} .06567418
{txt} 43{c |} {space 3} {res} .00944396 {space 3} {res} .3961337 {space 3} {res} .06575692
{txt} 44{c |} {space 3} {res} .00860498 {space 3} {res} .39627031 {space 3} {res} .06583304
{txt} 45{c |} {space 3} {res} .00784054 {space 3} {res} .39639678 {space 3} {res} .06590299
{txt} 46{c |} {space 3} {res} .00714401 {space 3} {res} .39651369 {space 3} {res} .06596722
{txt} 47{c |} {space 3} {res} .00650936 {space 3} {res} .39662164 {space 3} {res} .06602617
{txt} 48{c |} {space 3} {res} .00593108 {space 3} {res} .39672117 {space 3} {res} .06608023
{txt} 49{c |} {space 3} {res} .00540418 {space 3} {res} .39681286 {space 3} {res} .06612978
{txt} 50{c |} {space 3} {res} .00492409 {space 3} {res} .39689723 {space 3} {res} .06617517
{txt} 51{c |} {space 3} {res} .00448665 {space 3} {res} .39697481 {space 3} {res} .06621673
{txt} 52{c |} {space 3} {res} .00408806 {space 3} {res} .39704608 {space 3} {res} .06625476
{txt} 53{c |} {space 3} {res} .00372489 {space 3} {res} .3971115 {space 3} {res} .06628956
{txt} 54{c |} {space 3} {res} .00339398 {space 3} {res} .39717151 {space 3} {res} .06632139
{txt} 55{c |} {space 3} {res} .00309247 {space 3} {res} .39722654 {space 3} {res} .06635048
{txt} 56{c |} {space 3} {res} .00281774 {space 3} {res} .39727696 {space 3} {res} .06637707
{txt} 57{c |} {space 3} {res} .00256742 {space 3} {res} .39732314 {space 3} {res} .06640137
{txt} 58{c |} {space 3} {res} .00233934 {space 3} {res} .39736541 {space 3} {res} .06642356
{txt} 59{c |} {space 3} {res} .00213152 {space 3} {res} .39740409 {space 3} {res} .06644383
{txt} 60{c |} {space 3} {res} .00194216 {space 3} {res} .39743947 {space 3} {res} .06646234
{txt} 61{c |} {space 3} {res} .00176963 {space 3} {res} .39747182 {space 3} {res} .06647924
{txt} 62{c |} {space 3} {res} .00161242 {space 3} {res} .3975014 {space 3} {res} .06649466
{txt} 63{c |} {space 3} {res} .00146917 {space 3} {res} .39752842 {space 3} {res} .06650873
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{err}Warning: lse is at the limit of the lambda range.
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=.3.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} .47002812 {space 3} {res} .44529989 {space 3} {res} .07882048 ^
{txt} 2{c |} {space 3} {res} .42827212 {space 3} {res} .43541694 {space 3} {res} .07554672
{txt} 3{c |} {space 3} {res} .3902256 {space 3} {res} .42687637 {space 3} {res} .07255057
{txt} 4{c |} {space 3} {res} .35555903 {space 3} {res} .41952353 {space 3} {res} .06981929
{txt} 5{c |} {space 3} {res} .32397215 {space 3} {res} .41321631 {space 3} {res} .06733883
{txt} 6{c |} {space 3} {res} .29519136 {space 3} {res} .40782529 {space 3} {res} .06509417
{txt} 7{c |} {space 3} {res} .26896737 {space 3} {res} .40323347 {space 3} {res} .06306964
{txt} 8{c |} {space 3} {res} .24507305 {space 3} {res} .40001487 {space 3} {res} .06128728
{txt} 9{c |} {space 3} {res} .22330144 {space 3} {res} .39808447 {space 3} {res} .05978981
{txt} 10{c |} {space 3} {res} .20346395 {space 3} {res} .39735749 {space 3} {res} .05857717
{txt} 11{c |} {space 3} {res} .18538878 {space 3} {res} .39719435 {space 3} {res} .05757831 *
{txt} 12{c |} {space 3} {res} .16891935 {space 3} {res} .39732921 {space 3} {res} .05677394
{txt} 13{c |} {space 3} {res} .15391302 {space 3} {res} .39811974 {space 3} {res} .05635231
{txt} 14{c |} {space 3} {res} .14023981 {space 3} {res} .39919567 {space 3} {res} .05630205
{txt} 15{c |} {space 3} {res} .12778129 {space 3} {res} .40019299 {space 3} {res} .05646601
{txt} 16{c |} {space 3} {res} .11642955 {space 3} {res} .40073679 {space 3} {res} .05669463
{txt} 17{c |} {space 3} {res} .10608627 {space 3} {res} .40091483 {space 3} {res} .05685402
{txt} 18{c |} {space 3} {res} .09666186 {space 3} {res} .40114622 {space 3} {res} .05717764
{txt} 19{c |} {space 3} {res} .08807469 {space 3} {res} .40098742 {space 3} {res} .05776215
{txt} 20{c |} {space 3} {res} .08025038 {space 3} {res} .40099934 {space 3} {res} .05836479
{txt} 21{c |} {space 3} {res} .07312115 {space 3} {res} .40114941 {space 3} {res} .05897052
{txt} 22{c |} {space 3} {res} .06662527 {space 3} {res} .40114799 {space 3} {res} .05948742
{txt} 23{c |} {space 3} {res} .06070647 {space 3} {res} .40109615 {space 3} {res} .05994603
{txt} 24{c |} {space 3} {res} .05531347 {space 3} {res} .40028904 {space 3} {res} .0601798
{txt} 25{c |} {space 3} {res} .05039957 {space 3} {res} .3996653 {space 3} {res} .06044304
{txt} 26{c |} {space 3} {res} .04592222 {space 3} {res} .39919495 {space 3} {res} .06072542
{txt} 27{c |} {space 3} {res} .04184261 {space 3} {res} .39885197 {space 3} {res} .06101861
{txt} 28{c |} {space 3} {res} .03812543 {space 3} {res} .39861389 {space 3} {res} .06131593
{txt} 29{c |} {space 3} {res} .03473847 {space 3} {res} .39846146 {space 3} {res} .06161219
{txt} 30{c |} {space 3} {res} .0316524 {space 3} {res} .39836032 {space 3} {res} .06190805
{txt} 31{c |} {space 3} {res} .02884049 {space 3} {res} .39808305 {space 3} {res} .06224123
{txt} 32{c |} {space 3} {res} .02627838 {space 3} {res} .39784061 {space 3} {res} .06255301
{txt} 33{c |} {space 3} {res} .02394388 {space 3} {res} .39765313 {space 3} {res} .06285056
{txt} 34{c |} {space 3} {res} .02181677 {space 3} {res} .39751086 {space 3} {res} .0631329
{txt} 35{c |} {space 3} {res} .01987863 {space 3} {res} .39740558 {space 3} {res} .06339951
{txt} 36{c |} {space 3} {res} .01811267 {space 3} {res} .39733036 {space 3} {res} .06365023
{txt} 37{c |} {space 3} {res} .01650359 {space 3} {res} .3972794 {space 3} {res} .06388516
{txt} 38{c |} {space 3} {res} .01503746 {space 3} {res} .39724785 {space 3} {res} .06410461
{txt} 39{c |} {space 3} {res} .01370157 {space 3} {res} .3972317 {space 3} {res} .06430905
{txt} 40{c |} {space 3} {res} .01248436 {space 3} {res} .39722762 {space 3} {res} .06449906
{txt} 41{c |} {space 3} {res} .01137528 {space 3} {res} .39723286 {space 3} {res} .06467529
{txt} 42{c |} {space 3} {res} .01036473 {space 3} {res} .39724519 {space 3} {res} .06483845
{txt} 43{c |} {space 3} {res} .00944396 {space 3} {res} .39726277 {space 3} {res} .06498925
{txt} 44{c |} {space 3} {res} .00860498 {space 3} {res} .39728411 {space 3} {res} .06512844
{txt} 45{c |} {space 3} {res} .00784054 {space 3} {res} .39730804 {space 3} {res} .06525674
{txt} 46{c |} {space 3} {res} .00714401 {space 3} {res} .3973336 {space 3} {res} .06537487
{txt} 47{c |} {space 3} {res} .00650936 {space 3} {res} .39736002 {space 3} {res} .06548353
{txt} 48{c |} {space 3} {res} .00593108 {space 3} {res} .39738673 {space 3} {res} .06558339
{txt} 49{c |} {space 3} {res} .00540418 {space 3} {res} .39741327 {space 3} {res} .06567507
{txt} 50{c |} {space 3} {res} .00492409 {space 3} {res} .39743928 {space 3} {res} .0657592
{txt} 51{c |} {space 3} {res} .00448665 {space 3} {res} .39746453 {space 3} {res} .06583634
{txt} 52{c |} {space 3} {res} .00408806 {space 3} {res} .39748881 {space 3} {res} .06590703
{txt} 53{c |} {space 3} {res} .00372489 {space 3} {res} .39751201 {space 3} {res} .06597178
{txt} 54{c |} {space 3} {res} .00339398 {space 3} {res} .39753404 {space 3} {res} .06603105
{txt} 55{c |} {space 3} {res} .00309247 {space 3} {res} .39755485 {space 3} {res} .06608529
{txt} 56{c |} {space 3} {res} .00281774 {space 3} {res} .39757444 {space 3} {res} .0661349
{txt} 57{c |} {space 3} {res} .00256742 {space 3} {res} .39759281 {space 3} {res} .06618027
{txt} 58{c |} {space 3} {res} .00233934 {space 3} {res} .39760997 {space 3} {res} .06622173
{txt} 59{c |} {space 3} {res} .00213152 {space 3} {res} .39762597 {space 3} {res} .06625963
{txt} 60{c |} {space 3} {res} .00194216 {space 3} {res} .39764084 {space 3} {res} .06629424
{txt} 61{c |} {space 3} {res} .00176963 {space 3} {res} .39765464 {space 3} {res} .06632586
{txt} 62{c |} {space 3} {res} .00161242 {space 3} {res} .39766743 {space 3} {res} .06635473
{txt} 63{c |} {space 3} {res} .00146917 {space 3} {res} .39767925 {space 3} {res} .06638109
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{err}Warning: lse is at the limit of the lambda range.
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=.7.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} .47002812 {space 3} {res} .56478477 {space 3} {res} .11268272
{txt} 2{c |} {space 3} {res} .42827212 {space 3} {res} .53834409 {space 3} {res} .10494957
{txt} 3{c |} {space 3} {res} .3902256 {space 3} {res} .51647335 {space 3} {res} .09837217
{txt} 4{c |} {space 3} {res} .35555903 {space 3} {res} .49844777 {space 3} {res} .09247087
{txt} 5{c |} {space 3} {res} .32397215 {space 3} {res} .48344329 {space 3} {res} .08707347
{txt} 6{c |} {space 3} {res} .29519136 {space 3} {res} .46920859 {space 3} {res} .08244563
{txt} 7{c |} {space 3} {res} .26896737 {space 3} {res} .45606914 {space 3} {res} .078432
{txt} 8{c |} {space 3} {res} .24507305 {space 3} {res} .44348282 {space 3} {res} .07473117 ^
{txt} 9{c |} {space 3} {res} .22330144 {space 3} {res} .43289941 {space 3} {res} .07144851
{txt} 10{c |} {space 3} {res} .20346395 {space 3} {res} .42377807 {space 3} {res} .06852391
{txt} 11{c |} {space 3} {res} .18538878 {space 3} {res} .416121 {space 3} {res} .0659115
{txt} 12{c |} {space 3} {res} .16891935 {space 3} {res} .40982415 {space 3} {res} .06357773
{txt} 13{c |} {space 3} {res} .15391302 {space 3} {res} .40459551 {space 3} {res} .06151615
{txt} 14{c |} {space 3} {res} .14023981 {space 3} {res} .40024536 {space 3} {res} .05969764
{txt} 15{c |} {space 3} {res} .12778129 {space 3} {res} .39663093 {space 3} {res} .05809528
{txt} 16{c |} {space 3} {res} .11642955 {space 3} {res} .39475363 {space 3} {res} .05678376
{txt} 17{c |} {space 3} {res} .10608627 {space 3} {res} .39420819 {space 3} {res} .05582604 *
{txt} 18{c |} {space 3} {res} .09666186 {space 3} {res} .39475825 {space 3} {res} .05516119
{txt} 19{c |} {space 3} {res} .08807469 {space 3} {res} .39566183 {space 3} {res} .05469839
{txt} 20{c |} {space 3} {res} .08025038 {space 3} {res} .39662863 {space 3} {res} .05440645
{txt} 21{c |} {space 3} {res} .07312115 {space 3} {res} .39855638 {space 3} {res} .05466686
{txt} 22{c |} {space 3} {res} .06662527 {space 3} {res} .40034315 {space 3} {res} .05515023
{txt} 23{c |} {space 3} {res} .06070647 {space 3} {res} .40171035 {space 3} {res} .05578078
{txt} 24{c |} {space 3} {res} .05531347 {space 3} {res} .4027468 {space 3} {res} .0563652
{txt} 25{c |} {space 3} {res} .05039957 {space 3} {res} .40351716 {space 3} {res} .0568747
{txt} 26{c |} {space 3} {res} .04592222 {space 3} {res} .40373416 {space 3} {res} .05759446
{txt} 27{c |} {space 3} {res} .04184261 {space 3} {res} .40383878 {space 3} {res} .05838472
{txt} 28{c |} {space 3} {res} .03812543 {space 3} {res} .40410598 {space 3} {res} .05913399
{txt} 29{c |} {space 3} {res} .03473847 {space 3} {res} .40426995 {space 3} {res} .05972735
{txt} 30{c |} {space 3} {res} .0316524 {space 3} {res} .40421342 {space 3} {res} .06016101
{txt} 31{c |} {space 3} {res} .02884049 {space 3} {res} .40343107 {space 3} {res} .06040336
{txt} 32{c |} {space 3} {res} .02627838 {space 3} {res} .4026502 {space 3} {res} .0607131
{txt} 33{c |} {space 3} {res} .02394388 {space 3} {res} .40203757 {space 3} {res} .0610298
{txt} 34{c |} {space 3} {res} .02181677 {space 3} {res} .40155988 {space 3} {res} .06134707
{txt} 35{c |} {space 3} {res} .01987863 {space 3} {res} .40115794 {space 3} {res} .06166821
{txt} 36{c |} {space 3} {res} .01811267 {space 3} {res} .4008511 {space 3} {res} .06197901
{txt} 37{c |} {space 3} {res} .01650359 {space 3} {res} .40062127 {space 3} {res} .06227702
{txt} 38{c |} {space 3} {res} .01503746 {space 3} {res} .40028311 {space 3} {res} .0626034
{txt} 39{c |} {space 3} {res} .01370157 {space 3} {res} .39994508 {space 3} {res} .06292698
{txt} 40{c |} {space 3} {res} .01248436 {space 3} {res} .39966671 {space 3} {res} .06322981
{txt} 41{c |} {space 3} {res} .01137528 {space 3} {res} .39943782 {space 3} {res} .06351225
{txt} 42{c |} {space 3} {res} .01036473 {space 3} {res} .39924995 {space 3} {res} .06377493
{txt} 43{c |} {space 3} {res} .00944396 {space 3} {res} .39908768 {space 3} {res} .06401694
{txt} 44{c |} {space 3} {res} .00860498 {space 3} {res} .39890069 {space 3} {res} .06423062
{txt} 45{c |} {space 3} {res} .00784054 {space 3} {res} .39874262 {space 3} {res} .06442897
{txt} 46{c |} {space 3} {res} .00714401 {space 3} {res} .39860883 {space 3} {res} .06461269
{txt} 47{c |} {space 3} {res} .00650936 {space 3} {res} .39849548 {space 3} {res} .06478256
{txt} 48{c |} {space 3} {res} .00593108 {space 3} {res} .39839932 {space 3} {res} .06493935
{txt} 49{c |} {space 3} {res} .00540418 {space 3} {res} .39831763 {space 3} {res} .06508388
{txt} 50{c |} {space 3} {res} .00492409 {space 3} {res} .39824813 {space 3} {res} .06521693
{txt} 51{c |} {space 3} {res} .00448665 {space 3} {res} .39818892 {space 3} {res} .06533929
{txt} 52{c |} {space 3} {res} .00408806 {space 3} {res} .39813838 {space 3} {res} .0654517
{txt} 53{c |} {space 3} {res} .00372489 {space 3} {res} .39809518 {space 3} {res} .0655549
{txt} 54{c |} {space 3} {res} .00339398 {space 3} {res} .39805819 {space 3} {res} .06564956
{txt} 55{c |} {space 3} {res} .00309247 {space 3} {res} .39802645 {space 3} {res} .06573633
{txt} 56{c |} {space 3} {res} .00281774 {space 3} {res} .39799916 {space 3} {res} .06581582
{txt} 57{c |} {space 3} {res} .00256742 {space 3} {res} .39797566 {space 3} {res} .0658886
{txt} 58{c |} {space 3} {res} .00233934 {space 3} {res} .39795539 {space 3} {res} .06595521
{txt} 59{c |} {space 3} {res} .00213152 {space 3} {res} .39793785 {space 3} {res} .06601615
{txt} 60{c |} {space 3} {res} .00194216 {space 3} {res} .39792265 {space 3} {res} .06607188
{txt} 61{c |} {space 3} {res} .00176963 {space 3} {res} .39790945 {space 3} {res} .06612282
{txt} 62{c |} {space 3} {res} .00161242 {space 3} {res} .39789797 {space 3} {res} .06616937
{txt} 63{c |} {space 3} {res} .00146917 {space 3} {res} .39788795 {space 3} {res} .0662119
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} .47002812 {space 3} {res} .68765443 {space 3} {res} .1373409
{txt} 2{c |} {space 3} {res} .42827212 {space 3} {res} .65513813 {space 3} {res} .13755403
{txt} 3{c |} {space 3} {res} .3902256 {space 3} {res} .61330573 {space 3} {res} .12760865
{txt} 4{c |} {space 3} {res} .35555903 {space 3} {res} .57588694 {space 3} {res} .11700443
{txt} 5{c |} {space 3} {res} .32397215 {space 3} {res} .54476261 {space 3} {res} .10768145
{txt} 6{c |} {space 3} {res} .29519136 {space 3} {res} .51886926 {space 3} {res} .09948626
{txt} 7{c |} {space 3} {res} .26896737 {space 3} {res} .49790373 {space 3} {res} .09268422
{txt} 8{c |} {space 3} {res} .24507305 {space 3} {res} .48106487 {space 3} {res} .08704268
{txt} 9{c |} {space 3} {res} .22330144 {space 3} {res} .46757902 {space 3} {res} .08192997
{txt} 10{c |} {space 3} {res} .20346395 {space 3} {res} .4562232 {space 3} {res} .07754346
{txt} 11{c |} {space 3} {res} .18538878 {space 3} {res} .44550619 {space 3} {res} .07376981 ^
{txt} 12{c |} {space 3} {res} .16891935 {space 3} {res} .43595363 {space 3} {res} .07036464
{txt} 13{c |} {space 3} {res} .15391302 {space 3} {res} .42657658 {space 3} {res} .06740889
{txt} 14{c |} {space 3} {res} .14023981 {space 3} {res} .41860881 {space 3} {res} .06487241
{txt} 15{c |} {space 3} {res} .12778129 {space 3} {res} .41202072 {space 3} {res} .06265271
{txt} 16{c |} {space 3} {res} .11642955 {space 3} {res} .40628874 {space 3} {res} .06067793
{txt} 17{c |} {space 3} {res} .10608627 {space 3} {res} .40150317 {space 3} {res} .05894068
{txt} 18{c |} {space 3} {res} .09666186 {space 3} {res} .39759331 {space 3} {res} .0573977
{txt} 19{c |} {space 3} {res} .08807469 {space 3} {res} .39500474 {space 3} {res} .05608341
{txt} 20{c |} {space 3} {res} .08025038 {space 3} {res} .3939009 {space 3} {res} .05507944 *
{txt} 21{c |} {space 3} {res} .07312115 {space 3} {res} .39424725 {space 3} {res} .05446178
{txt} 22{c |} {space 3} {res} .06662527 {space 3} {res} .39521599 {space 3} {res} .05405737
{txt} 23{c |} {space 3} {res} .06070647 {space 3} {res} .39634974 {space 3} {res} .05384646
{txt} 24{c |} {space 3} {res} .05531347 {space 3} {res} .39813019 {space 3} {res} .05396025
{txt} 25{c |} {space 3} {res} .05039957 {space 3} {res} .40007771 {space 3} {res} .05454916
{txt} 26{c |} {space 3} {res} .04592222 {space 3} {res} .40183114 {space 3} {res} .05526845
{txt} 27{c |} {space 3} {res} .04184261 {space 3} {res} .40326722 {space 3} {res} .05607408
{txt} 28{c |} {space 3} {res} .03812543 {space 3} {res} .40401502 {space 3} {res} .05664212
{txt} 29{c |} {space 3} {res} .03473847 {space 3} {res} .40467183 {space 3} {res} .05734232
{txt} 30{c |} {space 3} {res} .0316524 {space 3} {res} .40477347 {space 3} {res} .05819792
{txt} 31{c |} {space 3} {res} .02884049 {space 3} {res} .40500933 {space 3} {res} .05900882
{txt} 32{c |} {space 3} {res} .02627838 {space 3} {res} .40521778 {space 3} {res} .05969353
{txt} 33{c |} {space 3} {res} .02394388 {space 3} {res} .40534316 {space 3} {res} .06023307
{txt} 34{c |} {space 3} {res} .02181677 {space 3} {res} .4046186 {space 3} {res} .0604313
{txt} 35{c |} {space 3} {res} .01987863 {space 3} {res} .40384936 {space 3} {res} .06073578
{txt} 36{c |} {space 3} {res} .01811267 {space 3} {res} .40312431 {space 3} {res} .06106187
{txt} 37{c |} {space 3} {res} .01650359 {space 3} {res} .40254831 {space 3} {res} .06138569
{txt} 38{c |} {space 3} {res} .01503746 {space 3} {res} .40209645 {space 3} {res} .06170245
{txt} 39{c |} {space 3} {res} .01370157 {space 3} {res} .40173272 {space 3} {res} .0620117
{txt} 40{c |} {space 3} {res} .01248436 {space 3} {res} .40142526 {space 3} {res} .06231409
{txt} 41{c |} {space 3} {res} .01137528 {space 3} {res} .40110867 {space 3} {res} .06262028
{txt} 42{c |} {space 3} {res} .01036473 {space 3} {res} .40069569 {space 3} {res} .06294802
{txt} 43{c |} {space 3} {res} .00944396 {space 3} {res} .40034997 {space 3} {res} .06325382
{txt} 44{c |} {space 3} {res} .00860498 {space 3} {res} .40006034 {space 3} {res} .06353825
{txt} 45{c |} {space 3} {res} .00784054 {space 3} {res} .3998175 {space 3} {res} .06380212
{txt} 46{c |} {space 3} {res} .00714401 {space 3} {res} .39961373 {space 3} {res} .06404637
{txt} 47{c |} {space 3} {res} .00650936 {space 3} {res} .39944258 {space 3} {res} .06427203
{txt} 48{c |} {space 3} {res} .00593108 {space 3} {res} .39925579 {space 3} {res} .06447205
{txt} 49{c |} {space 3} {res} .00540418 {space 3} {res} .39907614 {space 3} {res} .06465322
{txt} 50{c |} {space 3} {res} .00492409 {space 3} {res} .39892114 {space 3} {res} .06482056
{txt} 51{c |} {space 3} {res} .00448665 {space 3} {res} .39878714 {space 3} {res} .0649749
{txt} 52{c |} {space 3} {res} .00408806 {space 3} {res} .39867103 {space 3} {res} .06511705
{txt} 53{c |} {space 3} {res} .00372489 {space 3} {res} .39857021 {space 3} {res} .06524781
{txt} 54{c |} {space 3} {res} .00339398 {space 3} {res} .39848247 {space 3} {res} .06536799
{txt} 55{c |} {space 3} {res} .00309247 {space 3} {res} .39840596 {space 3} {res} .06547832
{txt} 56{c |} {space 3} {res} .00281774 {space 3} {res} .3983391 {space 3} {res} .06557955
{txt} 57{c |} {space 3} {res} .00256742 {space 3} {res} .39828054 {space 3} {res} .06567235
{txt} 58{c |} {space 3} {res} .00233934 {space 3} {res} .39822914 {space 3} {res} .06575737
{txt} 59{c |} {space 3} {res} .00213152 {space 3} {res} .39818394 {space 3} {res} .06583523
{txt} 60{c |} {space 3} {res} .00194216 {space 3} {res} .39814411 {space 3} {res} .06590648
{txt} 61{c |} {space 3} {res} .00176963 {space 3} {res} .39810893 {space 3} {res} .06597167
{txt} 62{c |} {space 3} {res} .00161242 {space 3} {res} .39807782 {space 3} {res} .06603128
{txt} 63{c |} {space 3} {res} .00146917 {space 3} {res} .39805024 {space 3} {res} .06608578
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
Cross-validation over alpha (0 .3 .7 1).
{col 10}alpha {c |} lopt*{col 30} Minimum MSPE
{col 4}{hline 12}{c +}{hline 28}
{res}{col 10}0.000{txt}{col 16}{c |}{res}{col 17} .10608627{col 30} .39020487{txt}{col 42}#
{res}{col 10}0.300{txt}{col 16}{c |}{res}{col 17} .18538878{col 30} .39719435
{col 10}0.700{txt}{col 16}{c |}{res}{col 17} .10608627{col 30} .39420819
{col 10}1.000{txt}{col 16}{c |}{res}{col 17} .08025038{col 30} .3939009
{txt}* lambda value that minimizes MSPE for a given alpha
# alpha value that minimizes MSPE
Estimate lasso with lambda=.47 (lse) and alpha=0.
{res}
{txt}{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Ridge Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.2170410 0.3897536
{txt}{space 10}lweight {c |}{col 21}{res} 0.4973051 0.7911376
{txt}{space 14}age {c |}{col 21}{res} -0.0039816 -0.0203522
{txt}{space 13}lbph {c |}{col 21}{res} 0.0775598 0.1026400
{txt}{space 14}svi {c |}{col 21}{res} -0.0935545 -0.2764415
{txt}{space 14}lcp {c |}{col 21}{res} 0.0076792 -0.0959183
{txt}{space 10}gleason {c |}{col 21}{res} 0.1359352 0.2326491
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0020570 0.0026209
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} -0.7078928 -1.5876684
{txt}{hline 18}{c BT}{hline 32}
Use e(b) from previous lasso2 estimation (lambda=.4700281188547001).
(69 missing values generated)
{res}
{txt}{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Ridge Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.2170410 0.3897536
{txt}{space 10}lweight {c |}{col 21}{res} 0.4973051 0.7911376
{txt}{space 14}age {c |}{col 21}{res} -0.0039816 -0.0203522
{txt}{space 13}lbph {c |}{col 21}{res} 0.0775598 0.1026400
{txt}{space 14}svi {c |}{col 21}{res} -0.0935545 -0.2764415
{txt}{space 14}lcp {c |}{col 21}{res} 0.0076792 -0.0959183
{txt}{space 10}gleason {c |}{col 21}{res} 0.1359352 0.2326491
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0020570 0.0026209
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} -0.7078928 -1.5876684
{txt}{hline 18}{c BT}{hline 32}
Use e(b) from previous lasso2 estimation (lambda=.4700281188547001).
(69 missing values generated)
mreldif=0. tolerance = .01
{res}
{txt}__000000[1,9]
lcavol lweight age lbph svi lcp
y1 {res} .21704097 .4973051 -.00398162 .07755978 -.09355452 .00767922
{txt} gleason pgg45 _cons
y1 {res} .1359352 .00205695 -.70789276
{reset}{res}
{txt}__000001[1,9]
lcavol lweight age lbph svi lcp
y1 {res} .21704097 .4973051 -.00398162 .07755978 -.09355452 .00767922
{txt} gleason pgg45 _cons
y1 {res} .1359352 .00205695 -.70789276
{reset}
K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 64.86388 {space 3} {res} .73815 {space 3} {res} .13934819
{txt} 2{c |} {space 3} {res} 59.101552 {space 3} {res} .72696279 {space 3} {res} .13684858
{txt} 3{c |} {space 3} {res} 53.851133 {space 3} {res} .6911905 {space 3} {res} .13033704
{txt} 4{c |} {space 3} {res} 49.067147 {space 3} {res} .65516965 {space 3} {res} .12292271
{txt} 5{c |} {space 3} {res} 44.708157 {space 3} {res} .61856766 {space 3} {res} .11453878
{txt} 6{c |} {space 3} {res} 40.736407 {space 3} {res} .58831 {space 3} {res} .1077572
{txt} 7{c |} {space 3} {res} 37.117497 {space 3} {res} .56330798 {space 3} {res} .10240623
{txt} 8{c |} {space 3} {res} 33.820081 {space 3} {res} .54289378 {space 3} {res} .09839534 ^
{txt} 9{c |} {space 3} {res} 30.815598 {space 3} {res} .52636626 {space 3} {res} .0955039
{txt} 10{c |} {space 3} {res} 28.078025 {space 3} {res} .51313142 {space 3} {res} .09344308
{txt} 11{c |} {space 3} {res} 25.583651 {space 3} {res} .50234616 {space 3} {res} .09222386
{txt} 12{c |} {space 3} {res} 23.31087 {space 3} {res} .49347152 {space 3} {res} .0916299
{txt} 13{c |} {space 3} {res} 21.239997 {space 3} {res} .48604068 {space 3} {res} .0914002
{txt} 14{c |} {space 3} {res} 19.353094 {space 3} {res} .47998464 {space 3} {res} .09145944
{txt} 15{c |} {space 3} {res} 17.633818 {space 3} {res} .47423991 {space 3} {res} .0914453
{txt} 16{c |} {space 3} {res} 16.067278 {space 3} {res} .46906988 {space 3} {res} .09158127
{txt} 17{c |} {space 3} {res} 14.639906 {space 3} {res} .46489735 {space 3} {res} .09190217
{txt} 18{c |} {space 3} {res} 13.339337 {space 3} {res} .4614885 {space 3} {res} .09233757
{txt} 19{c |} {space 3} {res} 12.154307 {space 3} {res} .45850261 {space 3} {res} .09279684
{txt} 20{c |} {space 3} {res} 11.074552 {space 3} {res} .4561127 {space 3} {res} .09333192
{txt} 21{c |} {space 3} {res} 10.090719 {space 3} {res} .45430203 {space 3} {res} .09393271
{txt} 22{c |} {space 3} {res} 9.1942875 {space 3} {res} .45408009 {space 3} {res} .09444503 *
{txt} 23{c |} {space 3} {res} 8.3774923 {space 3} {res} .45520803 {space 3} {res} .0947816
{txt} 24{c |} {space 3} {res} 7.633259 {space 3} {res} .45659624 {space 3} {res} .09510214
{txt} 25{c |} {space 3} {res} 6.9551413 {space 3} {res} .45813535 {space 3} {res} .09541936
{txt} 26{c |} {space 3} {res} 6.3372657 {space 3} {res} .45929872 {space 3} {res} .09575475
{txt} 27{c |} {space 3} {res} 5.7742805 {space 3} {res} .45997826 {space 3} {res} .0960196
{txt} 28{c |} {space 3} {res} 5.2613093 {space 3} {res} .46072422 {space 3} {res} .09626595
{txt} 29{c |} {space 3} {res} 4.7939091 {space 3} {res} .46123203 {space 3} {res} .09614638
{txt} 30{c |} {space 3} {res} 4.3680314 {space 3} {res} .46142682 {space 3} {res} .09580863
{txt} 31{c |} {space 3} {res} 3.9799876 {space 3} {res} .4610857 {space 3} {res} .09543152
{txt} 32{c |} {space 3} {res} 3.6264164 {space 3} {res} .46083084 {space 3} {res} .09510119
{txt} 33{c |} {space 3} {res} 3.3042556 {space 3} {res} .46054012 {space 3} {res} .09465183
{txt} 34{c |} {space 3} {res} 3.0107146 {space 3} {res} .45998373 {space 3} {res} .09434707
{txt} 35{c |} {space 3} {res} 2.743251 {space 3} {res} .45951242 {space 3} {res} .09412049
{txt} 36{c |} {space 3} {res} 2.4995482 {space 3} {res} .45892324 {space 3} {res} .09398604
{txt} 37{c |} {space 3} {res} 2.2774952 {space 3} {res} .45831124 {space 3} {res} .09388383
{txt} 38{c |} {space 3} {res} 2.0751688 {space 3} {res} .45780864 {space 3} {res} .09380486
{txt} 39{c |} {space 3} {res} 1.8908165 {space 3} {res} .45735658 {space 3} {res} .09376111
{txt} 40{c |} {space 3} {res} 1.7228416 {space 3} {res} .45700626 {space 3} {res} .09372764
{txt} 41{c |} {space 3} {res} 1.5697891 {space 3} {res} .45673819 {space 3} {res} .0937025
{txt} 42{c |} {space 3} {res} 1.4303334 {space 3} {res} .45646934 {space 3} {res} .09362726
{txt} 43{c |} {space 3} {res} 1.3032665 {space 3} {res} .45609866 {space 3} {res} .09342596
{txt} 44{c |} {space 3} {res} 1.1874879 {space 3} {res} .45579166 {space 3} {res} .09324682
{txt} 45{c |} {space 3} {res} 1.0819947 {space 3} {res} .45553748 {space 3} {res} .09308717
{txt} 46{c |} {space 3} {res} .98587331 {space 3} {res} .45532708 {space 3} {res} .09294468
{txt} 47{c |} {space 3} {res} .89829104 {space 3} {res} .45515297 {space 3} {res} .09281735
{txt} 48{c |} {space 3} {res} .81848934 {space 3} {res} .45500894 {space 3} {res} .09270341
{txt} 49{c |} {space 3} {res} .745777 {space 3} {res} .45488984 {space 3} {res} .09260133
{txt} 50{c |} {space 3} {res} .67952423 {space 3} {res} .45479139 {space 3} {res} .09250976
{txt} 51{c |} {space 3} {res} .61915717 {space 3} {res} .45471005 {space 3} {res} .09242754
{txt} 52{c |} {space 3} {res} .56415295 {space 3} {res} .45464287 {space 3} {res} .09235363
{txt} 53{c |} {space 3} {res} .51403516 {space 3} {res} .45458743 {space 3} {res} .09228712
{txt} 54{c |} {space 3} {res} .46836969 {space 3} {res} .4545417 {space 3} {res} .09222722
{txt} 55{c |} {space 3} {res} .42676102 {space 3} {res} .454504 {space 3} {res} .09217322
{txt} 56{c |} {space 3} {res} .38884875 {space 3} {res} .45447295 {space 3} {res} .09212451
{txt} 57{c |} {space 3} {res} .3543045 {space 3} {res} .4544474 {space 3} {res} .09208052
{txt} 58{c |} {space 3} {res} .32282906 {space 3} {res} .45442639 {space 3} {res} .09204078
{txt} 59{c |} {space 3} {res} .29414982 {space 3} {res} .45440914 {space 3} {res} .09200485
{txt} 60{c |} {space 3} {res} .26801836 {space 3} {res} .45439498 {space 3} {res} .09197234
{txt} 61{c |} {space 3} {res} .24420835 {space 3} {res} .45438338 {space 3} {res} .09194291
{txt} 62{c |} {space 3} {res} .22251355 {space 3} {res} .4543739 {space 3} {res} .09191626
{txt} 63{c |} {space 3} {res} .20274606 {space 3} {res} .45436615 {space 3} {res} .09189211
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
Estimate lasso with lambda=33.82 (lse).
{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.1848622 0.3782994
{txt}{space 10}lweight {c |}{col 21}{res} 0.3581076 0.8391637
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} 0.5029428 -1.3919237
{txt}{hline 18}{c BT}{hline 32}
Use e(b) from previous lasso2 estimation (lambda=33.82008100076).
(69 missing values generated)
{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.1848622 0.3782994
{txt}{space 10}lweight {c |}{col 21}{res} 0.3581076 0.8391637
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} 0.5029428 -1.3919237
{txt}{hline 18}{c BT}{hline 32}
Use e(b) from previous lasso2 estimation (lambda=33.82008100076).
(69 missing values generated)
mreldif=0. tolerance = .01
{res}
{txt}__000000[1,3]
lcavol lweight _cons
y1 {res} .18486224 .35810765 .50294277
{reset}{res}
{txt}__000001[1,3]
lcavol lweight _cons
y1 {res} .18486224 .35810765 .50294277
{reset}
K-fold cross-validation with 10 folds. Elastic net with alpha=0.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} .47002812 {space 3} {res} .44726584 {space 3} {res} .07065653 ^
{txt} 2{c |} {space 3} {res} .42827212 {space 3} {res} .44571884 {space 3} {res} .07036734
{txt} 3{c |} {space 3} {res} .3902256 {space 3} {res} .44442816 {space 3} {res} .07021443
{txt} 4{c |} {space 3} {res} .35555903 {space 3} {res} .44338599 {space 3} {res} .07018872
{txt} 5{c |} {space 3} {res} .32397215 {space 3} {res} .44258269 {space 3} {res} .07028015
{txt} 6{c |} {space 3} {res} .29519136 {space 3} {res} .44200686 {space 3} {res} .07047791
{txt} 7{c |} {space 3} {res} .26896737 {space 3} {res} .44164545 {space 3} {res} .07077066
{txt} 8{c |} {space 3} {res} .24507305 {space 3} {res} .44148392 {space 3} {res} .07114681 *
{txt} 9{c |} {space 3} {res} .22330144 {space 3} {res} .4415065 {space 3} {res} .07159477
{txt} 10{c |} {space 3} {res} .20346395 {space 3} {res} .44169647 {space 3} {res} .07210312
{txt} 11{c |} {space 3} {res} .18538878 {space 3} {res} .44203645 {space 3} {res} .07266082
{txt} 12{c |} {space 3} {res} .16891935 {space 3} {res} .44250872 {space 3} {res} .07325742
{txt} 13{c |} {space 3} {res} .15391302 {space 3} {res} .44309556 {space 3} {res} .07388311
{txt} 14{c |} {space 3} {res} .14023981 {space 3} {res} .44377954 {space 3} {res} .07452885
{txt} 15{c |} {space 3} {res} .12778129 {space 3} {res} .44454376 {space 3} {res} .07518646
{txt} 16{c |} {space 3} {res} .11642955 {space 3} {res} .44537212 {space 3} {res} .07584861
{txt} 17{c |} {space 3} {res} .10608627 {space 3} {res} .44624952 {space 3} {res} .07650884
{txt} 18{c |} {space 3} {res} .09666186 {space 3} {res} .44716196 {space 3} {res} .07716156
{txt} 19{c |} {space 3} {res} .08807469 {space 3} {res} .4480967 {space 3} {res} .07780203
{txt} 20{c |} {space 3} {res} .08025038 {space 3} {res} .44904233 {space 3} {res} .07842629
{txt} 21{c |} {space 3} {res} .07312115 {space 3} {res} .44998873 {space 3} {res} .07903111
{txt} 22{c |} {space 3} {res} .06662527 {space 3} {res} .45092712 {space 3} {res} .07961396
{txt} 23{c |} {space 3} {res} .06070647 {space 3} {res} .45185003 {space 3} {res} .0801729
{txt} 24{c |} {space 3} {res} .05531347 {space 3} {res} .45275119 {space 3} {res} .08070656
{txt} 25{c |} {space 3} {res} .05039957 {space 3} {res} .45362549 {space 3} {res} .08121404
{txt} 26{c |} {space 3} {res} .04592222 {space 3} {res} .45446888 {space 3} {res} .08169486
{txt} 27{c |} {space 3} {res} .04184261 {space 3} {res} .45527827 {space 3} {res} .08214892
{txt} 28{c |} {space 3} {res} .03812543 {space 3} {res} .45605143 {space 3} {res} .08257639
{txt} 29{c |} {space 3} {res} .03473847 {space 3} {res} .45678687 {space 3} {res} .08297771
{txt} 30{c |} {space 3} {res} .0316524 {space 3} {res} .45748378 {space 3} {res} .08335353
{txt} 31{c |} {space 3} {res} .02884049 {space 3} {res} .4581419 {space 3} {res} .08370464
{txt} 32{c |} {space 3} {res} .02627838 {space 3} {res} .45876142 {space 3} {res} .08403197
{txt} 33{c |} {space 3} {res} .02394388 {space 3} {res} .45934295 {space 3} {res} .08433652
{txt} 34{c |} {space 3} {res} .02181677 {space 3} {res} .45988739 {space 3} {res} .08461939
{txt} 35{c |} {space 3} {res} .01987863 {space 3} {res} .46039589 {space 3} {res} .08488168
{txt} 36{c |} {space 3} {res} .01811267 {space 3} {res} .46086981 {space 3} {res} .08512452
{txt} 37{c |} {space 3} {res} .01650359 {space 3} {res} .46131061 {space 3} {res} .08534904
{txt} 38{c |} {space 3} {res} .01503746 {space 3} {res} .46171988 {space 3} {res} .08555637
{txt} 39{c |} {space 3} {res} .01370157 {space 3} {res} .46209924 {space 3} {res} .0857476
{txt} 40{c |} {space 3} {res} .01248436 {space 3} {res} .46245034 {space 3} {res} .08592379
{txt} 41{c |} {space 3} {res} .01137528 {space 3} {res} .46277486 {space 3} {res} .08608598
{txt} 42{c |} {space 3} {res} .01036473 {space 3} {res} .46307442 {space 3} {res} .08623513
{txt} 43{c |} {space 3} {res} .00944396 {space 3} {res} .46335063 {space 3} {res} .08637219
{txt} 44{c |} {space 3} {res} .00860498 {space 3} {res} .46360504 {space 3} {res} .08649805
{txt} 45{c |} {space 3} {res} .00784054 {space 3} {res} .46383915 {space 3} {res} .08661354
{txt} 46{c |} {space 3} {res} .00714401 {space 3} {res} .4640544 {space 3} {res} .08671945
{txt} 47{c |} {space 3} {res} .00650936 {space 3} {res} .46425214 {space 3} {res} .08681652
{txt} 48{c |} {space 3} {res} .00593108 {space 3} {res} .46443367 {space 3} {res} .08690544
{txt} 49{c |} {space 3} {res} .00540418 {space 3} {res} .4646002 {space 3} {res} .08698686
{txt} 50{c |} {space 3} {res} .00492409 {space 3} {res} .46475289 {space 3} {res} .08706138
{txt} 51{c |} {space 3} {res} .00448665 {space 3} {res} .46489281 {space 3} {res} .08712956
{txt} 52{c |} {space 3} {res} .00408806 {space 3} {res} .46502096 {space 3} {res} .08719191
{txt} 53{c |} {space 3} {res} .00372489 {space 3} {res} .46513828 {space 3} {res} .08724892
{txt} 54{c |} {space 3} {res} .00339398 {space 3} {res} .46524564 {space 3} {res} .08730102
{txt} 55{c |} {space 3} {res} .00309247 {space 3} {res} .46534384 {space 3} {res} .08734863
{txt} 56{c |} {space 3} {res} .00281774 {space 3} {res} .46543364 {space 3} {res} .08739212
{txt} 57{c |} {space 3} {res} .00256742 {space 3} {res} .46551573 {space 3} {res} .08743184
{txt} 58{c |} {space 3} {res} .00233934 {space 3} {res} .46559075 {space 3} {res} .08746811
{txt} 59{c |} {space 3} {res} .00213152 {space 3} {res} .46565929 {space 3} {res} .08750122
{txt} 60{c |} {space 3} {res} .00194216 {space 3} {res} .46572189 {space 3} {res} .08753144
{txt} 61{c |} {space 3} {res} .00176963 {space 3} {res} .46577906 {space 3} {res} .08755902
{txt} 62{c |} {space 3} {res} .00161242 {space 3} {res} .46583126 {space 3} {res} .08758419
{txt} 63{c |} {space 3} {res} .00146917 {space 3} {res} .46587891 {space 3} {res} .08760715
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{err}Warning: lse is at the limit of the lambda range.
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=.3.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} .47002812 {space 3} {res} .4807686 {space 3} {res} .08462549 ^
{txt} 2{c |} {space 3} {res} .42827212 {space 3} {res} .47256051 {space 3} {res} .08070791
{txt} 3{c |} {space 3} {res} .3902256 {space 3} {res} .46563366 {space 3} {res} .07728267
{txt} 4{c |} {space 3} {res} .35555903 {space 3} {res} .45983105 {space 3} {res} .0743409
{txt} 5{c |} {space 3} {res} .32397215 {space 3} {res} .45500889 {space 3} {res} .07186538
{txt} 6{c |} {space 3} {res} .29519136 {space 3} {res} .45103664 {space 3} {res} .06983106
{txt} 7{c |} {space 3} {res} .26896737 {space 3} {res} .44779678 {space 3} {res} .06820608
{txt} 8{c |} {space 3} {res} .24507305 {space 3} {res} .44568547 {space 3} {res} .06710056
{txt} 9{c |} {space 3} {res} .22330144 {space 3} {res} .44446595 {space 3} {res} .06642088
{txt} 10{c |} {space 3} {res} .20346395 {space 3} {res} .44367255 {space 3} {res} .06600318
{txt} 11{c |} {space 3} {res} .18538878 {space 3} {res} .44354984 {space 3} {res} .06580573 *
{txt} 12{c |} {space 3} {res} .16891935 {space 3} {res} .44409278 {space 3} {res} .06585495
{txt} 13{c |} {space 3} {res} .15391302 {space 3} {res} .44466433 {space 3} {res} .06626105
{txt} 14{c |} {space 3} {res} .14023981 {space 3} {res} .44536206 {space 3} {res} .0668258
{txt} 15{c |} {space 3} {res} .12778129 {space 3} {res} .44628011 {space 3} {res} .06748795
{txt} 16{c |} {space 3} {res} .11642955 {space 3} {res} .44675365 {space 3} {res} .06818043
{txt} 17{c |} {space 3} {res} .10608627 {space 3} {res} .44710255 {space 3} {res} .06876427
{txt} 18{c |} {space 3} {res} .09666186 {space 3} {res} .44828134 {space 3} {res} .06965561
{txt} 19{c |} {space 3} {res} .08807469 {space 3} {res} .44959762 {space 3} {res} .07062134
{txt} 20{c |} {space 3} {res} .08025038 {space 3} {res} .45068917 {space 3} {res} .071747
{txt} 21{c |} {space 3} {res} .07312115 {space 3} {res} .45114911 {space 3} {res} .07260245
{txt} 22{c |} {space 3} {res} .06662527 {space 3} {res} .45154277 {space 3} {res} .07344089
{txt} 23{c |} {space 3} {res} .06070647 {space 3} {res} .45201081 {space 3} {res} .07430661
{txt} 24{c |} {space 3} {res} .05531347 {space 3} {res} .45244205 {space 3} {res} .07521906
{txt} 25{c |} {space 3} {res} .05039957 {space 3} {res} .45297301 {space 3} {res} .07610437
{txt} 26{c |} {space 3} {res} .04592222 {space 3} {res} .45357727 {space 3} {res} .07695654
{txt} 27{c |} {space 3} {res} .04184261 {space 3} {res} .45423254 {space 3} {res} .07777138
{txt} 28{c |} {space 3} {res} .03812543 {space 3} {res} .45492028 {space 3} {res} .07854614
{txt} 29{c |} {space 3} {res} .03473847 {space 3} {res} .45562517 {space 3} {res} .07927923
{txt} 30{c |} {space 3} {res} .0316524 {space 3} {res} .45633475 {space 3} {res} .07997
{txt} 31{c |} {space 3} {res} .02884049 {space 3} {res} .45703904 {space 3} {res} .08061856
{txt} 32{c |} {space 3} {res} .02627838 {space 3} {res} .45773015 {space 3} {res} .08122555
{txt} 33{c |} {space 3} {res} .02394388 {space 3} {res} .458402 {space 3} {res} .08179206
{txt} 34{c |} {space 3} {res} .02181677 {space 3} {res} .45905006 {space 3} {res} .08231951
{txt} 35{c |} {space 3} {res} .01987863 {space 3} {res} .45967102 {space 3} {res} .08280952
{txt} 36{c |} {space 3} {res} .01811267 {space 3} {res} .46024884 {space 3} {res} .08325919
{txt} 37{c |} {space 3} {res} .01650359 {space 3} {res} .46068402 {space 3} {res} .08363694
{txt} 38{c |} {space 3} {res} .01503746 {space 3} {res} .46109797 {space 3} {res} .08398602
{txt} 39{c |} {space 3} {res} .01370157 {space 3} {res} .46148987 {space 3} {res} .08430819
{txt} 40{c |} {space 3} {res} .01248436 {space 3} {res} .46185936 {space 3} {res} .08460516
{txt} 41{c |} {space 3} {res} .01137528 {space 3} {res} .46220647 {space 3} {res} .0848786
{txt} 42{c |} {space 3} {res} .01036473 {space 3} {res} .46253153 {space 3} {res} .08513014
{txt} 43{c |} {space 3} {res} .00944396 {space 3} {res} .46283508 {space 3} {res} .08536133
{txt} 44{c |} {space 3} {res} .00860498 {space 3} {res} .46311785 {space 3} {res} .08557364
{txt} 45{c |} {space 3} {res} .00784054 {space 3} {res} .46338069 {space 3} {res} .08576847
{txt} 46{c |} {space 3} {res} .00714401 {space 3} {res} .46362452 {space 3} {res} .08594716
{txt} 47{c |} {space 3} {res} .00650936 {space 3} {res} .46385033 {space 3} {res} .08611093
{txt} 48{c |} {space 3} {res} .00593108 {space 3} {res} .46405911 {space 3} {res} .08626095
{txt} 49{c |} {space 3} {res} .00540418 {space 3} {res} .46425189 {space 3} {res} .08639831
{txt} 50{c |} {space 3} {res} .00492409 {space 3} {res} .46442967 {space 3} {res} .08652403
{txt} 51{c |} {space 3} {res} .00448665 {space 3} {res} .46459342 {space 3} {res} .08663904
{txt} 52{c |} {space 3} {res} .00408806 {space 3} {res} .46474411 {space 3} {res} .08674422
{txt} 53{c |} {space 3} {res} .00372489 {space 3} {res} .46488264 {space 3} {res} .08684037
{txt} 54{c |} {space 3} {res} .00339398 {space 3} {res} .4650099 {space 3} {res} .08692825
{txt} 55{c |} {space 3} {res} .00309247 {space 3} {res} .4651267 {space 3} {res} .08700855
{txt} 56{c |} {space 3} {res} .00281774 {space 3} {res} .46523385 {space 3} {res} .0870819
{txt} 57{c |} {space 3} {res} .00256742 {space 3} {res} .46533207 {space 3} {res} .08714888
{txt} 58{c |} {space 3} {res} .00233934 {space 3} {res} .46542205 {space 3} {res} .08721004
{txt} 59{c |} {space 3} {res} .00213152 {space 3} {res} .46550446 {space 3} {res} .08726587
{txt} 60{c |} {space 3} {res} .00194216 {space 3} {res} .46557989 {space 3} {res} .08731683
{txt} 61{c |} {space 3} {res} .00176963 {space 3} {res} .4656489 {space 3} {res} .08736334
{txt} 62{c |} {space 3} {res} .00161242 {space 3} {res} .46571203 {space 3} {res} .08740578
{txt} 63{c |} {space 3} {res} .00146917 {space 3} {res} .46576974 {space 3} {res} .0874445
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{err}Warning: lse is at the limit of the lambda range.
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=.7.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} .47002812 {space 3} {res} .58619016 {space 3} {res} .12810454
{txt} 2{c |} {space 3} {res} .42827212 {space 3} {res} .56107624 {space 3} {res} .11832598
{txt} 3{c |} {space 3} {res} .3902256 {space 3} {res} .54039885 {space 3} {res} .10991634
{txt} 4{c |} {space 3} {res} .35555903 {space 3} {res} .52456909 {space 3} {res} .10265959
{txt} 5{c |} {space 3} {res} .32397215 {space 3} {res} .51165111 {space 3} {res} .0961521 ^
{txt} 6{c |} {space 3} {res} .29519136 {space 3} {res} .50061598 {space 3} {res} .09049654
{txt} 7{c |} {space 3} {res} .26896737 {space 3} {res} .49111134 {space 3} {res} .08554142
{txt} 8{c |} {space 3} {res} .24507305 {space 3} {res} .48239203 {space 3} {res} .0814258
{txt} 9{c |} {space 3} {res} .22330144 {space 3} {res} .47510973 {space 3} {res} .0779965
{txt} 10{c |} {space 3} {res} .20346395 {space 3} {res} .46904459 {space 3} {res} .07499795
{txt} 11{c |} {space 3} {res} .18538878 {space 3} {res} .46405149 {space 3} {res} .07247272
{txt} 12{c |} {space 3} {res} .16891935 {space 3} {res} .46009631 {space 3} {res} .07050059
{txt} 13{c |} {space 3} {res} .15391302 {space 3} {res} .45699556 {space 3} {res} .06901584
{txt} 14{c |} {space 3} {res} .14023981 {space 3} {res} .45397225 {space 3} {res} .06777763
{txt} 15{c |} {space 3} {res} .12778129 {space 3} {res} .45120778 {space 3} {res} .06680757
{txt} 16{c |} {space 3} {res} .11642955 {space 3} {res} .44953485 {space 3} {res} .06628193
{txt} 17{c |} {space 3} {res} .10608627 {space 3} {res} .44871007 {space 3} {res} .06610389
{txt} 18{c |} {space 3} {res} .09666186 {space 3} {res} .44833137 {space 3} {res} .06613475 *
{txt} 19{c |} {space 3} {res} .08807469 {space 3} {res} .44869745 {space 3} {res} .0663539
{txt} 20{c |} {space 3} {res} .08025038 {space 3} {res} .44970847 {space 3} {res} .06688917
{txt} 21{c |} {space 3} {res} .07312115 {space 3} {res} .45065363 {space 3} {res} .06765046
{txt} 22{c |} {space 3} {res} .06662527 {space 3} {res} .45153455 {space 3} {res} .06848568
{txt} 23{c |} {space 3} {res} .06070647 {space 3} {res} .45271177 {space 3} {res} .06942702
{txt} 24{c |} {space 3} {res} .05531347 {space 3} {res} .45257275 {space 3} {res} .07000925
{txt} 25{c |} {space 3} {res} .05039957 {space 3} {res} .45243613 {space 3} {res} .0705241
{txt} 26{c |} {space 3} {res} .04592222 {space 3} {res} .45338008 {space 3} {res} .07147215
{txt} 27{c |} {space 3} {res} .04184261 {space 3} {res} .45455376 {space 3} {res} .07269662
{txt} 28{c |} {space 3} {res} .03812543 {space 3} {res} .45540524 {space 3} {res} .07378965
{txt} 29{c |} {space 3} {res} .03473847 {space 3} {res} .4559352 {space 3} {res} .07465225
{txt} 30{c |} {space 3} {res} .0316524 {space 3} {res} .45658653 {space 3} {res} .07549777
{txt} 31{c |} {space 3} {res} .02884049 {space 3} {res} .45704894 {space 3} {res} .07638579
{txt} 32{c |} {space 3} {res} .02627838 {space 3} {res} .45744487 {space 3} {res} .07725548
{txt} 33{c |} {space 3} {res} .02394388 {space 3} {res} .45779308 {space 3} {res} .07809994
{txt} 34{c |} {space 3} {res} .02181677 {space 3} {res} .45818688 {space 3} {res} .07890063
{txt} 35{c |} {space 3} {res} .01987863 {space 3} {res} .45862789 {space 3} {res} .07965063
{txt} 36{c |} {space 3} {res} .01811267 {space 3} {res} .45909868 {space 3} {res} .0803506
{txt} 37{c |} {space 3} {res} .01650359 {space 3} {res} .45958543 {space 3} {res} .08100187
{txt} 38{c |} {space 3} {res} .01503746 {space 3} {res} .46007733 {space 3} {res} .08160628
{txt} 39{c |} {space 3} {res} .01370157 {space 3} {res} .46056602 {space 3} {res} .08216596
{txt} 40{c |} {space 3} {res} .01248436 {space 3} {res} .46104515 {space 3} {res} .08268324
{txt} 41{c |} {space 3} {res} .01137528 {space 3} {res} .46151001 {space 3} {res} .08316058
{txt} 42{c |} {space 3} {res} .01036473 {space 3} {res} .4619572 {space 3} {res} .08360042
{txt} 43{c |} {space 3} {res} .00944396 {space 3} {res} .46238438 {space 3} {res} .08400522
{txt} 44{c |} {space 3} {res} .00860498 {space 3} {res} .46271952 {space 3} {res} .08435291
{txt} 45{c |} {space 3} {res} .00784054 {space 3} {res} .46297764 {space 3} {res} .08465122
{txt} 46{c |} {space 3} {res} .00714401 {space 3} {res} .46322396 {space 3} {res} .08492508
{txt} 47{c |} {space 3} {res} .00650936 {space 3} {res} .46345767 {space 3} {res} .08517631
{txt} 48{c |} {space 3} {res} .00593108 {space 3} {res} .46367834 {space 3} {res} .08540661
{txt} 49{c |} {space 3} {res} .00540418 {space 3} {res} .46388585 {space 3} {res} .08561762
{txt} 50{c |} {space 3} {res} .00492409 {space 3} {res} .46408028 {space 3} {res} .08581084
{txt} 51{c |} {space 3} {res} .00448665 {space 3} {res} .46426189 {space 3} {res} .08598768
{txt} 52{c |} {space 3} {res} .00408806 {space 3} {res} .46443109 {space 3} {res} .08614946
{txt} 53{c |} {space 3} {res} .00372489 {space 3} {res} .46458834 {space 3} {res} .08629742
{txt} 54{c |} {space 3} {res} .00339398 {space 3} {res} .46473419 {space 3} {res} .08643268
{txt} 55{c |} {space 3} {res} .00309247 {space 3} {res} .46486922 {space 3} {res} .08655629
{txt} 56{c |} {space 3} {res} .00281774 {space 3} {res} .46499403 {space 3} {res} .08666923
{txt} 57{c |} {space 3} {res} .00256742 {space 3} {res} .46510923 {space 3} {res} .08677239
{txt} 58{c |} {space 3} {res} .00233934 {space 3} {res} .46521543 {space 3} {res} .0868666
{txt} 59{c |} {space 3} {res} .00213152 {space 3} {res} .46531321 {space 3} {res} .08695262
{txt} 60{c |} {space 3} {res} .00194216 {space 3} {res} .46540316 {space 3} {res} .08703113
{txt} 61{c |} {space 3} {res} .00176963 {space 3} {res} .46548581 {space 3} {res} .0871028
{txt} 62{c |} {space 3} {res} .00161242 {space 3} {res} .46556172 {space 3} {res} .08716819
{txt} 63{c |} {space 3} {res} .00146917 {space 3} {res} .46563136 {space 3} {res} .08722786
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} .47002812 {space 3} {res} .69815481 {space 3} {res} .15163127
{txt} 2{c |} {space 3} {res} .42827212 {space 3} {res} .66932957 {space 3} {res} .15135765
{txt} 3{c |} {space 3} {res} .3902256 {space 3} {res} .6375022 {space 3} {res} .14767754
{txt} 4{c |} {space 3} {res} .35555903 {space 3} {res} .60003182 {space 3} {res} .13432424
{txt} 5{c |} {space 3} {res} .32397215 {space 3} {res} .56894123 {space 3} {res} .12262063
{txt} 6{c |} {space 3} {res} .29519136 {space 3} {res} .54436246 {space 3} {res} .11216636
{txt} 7{c |} {space 3} {res} .26896737 {space 3} {res} .5244468 {space 3} {res} .10333925
{txt} 8{c |} {space 3} {res} .24507305 {space 3} {res} .50941128 {space 3} {res} .09638042 ^
{txt} 9{c |} {space 3} {res} .22330144 {space 3} {res} .49830776 {space 3} {res} .09020357
{txt} 10{c |} {space 3} {res} .20346395 {space 3} {res} .48935447 {space 3} {res} .08495596
{txt} 11{c |} {space 3} {res} .18538878 {space 3} {res} .48204675 {space 3} {res} .08053992
{txt} 12{c |} {space 3} {res} .16891935 {space 3} {res} .47586911 {space 3} {res} .07683111
{txt} 13{c |} {space 3} {res} .15391302 {space 3} {res} .47030912 {space 3} {res} .07399968
{txt} 14{c |} {space 3} {res} .14023981 {space 3} {res} .46538509 {space 3} {res} .07179493
{txt} 15{c |} {space 3} {res} .12778129 {space 3} {res} .46149035 {space 3} {res} .07007257
{txt} 16{c |} {space 3} {res} .11642955 {space 3} {res} .45819543 {space 3} {res} .06862152
{txt} 17{c |} {space 3} {res} .10608627 {space 3} {res} .45565501 {space 3} {res} .06760599
{txt} 18{c |} {space 3} {res} .09666186 {space 3} {res} .45372367 {space 3} {res} .06695403
{txt} 19{c |} {space 3} {res} .08807469 {space 3} {res} .45232684 {space 3} {res} .0666063
{txt} 20{c |} {space 3} {res} .08025038 {space 3} {res} .45154331 {space 3} {res} .0664764
{txt} 21{c |} {space 3} {res} .07312115 {space 3} {res} .45103659 {space 3} {res} .06652145
{txt} 22{c |} {space 3} {res} .06662527 {space 3} {res} .4509109 {space 3} {res} .06667515 *
{txt} 23{c |} {space 3} {res} .06070647 {space 3} {res} .45178675 {space 3} {res} .06707184
{txt} 24{c |} {space 3} {res} .05531347 {space 3} {res} .45258315 {space 3} {res} .0678345
{txt} 25{c |} {space 3} {res} .05039957 {space 3} {res} .45348951 {space 3} {res} .06867401
{txt} 26{c |} {space 3} {res} .04592222 {space 3} {res} .45460175 {space 3} {res} .06962724
{txt} 27{c |} {space 3} {res} .04184261 {space 3} {res} .45508972 {space 3} {res} .07045032
{txt} 28{c |} {space 3} {res} .03812543 {space 3} {res} .45458988 {space 3} {res} .07093927
{txt} 29{c |} {space 3} {res} .03473847 {space 3} {res} .45447797 {space 3} {res} .07149219
{txt} 30{c |} {space 3} {res} .0316524 {space 3} {res} .45566263 {space 3} {res} .07270131
{txt} 31{c |} {space 3} {res} .02884049 {space 3} {res} .45675066 {space 3} {res} .07396821
{txt} 32{c |} {space 3} {res} .02627838 {space 3} {res} .4571526 {space 3} {res} .07483705
{txt} 33{c |} {space 3} {res} .02394388 {space 3} {res} .45770467 {space 3} {res} .07568529
{txt} 34{c |} {space 3} {res} .02181677 {space 3} {res} .45820848 {space 3} {res} .07656181
{txt} 35{c |} {space 3} {res} .01987863 {space 3} {res} .45865808 {space 3} {res} .0774122
{txt} 36{c |} {space 3} {res} .01811267 {space 3} {res} .45907697 {space 3} {res} .07825024
{txt} 37{c |} {space 3} {res} .01650359 {space 3} {res} .4594059 {space 3} {res} .07903985
{txt} 38{c |} {space 3} {res} .01503746 {space 3} {res} .45973484 {space 3} {res} .07979336
{txt} 39{c |} {space 3} {res} .01370157 {space 3} {res} .46010643 {space 3} {res} .08049433
{txt} 40{c |} {space 3} {res} .01248436 {space 3} {res} .46050468 {space 3} {res} .08114456
{txt} 41{c |} {space 3} {res} .01137528 {space 3} {res} .46091709 {space 3} {res} .08174629
{txt} 42{c |} {space 3} {res} .01036473 {space 3} {res} .461334 {space 3} {res} .08230202
{txt} 43{c |} {space 3} {res} .00944396 {space 3} {res} .46174801 {space 3} {res} .08281441
{txt} 44{c |} {space 3} {res} .00860498 {space 3} {res} .4621536 {space 3} {res} .08328616
{txt} 45{c |} {space 3} {res} .00784054 {space 3} {res} .46254669 {space 3} {res} .08371996
{txt} 46{c |} {space 3} {res} .00714401 {space 3} {res} .4629244 {space 3} {res} .08411845
{txt} 47{c |} {space 3} {res} .00650936 {space 3} {res} .46327511 {space 3} {res} .08448079
{txt} 48{c |} {space 3} {res} .00593108 {space 3} {res} .46348523 {space 3} {res} .08477022
{txt} 49{c |} {space 3} {res} .00540418 {space 3} {res} .46368773 {space 3} {res} .08503559
{txt} 50{c |} {space 3} {res} .00492409 {space 3} {res} .46388141 {space 3} {res} .08527874
{txt} 51{c |} {space 3} {res} .00448665 {space 3} {res} .4640655 {space 3} {res} .08550141
{txt} 52{c |} {space 3} {res} .00408806 {space 3} {res} .46423955 {space 3} {res} .08570521
{txt} 53{c |} {space 3} {res} .00372489 {space 3} {res} .46440338 {space 3} {res} .08589167
{txt} 54{c |} {space 3} {res} .00339398 {space 3} {res} .46455702 {space 3} {res} .08606219
{txt} 55{c |} {space 3} {res} .00309247 {space 3} {res} .46470063 {space 3} {res} .08621806
{txt} 56{c |} {space 3} {res} .00281774 {space 3} {res} .46483448 {space 3} {res} .08636052
{txt} 57{c |} {space 3} {res} .00256742 {space 3} {res} .46495893 {space 3} {res} .08649067
{txt} 58{c |} {space 3} {res} .00233934 {space 3} {res} .46507439 {space 3} {res} .08660955
{txt} 59{c |} {space 3} {res} .00213152 {space 3} {res} .46518132 {space 3} {res} .0867181
{txt} 60{c |} {space 3} {res} .00194216 {space 3} {res} .46528017 {space 3} {res} .08681721
{txt} 61{c |} {space 3} {res} .00176963 {space 3} {res} .46537143 {space 3} {res} .08690767
{txt} 62{c |} {space 3} {res} .00161242 {space 3} {res} .46545556 {space 3} {res} .08699024
{txt} 63{c |} {space 3} {res} .00146917 {space 3} {res} .46553304 {space 3} {res} .08706558
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
Cross-validation over alpha (0 .3 .7 1).
{col 10}alpha {c |} lopt*{col 30} Minimum MSPE
{col 4}{hline 12}{c +}{hline 28}
{res}{col 10}0.000{txt}{col 16}{c |}{res}{col 17} .24507305{col 30} .44148392{txt}{col 42}#
{res}{col 10}0.300{txt}{col 16}{c |}{res}{col 17} .18538878{col 30} .44354984
{col 10}0.700{txt}{col 16}{c |}{res}{col 17} .09666186{col 30} .44833137
{col 10}1.000{txt}{col 16}{c |}{res}{col 17} .06662527{col 30} .4509109
{txt}* lambda value that minimizes MSPE for a given alpha
# alpha value that minimizes MSPE
Estimate lasso with lambda=.47 (lse) and alpha=0.
{res}
{txt}{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Ridge Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.2170410 0.3897536
{txt}{space 10}lweight {c |}{col 21}{res} 0.4973051 0.7911376
{txt}{space 14}age {c |}{col 21}{res} -0.0039816 -0.0203522
{txt}{space 13}lbph {c |}{col 21}{res} 0.0775598 0.1026400
{txt}{space 14}svi {c |}{col 21}{res} -0.0935545 -0.2764415
{txt}{space 14}lcp {c |}{col 21}{res} 0.0076792 -0.0959183
{txt}{space 10}gleason {c |}{col 21}{res} 0.1359352 0.2326491
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0020570 0.0026209
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} -0.7078928 -1.5876684
{txt}{hline 18}{c BT}{hline 32}
Use e(b) from previous lasso2 estimation (lambda=.4700281188547001).
(69 missing values generated)
{res}
{txt}{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Ridge Post-est OLS
{hline 18}{c +}{hline 32}
{space 11}lcavol {c |}{col 21}{res} 0.2170410 0.3897536
{txt}{space 10}lweight {c |}{col 21}{res} 0.4973051 0.7911376
{txt}{space 14}age {c |}{col 21}{res} -0.0039816 -0.0203522
{txt}{space 13}lbph {c |}{col 21}{res} 0.0775598 0.1026400
{txt}{space 14}svi {c |}{col 21}{res} -0.0935545 -0.2764415
{txt}{space 14}lcp {c |}{col 21}{res} 0.0076792 -0.0959183
{txt}{space 10}gleason {c |}{col 21}{res} 0.1359352 0.2326491
{txt}{space 12}pgg45 {c |}{col 21}{res} 0.0020570 0.0026209
{txt}{hline 18}{c +}{hline 32}
{col 4}Partialled-out{help lasso2##examples_partialling:*}{c |}
{hline 18}{c +}{hline 32}
{space 12}_cons {c |}{col 21}{res} -0.7078928 -1.5876684
{txt}{hline 18}{c BT}{hline 32}
Use e(b) from previous lasso2 estimation (lambda=.4700281188547001).
(69 missing values generated)
mreldif=0. tolerance = .01
{res}
{txt}__000000[1,9]
lcavol lweight age lbph svi lcp
y1 {res} .21704097 .4973051 -.00398162 .07755978 -.09355452 .00767922
{txt} gleason pgg45 _cons
y1 {res} .1359352 .00205695 -.70789276
{reset}{res}
{txt}__000001[1,9]
lcavol lweight age lbph svi lcp
y1 {res} .21704097 .4973051 -.00398162 .07755978 -.09355452 .00767922
{txt} gleason pgg45 _cons
y1 {res} .1359352 .00205695 -.70789276
{reset}r; t=5.86 20:21:56
{com}. *
.
. ********************************************************************************
. *** partial ***
. ********************************************************************************
.
.
. * load example data
. insheet using "$prostate", tab clear
{txt}(11 vars, 97 obs)
r; t=0.61 20:21:56
{com}.
. cvlasso $model, partial(svi) saveest(m)
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 113.54767 {space 3} {res} .92810044 {space 3} {res} .14125823
{txt} 2{c |} {space 3} {res} 103.46041 {space 3} {res} .89743208 {space 3} {res} .13984793
{txt} 3{c |} {space 3} {res} 94.269272 {space 3} {res} .84698786 {space 3} {res} .12962102
{txt} 4{c |} {space 3} {res} 85.894649 {space 3} {res} .8034353 {space 3} {res} .12009755
{txt} 5{c |} {space 3} {res} 78.264005 {space 3} {res} .76717895 {space 3} {res} .11193551
{txt} 6{c |} {space 3} {res} 71.311247 {space 3} {res} .73687106 {space 3} {res} .10496926
{txt} 7{c |} {space 3} {res} 64.976152 {space 3} {res} .70977163 {space 3} {res} .09887212
{txt} 8{c |} {space 3} {res} 59.20385 {space 3} {res} .68491422 {space 3} {res} .09353112
{txt} 9{c |} {space 3} {res} 53.944343 {space 3} {res} .66029017 {space 3} {res} .08846888
{txt} 10{c |} {space 3} {res} 49.152076 {space 3} {res} .63675856 {space 3} {res} .08373702
{txt} 11{c |} {space 3} {res} 44.785541 {space 3} {res} .6171784 {space 3} {res} .07978601
{txt} 12{c |} {space 3} {res} 40.806917 {space 3} {res} .60088269 {space 3} {res} .07648243 ^
{txt} 13{c |} {space 3} {res} 37.181743 {space 3} {res} .5875348 {space 3} {res} .07382533
{txt} 14{c |} {space 3} {res} 33.87862 {space 3} {res} .57693934 {space 3} {res} .07171871
{txt} 15{c |} {space 3} {res} 30.868936 {space 3} {res} .5682703 {space 3} {res} .07000492
{txt} 16{c |} {space 3} {res} 28.126625 {space 3} {res} .56120868 {space 3} {res} .06876519
{txt} 17{c |} {space 3} {res} 25.627933 {space 3} {res} .55518126 {space 3} {res} .06848201
{txt} 18{c |} {space 3} {res} 23.351218 {space 3} {res} .55046904 {space 3} {res} .06858147
{txt} 19{c |} {space 3} {res} 21.27676 {space 3} {res} .54676171 {space 3} {res} .06879055
{txt} 20{c |} {space 3} {res} 19.386592 {space 3} {res} .54398718 {space 3} {res} .06907625
{txt} 21{c |} {space 3} {res} 17.66434 {space 3} {res} .54191837 {space 3} {res} .06939279
{txt} 22{c |} {space 3} {res} 16.095089 {space 3} {res} .54003365 {space 3} {res} .0696544
{txt} 23{c |} {space 3} {res} 14.665246 {space 3} {res} .53852262 {space 3} {res} .06989421
{txt} 24{c |} {space 3} {res} 13.362426 {space 3} {res} .53812578 {space 3} {res} .07012989
{txt} 25{c |} {space 3} {res} 12.175345 {space 3} {res} .53832579 {space 3} {res} .07035321
{txt} 26{c |} {space 3} {res} 11.093721 {space 3} {res} .53826037 {space 3} {res} .07056447
{txt} 27{c |} {space 3} {res} 10.108185 {space 3} {res} .53786967 {space 3} {res} .07093189
{txt} 28{c |} {space 3} {res} 9.2102017 {space 3} {res} .53713298 {space 3} {res} .07087962
{txt} 29{c |} {space 3} {res} 8.3919928 {space 3} {res} .53665065 {space 3} {res} .07106639
{txt} 30{c |} {space 3} {res} 7.6464713 {space 3} {res} .53605999 {space 3} {res} .07151172
{txt} 31{c |} {space 3} {res} 6.9671798 {space 3} {res} .53526344 {space 3} {res} .07217222
{txt} 32{c |} {space 3} {res} 6.3482348 {space 3} {res} .53469694 {space 3} {res} .07280828
{txt} 33{c |} {space 3} {res} 5.7842751 {space 3} {res} .53403281 {space 3} {res} .07343641
{txt} 34{c |} {space 3} {res} 5.270416 {space 3} {res} .53351888 {space 3} {res} .07403369
{txt} 35{c |} {space 3} {res} 4.8022068 {space 3} {res} .53316651 {space 3} {res} .07459398
{txt} 36{c |} {space 3} {res} 4.375592 {space 3} {res} .53194544 {space 3} {res} .07533791
{txt} 37{c |} {space 3} {res} 3.9868765 {space 3} {res} .53071925 {space 3} {res} .07607058
{txt} 38{c |} {space 3} {res} 3.6326933 {space 3} {res} .52969279 {space 3} {res} .07673514
{txt} 39{c |} {space 3} {res} 3.3099749 {space 3} {res} .52884208 {space 3} {res} .07733835
{txt} 40{c |} {space 3} {res} 3.0159258 {space 3} {res} .5281428 {space 3} {res} .07788621
{txt} 41{c |} {space 3} {res} 2.7479993 {space 3} {res} .52728948 {space 3} {res} .07835937
{txt} 42{c |} {space 3} {res} 2.5038746 {space 3} {res} .52648626 {space 3} {res} .07878276
{txt} 43{c |} {space 3} {res} 2.2814373 {space 3} {res} .52579993 {space 3} {res} .07916793
{txt} 44{c |} {space 3} {res} 2.0787607 {space 3} {res} .52521238 {space 3} {res} .07951832
{txt} 45{c |} {space 3} {res} 1.8940893 {space 3} {res} .52468293 {space 3} {res} .07983516
{txt} 46{c |} {space 3} {res} 1.7258236 {space 3} {res} .52420837 {space 3} {res} .08012221
{txt} 47{c |} {space 3} {res} 1.5725062 {space 3} {res} .52379813 {space 3} {res} .08038341
{txt} 48{c |} {space 3} {res} 1.4328091 {space 3} {res} .52342923 {space 3} {res} .08061638
{txt} 49{c |} {space 3} {res} 1.3055223 {space 3} {res} .52310885 {space 3} {res} .08082854
{txt} 50{c |} {space 3} {res} 1.1895433 {space 3} {res} .52282994 {space 3} {res} .08102172
{txt} 51{c |} {space 3} {res} 1.0838675 {space 3} {res} .52258662 {space 3} {res} .08119763
{txt} 52{c |} {space 3} {res} .98757974 {space 3} {res} .52237389 {space 3} {res} .0813578
{txt} 53{c |} {space 3} {res} .89984588 {space 3} {res} .5221875 {space 3} {res} .08150366
{txt} 54{c |} {space 3} {res} .81990605 {space 3} {res} .52202385 {space 3} {res} .08163648
{txt} 55{c |} {space 3} {res} .74706786 {space 3} {res} .52187987 {space 3} {res} .08175743
{txt} 56{c |} {space 3} {res} .68070041 {space 3} {res} .52175295 {space 3} {res} .08186759
{txt} 57{c |} {space 3} {res} .62022886 {space 3} {res} .52164084 {space 3} {res} .0819679
{txt} 58{c |} {space 3} {res} .56512944 {space 3} {res} .52154162 {space 3} {res} .08205927
{txt} 59{c |} {space 3} {res} .51492489 {space 3} {res} .52145366 {space 3} {res} .08214248
{txt} 60{c |} {space 3} {res} .46918039 {space 3} {res} .52137554 {space 3} {res} .08221827
{txt} 61{c |} {space 3} {res} .42749969 {space 3} {res} .52130604 {space 3} {res} .08228731
{txt} 62{c |} {space 3} {res} .3895218 {space 3} {res} .52124411 {space 3} {res} .08235019
{txt} 63{c |} {space 3} {res} .35491776 {space 3} {res} .52118884 {space 3} {res} .08240746
{txt} 64{c |} {space 3} {res} .32338784 {space 3} {res} .52114055 {space 3} {res} .08245931 *
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{err}Warning: lopt is at the limit of the lambda range.
{txt}r; t=1.08 20:21:57
{com}.
. // make sure that partial works
. estimates restore m1
{txt}(results {stata estimates replay m1:m1} are active now)
r; t=0.01 20:21:57
{com}. assert "`e(partial)'"=="svi"
{txt}r; t=0.00 20:21:57
{com}.
.
. ********************************************************************************
. *** misc options/syntax checks ***
. ********************************************************************************
.
. // Support for inrange(.) and similar [if] expressions:
. cvlasso $model if inrange(age,50,70)
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 132.46591 {space 3} {res} 1.3468706 {space 3} {res} .28051017
{txt} 2{c |} {space 3} {res} 120.698 {space 3} {res} 1.2663279 {space 3} {res} .28277885
{txt} 3{c |} {space 3} {res} 109.97553 {space 3} {res} 1.1638371 {space 3} {res} .264536
{txt} 4{c |} {space 3} {res} 100.2056 {space 3} {res} 1.0770413 {space 3} {res} .24756594
{txt} 5{c |} {space 3} {res} 91.303614 {space 3} {res} 1.0050165 {space 3} {res} .23294401
{txt} 6{c |} {space 3} {res} 83.192453 {space 3} {res} .94628701 {space 3} {res} .22011741
{txt} 7{c |} {space 3} {res} 75.801865 {space 3} {res} .89729298 {space 3} {res} .20917878
{txt} 8{c |} {space 3} {res} 69.067836 {space 3} {res} .85344967 {space 3} {res} .19961019
{txt} 9{c |} {space 3} {res} 62.93204 {space 3} {res} .81748443 {space 3} {res} .19107086
{txt} 10{c |} {space 3} {res} 57.341331 {space 3} {res} .78605508 {space 3} {res} .18244682
{txt} 11{c |} {space 3} {res} 52.247285 {space 3} {res} .75803541 {space 3} {res} .17315602
{txt} 12{c |} {space 3} {res} 47.60578 {space 3} {res} .73426303 {space 3} {res} .16502049
{txt} 13{c |} {space 3} {res} 43.376614 {space 3} {res} .71347782 {space 3} {res} .15833262 ^
{txt} 14{c |} {space 3} {res} 39.523155 {space 3} {res} .69707931 {space 3} {res} .15282169
{txt} 15{c |} {space 3} {res} 36.012027 {space 3} {res} .68237011 {space 3} {res} .14860429
{txt} 16{c |} {space 3} {res} 32.812818 {space 3} {res} .66879212 {space 3} {res} .14538535
{txt} 17{c |} {space 3} {res} 29.897817 {space 3} {res} .65590514 {space 3} {res} .14211631
{txt} 18{c |} {space 3} {res} 27.241778 {space 3} {res} .64503617 {space 3} {res} .13902259
{txt} 19{c |} {space 3} {res} 24.821693 {space 3} {res} .63562948 {space 3} {res} .13625794
{txt} 20{c |} {space 3} {res} 22.616602 {space 3} {res} .62762356 {space 3} {res} .13380436
{txt} 21{c |} {space 3} {res} 20.607406 {space 3} {res} .62128712 {space 3} {res} .13161579
{txt} 22{c |} {space 3} {res} 18.776701 {space 3} {res} .61607581 {space 3} {res} .12968819
{txt} 23{c |} {space 3} {res} 17.10863 {space 3} {res} .61188759 {space 3} {res} .12804577
{txt} 24{c |} {space 3} {res} 15.588747 {space 3} {res} .60874875 {space 3} {res} .12669098
{txt} 25{c |} {space 3} {res} 14.203885 {space 3} {res} .60648266 {space 3} {res} .12563051
{txt} 26{c |} {space 3} {res} 12.942051 {space 3} {res} .60418992 {space 3} {res} .1247094
{txt} 27{c |} {space 3} {res} 11.792315 {space 3} {res} .60248719 {space 3} {res} .12397669
{txt} 28{c |} {space 3} {res} 10.744718 {space 3} {res} .60136927 {space 3} {res} .12343029 *
{txt} 29{c |} {space 3} {res} 9.7901873 {space 3} {res} .60170297 {space 3} {res} .12349762
{txt} 30{c |} {space 3} {res} 8.920454 {space 3} {res} .60234317 {space 3} {res} .12368115
{txt} 31{c |} {space 3} {res} 8.1279855 {space 3} {res} .60310956 {space 3} {res} .12391603
{txt} 32{c |} {space 3} {res} 7.4059177 {space 3} {res} .60395984 {space 3} {res} .12418638
{txt} 33{c |} {space 3} {res} 6.7479964 {space 3} {res} .60485137 {space 3} {res} .1244796
{txt} 34{c |} {space 3} {res} 6.148523 {space 3} {res} .60592188 {space 3} {res} .1248269
{txt} 35{c |} {space 3} {res} 5.6023051 {space 3} {res} .60767394 {space 3} {res} .12536162
{txt} 36{c |} {space 3} {res} 5.1046118 {space 3} {res} .60948033 {space 3} {res} .12584599
{txt} 37{c |} {space 3} {res} 4.6511321 {space 3} {res} .61207075 {space 3} {res} .12637019
{txt} 38{c |} {space 3} {res} 4.2379384 {space 3} {res} .61464505 {space 3} {res} .12688897
{txt} 39{c |} {space 3} {res} 3.8614516 {space 3} {res} .61752709 {space 3} {res} .12755684
{txt} 40{c |} {space 3} {res} 3.5184109 {space 3} {res} .62052791 {space 3} {res} .12828173
{txt} 41{c |} {space 3} {res} 3.205845 {space 3} {res} .62334868 {space 3} {res} .12897082
{txt} 42{c |} {space 3} {res} 2.9210465 {space 3} {res} .6260554 {space 3} {res} .12963867
{txt} 43{c |} {space 3} {res} 2.6615488 {space 3} {res} .62856219 {space 3} {res} .13031667
{txt} 44{c |} {space 3} {res} 2.4251041 {space 3} {res} .63088099 {space 3} {res} .13095931
{txt} 45{c |} {space 3} {res} 2.2096646 {space 3} {res} .63277656 {space 3} {res} .13152733
{txt} 46{c |} {space 3} {res} 2.0133641 {space 3} {res} .63433622 {space 3} {res} .13205671
{txt} 47{c |} {space 3} {res} 1.8345024 {space 3} {res} .63558327 {space 3} {res} .1326299
{txt} 48{c |} {space 3} {res} 1.6715302 {space 3} {res} .63671747 {space 3} {res} .13317138
{txt} 49{c |} {space 3} {res} 1.5230361 {space 3} {res} .63775095 {space 3} {res} .13366803
{txt} 50{c |} {space 3} {res} 1.3877338 {space 3} {res} .63873225 {space 3} {res} .13412088
{txt} 51{c |} {space 3} {res} 1.2644513 {space 3} {res} .63965926 {space 3} {res} .13453374
{txt} 52{c |} {space 3} {res} 1.1521209 {space 3} {res} .64053124 {space 3} {res} .13491011
{txt} 53{c |} {space 3} {res} 1.0497697 {space 3} {res} .64134842 {space 3} {res} .13525318
{txt} 54{c |} {space 3} {res} .95651105 {space 3} {res} .64211183 {space 3} {res} .13556589
{txt} 55{c |} {space 3} {res} .87153724 {space 3} {res} .64280169 {space 3} {res} .13585909
{txt} 56{c |} {space 3} {res} .79411228 {space 3} {res} .64342633 {space 3} {res} .13613282
{txt} 57{c |} {space 3} {res} .72356553 {space 3} {res} .6440069 {space 3} {res} .13638206
{txt} 58{c |} {space 3} {res} .65928596 {space 3} {res} .64454537 {space 3} {res} .13660901
{txt} 59{c |} {space 3} {res} .60071681 {space 3} {res} .64504388 {space 3} {res} .13681568
{txt} 60{c |} {space 3} {res} .54735079 {space 3} {res} .64534099 {space 3} {res} .13692261
{txt} 61{c |} {space 3} {res} .49872565 {space 3} {res} .64560982 {space 3} {res} .13701649
{txt} 62{c |} {space 3} {res} .45442024 {space 3} {res} .64584187 {space 3} {res} .13710724
{txt} 63{c |} {space 3} {res} .4140508 {space 3} {res} .64605003 {space 3} {res} .13719209
{txt} 64{c |} {space 3} {res} .37726767 {space 3} {res} .646243 {space 3} {res} .13726943
{txt} 65{c |} {space 3} {res} .34375225 {space 3} {res} .64642158 {space 3} {res} .13733993
{txt} 66{c |} {space 3} {res} .31321425 {space 3} {res} .64658657 {space 3} {res} .13740419
{txt} 67{c |} {space 3} {res} .28538915 {space 3} {res} .64673881 {space 3} {res} .13746276
{txt} 68{c |} {space 3} {res} .26003597 {space 3} {res} .64687909 {space 3} {res} .13751615
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=0.51 20:21:58
{com}.
. ********************************************************************************
. *** plotting ***
. ********************************************************************************
.
. * load example data
. insheet using "$prostate", tab clear
{txt}(11 vars, 97 obs)
r; t=0.19 20:21:58
{com}.
. cvlasso $model, plotcv
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 163.62492 {space 3} {res} 1.333319 {space 3} {res} .20089729
{txt} 2{c |} {space 3} {res} 149.08894 {space 3} {res} 1.2420647 {space 3} {res} .19385317
{txt} 3{c |} {space 3} {res} 135.84429 {space 3} {res} 1.1387822 {space 3} {res} .177899
{txt} 4{c |} {space 3} {res} 123.77625 {space 3} {res} 1.0531517 {space 3} {res} .16424841
{txt} 5{c |} {space 3} {res} 112.78031 {space 3} {res} .98216599 {space 3} {res} .15250138
{txt} 6{c |} {space 3} {res} 102.76122 {space 3} {res} .92332908 {space 3} {res} .14233858
{txt} 7{c |} {space 3} {res} 93.632197 {space 3} {res} .87456976 {space 3} {res} .13350476
{txt} 8{c |} {space 3} {res} 85.314171 {space 3} {res} .83420647 {space 3} {res} .12570416
{txt} 9{c |} {space 3} {res} 77.735095 {space 3} {res} .79993609 {space 3} {res} .11875212
{txt} 10{c |} {space 3} {res} 70.829323 {space 3} {res} .76609365 {space 3} {res} .11248448
{txt} 11{c |} {space 3} {res} 64.537041 {space 3} {res} .73282703 {space 3} {res} .10780767
{txt} 12{c |} {space 3} {res} 58.803749 {space 3} {res} .69912922 {space 3} {res} .10256908
{txt} 13{c |} {space 3} {res} 53.579786 {space 3} {res} .669818 {space 3} {res} .0976207
{txt} 14{c |} {space 3} {res} 48.819905 {space 3} {res} .64551004 {space 3} {res} .09356449
{txt} 15{c |} {space 3} {res} 44.482879 {space 3} {res} .62537656 {space 3} {res} .09026863 ^
{txt} 16{c |} {space 3} {res} 40.531143 {space 3} {res} .60920075 {space 3} {res} .08743039
{txt} 17{c |} {space 3} {res} 36.930468 {space 3} {res} .59590953 {space 3} {res} .08515487
{txt} 18{c |} {space 3} {res} 33.649667 {space 3} {res} .58544829 {space 3} {res} .08345446
{txt} 19{c |} {space 3} {res} 30.660323 {space 3} {res} .57789692 {space 3} {res} .08243322
{txt} 20{c |} {space 3} {res} 27.936545 {space 3} {res} .5724866 {space 3} {res} .0815623
{txt} 21{c |} {space 3} {res} 25.454739 {space 3} {res} .56847109 {space 3} {res} .08089575
{txt} 22{c |} {space 3} {res} 23.19341 {space 3} {res} .56514785 {space 3} {res} .08043522
{txt} 23{c |} {space 3} {res} 21.132972 {space 3} {res} .56189348 {space 3} {res} .0802513
{txt} 24{c |} {space 3} {res} 19.255577 {space 3} {res} .55864494 {space 3} {res} .08044089
{txt} 25{c |} {space 3} {res} 17.544964 {space 3} {res} .55573796 {space 3} {res} .08074748
{txt} 26{c |} {space 3} {res} 15.986318 {space 3} {res} .55325411 {space 3} {res} .08111917
{txt} 27{c |} {space 3} {res} 14.566138 {space 3} {res} .55150312 {space 3} {res} .08129531
{txt} 28{c |} {space 3} {res} 13.272122 {space 3} {res} .55118766 {space 3} {res} .08146513
{txt} 29{c |} {space 3} {res} 12.093063 {space 3} {res} .55099552 {space 3} {res} .08177064
{txt} 30{c |} {space 3} {res} 11.018749 {space 3} {res} .55088363 {space 3} {res} .08210567
{txt} 31{c |} {space 3} {res} 10.039874 {space 3} {res} .55110601 {space 3} {res} .08242346
{txt} 32{c |} {space 3} {res} 9.1479589 {space 3} {res} .55111023 {space 3} {res} .0827693
{txt} 33{c |} {space 3} {res} 8.3352794 {space 3} {res} .54997427 {space 3} {res} .08318548
{txt} 34{c |} {space 3} {res} 7.5947962 {space 3} {res} .54846465 {space 3} {res} .08332853
{txt} 35{c |} {space 3} {res} 6.9200954 {space 3} {res} .54729517 {space 3} {res} .08348564
{txt} 36{c |} {space 3} {res} 6.3053332 {space 3} {res} .54684846 {space 3} {res} .08385284
{txt} 37{c |} {space 3} {res} 5.7451848 {space 3} {res} .54691285 {space 3} {res} .08427171
{txt} 38{c |} {space 3} {res} 5.2347984 {space 3} {res} .54744963 {space 3} {res} .08462423
{txt} 39{c |} {space 3} {res} 4.7697533 {space 3} {res} .54808502 {space 3} {res} .08495417
{txt} 40{c |} {space 3} {res} 4.3460216 {space 3} {res} .54879163 {space 3} {res} .08526634
{txt} 41{c |} {space 3} {res} 3.959933 {space 3} {res} .54933821 {space 3} {res} .08562963
{txt} 42{c |} {space 3} {res} 3.6081435 {space 3} {res} .54941743 {space 3} {res} .0860535
{txt} 43{c |} {space 3} {res} 3.287606 {space 3} {res} .54908836 {space 3} {res} .08649829
{txt} 44{c |} {space 3} {res} 2.9955441 {space 3} {res} .54875064 {space 3} {res} .08685923
{txt} 45{c |} {space 3} {res} 2.7294282 {space 3} {res} .5481921 {space 3} {res} .08695813
{txt} 46{c |} {space 3} {res} 2.4869533 {space 3} {res} .54742296 {space 3} {res} .08702243
{txt} 47{c |} {space 3} {res} 2.2660193 {space 3} {res} .54677854 {space 3} {res} .08709007
{txt} 48{c |} {space 3} {res} 2.0647124 {space 3} {res} .54623847 {space 3} {res} .08716004
{txt} 49{c |} {space 3} {res} 1.881289 {space 3} {res} .5457992 {space 3} {res} .08722744
{txt} 50{c |} {space 3} {res} 1.7141605 {space 3} {res} .54544279 {space 3} {res} .08729181
{txt} 51{c |} {space 3} {res} 1.5618792 {space 3} {res} .54515446 {space 3} {res} .08735287
{txt} 52{c |} {space 3} {res} 1.4231261 {space 3} {res} .54492196 {space 3} {res} .08741047
{txt} 53{c |} {space 3} {res} 1.2966995 {space 3} {res} .54474678 {space 3} {res} .08746371 *
{txt} 54{c |} {space 3} {res} 1.1815043 {space 3} {res} .54477019 {space 3} {res} .08750238
{txt} 55{c |} {space 3} {res} 1.0765427 {space 3} {res} .54481303 {space 3} {res} .08753934
{txt} 56{c |} {space 3} {res} .98090565 {space 3} {res} .54486992 {space 3} {res} .08757449
{txt} 57{c |} {space 3} {res} .89376469 {space 3} {res} .54493659 {space 3} {res} .08760776
{txt} 58{c |} {space 3} {res} .8143651 {space 3} {res} .54500964 {space 3} {res} .08763914
{txt} 59{c |} {space 3} {res} .74201915 {space 3} {res} .54508642 {space 3} {res} .08766863
{txt} 60{c |} {space 3} {res} .67610021 {space 3} {res} .54516486 {space 3} {res} .08769625
{txt} 61{c |} {space 3} {res} .61603733 {space 3} {res} .54524338 {space 3} {res} .08772206
{txt} 62{c |} {space 3} {res} .56131027 {space 3} {res} .54533234 {space 3} {res} .08774575
{txt} 63{c |} {space 3} {res} .51144502 {space 3} {res} .54544399 {space 3} {res} .08776693
{txt} 64{c |} {space 3} {res} .46600965 {space 3} {res} .54554976 {space 3} {res} .08778657
{txt} 65{c |} {space 3} {res} .42461064 {space 3} {res} .54564951 {space 3} {res} .08780475
{txt} 66{c |} {space 3} {res} .3868894 {space 3} {res} .54574318 {space 3} {res} .08782155
{txt} 67{c |} {space 3} {res} .35251921 {space 3} {res} .54583086 {space 3} {res} .08783705
{txt} 68{c |} {space 3} {res} .32120238 {space 3} {res} .54591267 {space 3} {res} .08785134
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{res}{txt}r; t=3.02 20:22:01
{com}.
. ********************************************************************************
. *** time-series example with rolling cv ***
. ********************************************************************************
.
. webuse air2, clear
{txt}(TIMESLAB: Airline passengers)
r; t=1.27 20:22:02
{com}.
. cvlasso air L(1/12).air, rolling origin(130)
{txt}Rolling forecasting cross-validation with 1-step ahead forecasts. Elastic net with alpha=1.
Training from-to (validation point): {res}13-130 (131), 13-131 (132), 13-132 (133), 13-133 (134), 13-134 (135), 13-135 (136), 13-136 (137), 13-137 (138), 13-138 (139), 13-139 (140), 13-140 (141), 13-141 (142), 13-142 (143), 13-143 (144).
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 30083.535 {space 3} {res} 33237.193 {space 3} {res} 8731.4325
{txt} 2{c |} {space 3} {res} 27410.996 {space 3} {res} 27799.242 {space 3} {res} 7290.3087
{txt} 3{c |} {space 3} {res} 24975.879 {space 3} {res} 23267.301 {space 3} {res} 6092.3376
{txt} 4{c |} {space 3} {res} 22757.091 {space 3} {res} 19493.102 {space 3} {res} 5095.861
{txt} 5{c |} {space 3} {res} 20735.414 {space 3} {res} 16349.032 {space 3} {res} 4266.8189
{txt} 6{c |} {space 3} {res} 18893.337 {space 3} {res} 13729.055 {space 3} {res} 3576.9191
{txt} 7{c |} {space 3} {res} 17214.905 {space 3} {res} 11545.052 {space 3} {res} 3002.6587
{txt} 8{c |} {space 3} {res} 15685.58 {space 3} {res} 9723.7885 {space 3} {res} 2524.5123
{txt} 9{c |} {space 3} {res} 14292.116 {space 3} {res} 8204.3942 {space 3} {res} 2126.2578
{txt} 10{c |} {space 3} {res} 13022.444 {space 3} {res} 6936.2699 {space 3} {res} 1794.4166
{txt} 11{c |} {space 3} {res} 11865.566 {space 3} {res} 5877.3493 {space 3} {res} 1517.7888
{txt} 12{c |} {space 3} {res} 10811.462 {space 3} {res} 4992.6553 {space 3} {res} 1287.0672
{txt} 13{c |} {space 3} {res} 9851.0014 {space 3} {res} 4253.1013 {space 3} {res} 1094.5174
{txt} 14{c |} {space 3} {res} 8975.8656 {space 3} {res} 3635.824 {space 3} {res} 936.22874
{txt} 15{c |} {space 3} {res} 8178.4744 {space 3} {res} 3111.7137 {space 3} {res} 812.75242
{txt} 16{c |} {space 3} {res} 7451.9213 {space 3} {res} 2669.6887 {space 3} {res} 708.75189
{txt} 17{c |} {space 3} {res} 6789.9131 {space 3} {res} 2300.5206 {space 3} {res} 621.98344
{txt} 18{c |} {space 3} {res} 6186.716 {space 3} {res} 1992.0343 {space 3} {res} 549.37699
{txt} 19{c |} {space 3} {res} 5637.1052 {space 3} {res} 1734.1043 {space 3} {res} 488.40062
{txt} 20{c |} {space 3} {res} 5136.3203 {space 3} {res} 1518.3087 {space 3} {res} 436.97343
{txt} 21{c |} {space 3} {res} 4680.0237 {space 3} {res} 1337.6412 {space 3} {res} 393.39186
{txt} 22{c |} {space 3} {res} 4264.2633 {space 3} {res} 1186.2716 {space 3} {res} 356.26673
{txt} 23{c |} {space 3} {res} 3885.4379 {space 3} {res} 1059.3481 {space 3} {res} 324.46942
{txt} 24{c |} {space 3} {res} 3540.2663 {space 3} {res} 952.8315 {space 3} {res} 297.08581
{txt} 25{c |} {space 3} {res} 3225.7588 {space 3} {res} 863.35854 {space 3} {res} 273.3769
{txt} 26{c |} {space 3} {res} 2939.1913 {space 3} {res} 788.491 {space 3} {res} 252.67635
{txt} 27{c |} {space 3} {res} 2678.0817 {space 3} {res} 725.70704 {space 3} {res} 234.57369
{txt} 28{c |} {space 3} {res} 2440.1683 {space 3} {res} 670.22718 {space 3} {res} 218.23327
{txt} 29{c |} {space 3} {res} 2223.3904 {space 3} {res} 622.52635 {space 3} {res} 203.38451
{txt} 30{c |} {space 3} {res} 2025.8706 {space 3} {res} 581.16825 {space 3} {res} 190.03867
{txt} 31{c |} {space 3} {res} 1845.8978 {space 3} {res} 546.16451 {space 3} {res} 178.31137
{txt} 32{c |} {space 3} {res} 1681.9133 {space 3} {res} 516.49556 {space 3} {res} 168.00213
{txt} 33{c |} {space 3} {res} 1532.4968 {space 3} {res} 491.30969 {space 3} {res} 158.93797
{txt} 34{c |} {space 3} {res} 1396.354 {space 3} {res} 469.89498 {space 3} {res} 150.96867
{txt} 35{c |} {space 3} {res} 1272.3058 {space 3} {res} 451.65601 {space 3} {res} 143.9631 ^
{txt} 36{c |} {space 3} {res} 1159.2776 {space 3} {res} 436.09447 {space 3} {res} 137.80621
{txt} 37{c |} {space 3} {res} 1056.2906 {space 3} {res} 422.79303 {space 3} {res} 132.39667
{txt} 38{c |} {space 3} {res} 962.45264 {space 3} {res} 411.40189 {space 3} {res} 127.64501
{txt} 39{c |} {space 3} {res} 876.951 {space 3} {res} 401.62764 {space 3} {res} 123.47207
{txt} 40{c |} {space 3} {res} 799.04509 {space 3} {res} 393.22392 {space 3} {res} 119.80779
{txt} 41{c |} {space 3} {res} 728.06013 {space 3} {res} 385.98373 {space 3} {res} 116.59019
{txt} 42{c |} {space 3} {res} 663.38127 {space 3} {res} 379.7329 {space 3} {res} 113.76442
{txt} 43{c |} {space 3} {res} 604.44831 {space 3} {res} 374.32476 {space 3} {res} 111.28209
{txt} 44{c |} {space 3} {res} 550.75079 {space 3} {res} 369.63567 {space 3} {res} 109.10052
{txt} 45{c |} {space 3} {res} 501.82361 {space 3} {res} 365.56123 {space 3} {res} 107.18216
{txt} 46{c |} {space 3} {res} 457.24298 {space 3} {res} 362.0132 {space 3} {res} 105.49406
{txt} 47{c |} {space 3} {res} 416.62277 {space 3} {res} 358.91691 {space 3} {res} 104.00732
{txt} 48{c |} {space 3} {res} 379.61115 {space 3} {res} 356.20904 {space 3} {res} 102.69665
{txt} 49{c |} {space 3} {res} 345.88755 {space 3} {res} 353.83583 {space 3} {res} 101.53998
{txt} 50{c |} {space 3} {res} 315.15985 {space 3} {res} 352.3553 {space 3} {res} 100.65556 *
{txt} 51{c |} {space 3} {res} 287.16192 {space 3} {res} 356.42305 {space 3} {res} 101.19582
{txt} 52{c |} {space 3} {res} 261.65124 {space 3} {res} 363.33054 {space 3} {res} 102.75269
{txt} 53{c |} {space 3} {res} 238.40687 {space 3} {res} 370.44865 {space 3} {res} 105.00085
{txt} 54{c |} {space 3} {res} 217.22746 {space 3} {res} 372.21202 {space 3} {res} 106.53333
{txt} 55{c |} {space 3} {res} 197.92957 {space 3} {res} 373.58108 {space 3} {res} 108.17032
{txt} 56{c |} {space 3} {res} 180.34605 {space 3} {res} 375.89938 {space 3} {res} 109.80358
{txt} 57{c |} {space 3} {res} 164.32461 {space 3} {res} 378.99098 {space 3} {res} 111.37688
{txt} 58{c |} {space 3} {res} 149.72646 {space 3} {res} 380.49347 {space 3} {res} 112.55753
{txt} 59{c |} {space 3} {res} 136.42518 {space 3} {res} 381.08165 {space 3} {res} 113.73224
{txt} 60{c |} {space 3} {res} 124.30554 {space 3} {res} 381.60207 {space 3} {res} 114.93783
{txt} 61{c |} {space 3} {res} 113.26258 {space 3} {res} 380.71469 {space 3} {res} 115.6034
{txt} 62{c |} {space 3} {res} 103.20064 {space 3} {res} 379.53228 {space 3} {res} 116.00241
{txt} 63{c |} {space 3} {res} 94.032582 {space 3} {res} 380.74666 {space 3} {res} 117.01678
{txt} 64{c |} {space 3} {res} 85.678986 {space 3} {res} 382.39512 {space 3} {res} 117.92244
{txt} 65{c |} {space 3} {res} 78.067501 {space 3} {res} 382.00813 {space 3} {res} 118.30133
{txt} 66{c |} {space 3} {res} 71.1322 {space 3} {res} 379.53614 {space 3} {res} 118.33073
{txt} 67{c |} {space 3} {res} 64.813011 {space 3} {res} 377.47621 {space 3} {res} 118.59801
{txt} 68{c |} {space 3} {res} 59.055202 {space 3} {res} 376.71111 {space 3} {res} 119.05724
{txt} 69{c |} {space 3} {res} 53.8089 {space 3} {res} 376.19828 {space 3} {res} 119.49392
{txt} 70{c |} {space 3} {res} 49.028666 {space 3} {res} 375.22278 {space 3} {res} 119.97715
{txt} 71{c |} {space 3} {res} 44.673094 {space 3} {res} 373.26668 {space 3} {res} 120.18322
{txt} 72{c |} {space 3} {res} 40.70446 {space 3} {res} 372.49456 {space 3} {res} 120.43289
{txt} 73{c |} {space 3} {res} 37.088388 {space 3} {res} 372.59088 {space 3} {res} 120.82114
{txt} 74{c |} {space 3} {res} 33.793558 {space 3} {res} 374.04884 {space 3} {res} 121.19229
{txt} 75{c |} {space 3} {res} 30.791431 {space 3} {res} 377.5105 {space 3} {res} 121.17767
{txt} 76{c |} {space 3} {res} 28.056005 {space 3} {res} 381.87875 {space 3} {res} 121.00114
{txt} 77{c |} {space 3} {res} 25.563587 {space 3} {res} 385.86197 {space 3} {res} 120.80072
{txt} 78{c |} {space 3} {res} 23.292588 {space 3} {res} 389.16575 {space 3} {res} 120.36636
{txt} 79{c |} {space 3} {res} 21.223339 {space 3} {res} 392.38507 {space 3} {res} 120.08113
{txt} 80{c |} {space 3} {res} 19.337916 {space 3} {res} 396.88113 {space 3} {res} 120.4689
{txt} 81{c |} {space 3} {res} 17.619989 {space 3} {res} 402.63138 {space 3} {res} 121.19743
{txt} 82{c |} {space 3} {res} 16.054678 {space 3} {res} 412.30702 {space 3} {res} 121.83665
{txt} 83{c |} {space 3} {res} 14.628424 {space 3} {res} 421.09094 {space 3} {res} 121.51485
{txt} 84{c |} {space 3} {res} 13.328875 {space 3} {res} 426.86241 {space 3} {res} 120.2055
{txt} 85{c |} {space 3} {res} 12.144775 {space 3} {res} 431.12421 {space 3} {res} 119.04316
{txt} 86{c |} {space 3} {res} 11.065867 {space 3} {res} 433.74587 {space 3} {res} 118.05604
{txt} 87{c |} {space 3} {res} 10.082806 {space 3} {res} 436.53986 {space 3} {res} 117.36929
{txt} 88{c |} {space 3} {res} 9.1870769 {space 3} {res} 439.42206 {space 3} {res} 116.91838
{txt} 89{c |} {space 3} {res} 8.3709223 {space 3} {res} 442.32753 {space 3} {res} 116.65087
{txt} 90{c |} {space 3} {res} 7.6272726 {space 3} {res} 445.20676 {space 3} {res} 116.5244
{txt} 91{c |} {space 3} {res} 6.9496867 {space 3} {res} 448.02273 {space 3} {res} 116.50501
{txt} 92{c |} {space 3} {res} 6.3322957 {space 3} {res} 450.74836 {space 3} {res} 116.56561
{txt} 93{c |} {space 3} {res} 5.769752 {space 3} {res} 453.36455 {space 3} {res} 116.68474
{txt} 94{c |} {space 3} {res} 5.2571831 {space 3} {res} 455.85849 {space 3} {res} 116.84547
{txt} 95{c |} {space 3} {res} 4.7901495 {space 3} {res} 458.22233 {space 3} {res} 117.03456
{txt} 96{c |} {space 3} {res} 4.3646058 {space 3} {res} 460.45211 {space 3} {res} 117.24169
{txt} 97{c |} {space 3} {res} 3.9768663 {space 3} {res} 462.54684 {space 3} {res} 117.45892
{txt} 98{c |} {space 3} {res} 3.6235724 {space 3} {res} 464.50782 {space 3} {res} 117.68017
{txt} 99{c |} {space 3} {res} 3.3016642 {space 3} {res} 466.33804 {space 3} {res} 117.90088
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=21.59 20:22:24
{com}. // we should have 144-130=14 folds
. assert 14==`e(nfolds)'
{txt}r; t=0.00 20:22:24
{com}.
. cvlasso air L(1/12).air, rolling origin(130) h(2)
{txt}Rolling forecasting cross-validation with 2-step ahead forecasts. Elastic net with alpha=1.
Training from-to (validation point): {res}13-130 (132), 13-131 (133), 13-132 (134), 13-133 (135), 13-134 (136), 13-135 (137), 13-136 (138), 13-137 (139), 13-138 (140), 13-139 (141), 13-140 (142), 13-141 (143), 13-142 (144).
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 30083.535 {space 3} {res} 34952.233 {space 3} {res} 8972.5481
{txt} 2{c |} {space 3} {res} 27410.996 {space 3} {res} 29219.469 {space 3} {res} 7495.1704
{txt} 3{c |} {space 3} {res} 24975.879 {space 3} {res} 24447.167 {space 3} {res} 6266.3552
{txt} 4{c |} {space 3} {res} 22757.091 {space 3} {res} 20473.399 {space 3} {res} 5244.0824
{txt} 5{c |} {space 3} {res} 20735.414 {space 3} {res} 17163.629 {space 3} {res} 4393.4479
{txt} 6{c |} {space 3} {res} 18893.337 {space 3} {res} 14406.07 {space 3} {res} 3685.457
{txt} 7{c |} {space 3} {res} 17214.905 {space 3} {res} 12107.831 {space 3} {res} 3096.0221
{txt} 8{c |} {space 3} {res} 15685.58 {space 3} {res} 10191.716 {space 3} {res} 2605.1314
{txt} 9{c |} {space 3} {res} 14292.116 {space 3} {res} 8593.5634 {space 3} {res} 2196.1576
{txt} 10{c |} {space 3} {res} 13022.444 {space 3} {res} 7260.043 {space 3} {res} 1855.2848
{txt} 11{c |} {space 3} {res} 11865.566 {space 3} {res} 6146.8207 {space 3} {res} 1571.0323
{txt} 12{c |} {space 3} {res} 10811.462 {space 3} {res} 5217.0365 {space 3} {res} 1333.8591
{txt} 13{c |} {space 3} {res} 9851.0014 {space 3} {res} 4440.0404 {space 3} {res} 1135.836
{txt} 14{c |} {space 3} {res} 8975.8656 {space 3} {res} 3792.7368 {space 3} {res} 974.00243
{txt} 15{c |} {space 3} {res} 8178.4744 {space 3} {res} 3245.1003 {space 3} {res} 846.71514
{txt} 16{c |} {space 3} {res} 7451.9213 {space 3} {res} 2784.0987 {space 3} {res} 739.5864
{txt} 17{c |} {space 3} {res} 6789.9131 {space 3} {res} 2399.2025 {space 3} {res} 650.14159
{txt} 18{c |} {space 3} {res} 6186.716 {space 3} {res} 2077.6828 {space 3} {res} 575.22206
{txt} 19{c |} {space 3} {res} 5637.1052 {space 3} {res} 1808.9545 {space 3} {res} 512.22553
{txt} 20{c |} {space 3} {res} 5136.3203 {space 3} {res} 1584.2142 {space 3} {res} 459.01598
{txt} 21{c |} {space 3} {res} 4680.0237 {space 3} {res} 1396.1389 {space 3} {res} 413.84709
{txt} 22{c |} {space 3} {res} 4264.2633 {space 3} {res} 1238.6362 {space 3} {res} 375.29686
{txt} 23{c |} {space 3} {res} 3885.4379 {space 3} {res} 1106.6361 {space 3} {res} 342.21155
{txt} 24{c |} {space 3} {res} 3540.2663 {space 3} {res} 995.91868 {space 3} {res} 313.65775
{txt} 25{c |} {space 3} {res} 3225.7588 {space 3} {res} 902.97087 {space 3} {res} 288.88156
{txt} 26{c |} {space 3} {res} 2939.1913 {space 3} {res} 825.34561 {space 3} {res} 267.17892
{txt} 27{c |} {space 3} {res} 2678.0817 {space 3} {res} 760.38714 {space 3} {res} 248.10453
{txt} 28{c |} {space 3} {res} 2440.1683 {space 3} {res} 703.31872 {space 3} {res} 230.76798
{txt} 29{c |} {space 3} {res} 2223.3904 {space 3} {res} 654.06491 {space 3} {res} 214.98796
{txt} 30{c |} {space 3} {res} 2025.8706 {space 3} {res} 611.52854 {space 3} {res} 200.84841
{txt} 31{c |} {space 3} {res} 1845.8978 {space 3} {res} 575.54121 {space 3} {res} 188.40654
{txt} 32{c |} {space 3} {res} 1681.9133 {space 3} {res} 545.05078 {space 3} {res} 177.45417
{txt} 33{c |} {space 3} {res} 1532.4968 {space 3} {res} 519.17845 {space 3} {res} 167.81145
{txt} 34{c |} {space 3} {res} 1396.354 {space 3} {res} 497.18977 {space 3} {res} 159.32199
{txt} 35{c |} {space 3} {res} 1272.3058 {space 3} {res} 478.47059 {space 3} {res} 151.84907 ^
{txt} 36{c |} {space 3} {res} 1159.2776 {space 3} {res} 462.507 {space 3} {res} 145.27259
{txt} 37{c |} {space 3} {res} 1056.2906 {space 3} {res} 448.8687 {space 3} {res} 139.48664
{txt} 38{c |} {space 3} {res} 962.45264 {space 3} {res} 437.1951 {space 3} {res} 134.39758
{txt} 39{c |} {space 3} {res} 876.951 {space 3} {res} 427.1838 {space 3} {res} 129.92244
{txt} 40{c |} {space 3} {res} 799.04509 {space 3} {res} 418.58096 {space 3} {res} 125.9877
{txt} 41{c |} {space 3} {res} 728.06013 {space 3} {res} 411.17333 {space 3} {res} 122.52817
{txt} 42{c |} {space 3} {res} 663.38127 {space 3} {res} 404.78156 {space 3} {res} 119.48615
{txt} 43{c |} {space 3} {res} 604.44831 {space 3} {res} 399.25467 {space 3} {res} 116.81057
{txt} 44{c |} {space 3} {res} 550.75079 {space 3} {res} 394.46537 {space 3} {res} 114.45638
{txt} 45{c |} {space 3} {res} 501.82361 {space 3} {res} 390.30629 {space 3} {res} 112.38385
{txt} 46{c |} {space 3} {res} 457.24298 {space 3} {res} 386.68666 {space 3} {res} 110.55804
{txt} 47{c |} {space 3} {res} 416.62277 {space 3} {res} 383.52972 {space 3} {res} 108.9483
{txt} 48{c |} {space 3} {res} 379.61115 {space 3} {res} 380.77038 {space 3} {res} 107.52773
{txt} 49{c |} {space 3} {res} 345.88755 {space 3} {res} 378.35345 {space 3} {res} 106.27284
{txt} 50{c |} {space 3} {res} 315.15985 {space 3} {res} 377.24088 {space 3} {res} 105.38259 *
{txt} 51{c |} {space 3} {res} 287.16192 {space 3} {res} 382.01408 {space 3} {res} 105.95963
{txt} 52{c |} {space 3} {res} 261.65124 {space 3} {res} 389.65489 {space 3} {res} 107.7111
{txt} 53{c |} {space 3} {res} 238.40687 {space 3} {res} 396.94246 {space 3} {res} 110.12192
{txt} 54{c |} {space 3} {res} 217.22746 {space 3} {res} 398.32045 {space 3} {res} 111.7516
{txt} 55{c |} {space 3} {res} 197.92957 {space 3} {res} 399.72318 {space 3} {res} 113.59134
{txt} 56{c |} {space 3} {res} 180.34605 {space 3} {res} 401.75368 {space 3} {res} 115.49682
{txt} 57{c |} {space 3} {res} 164.32461 {space 3} {res} 404.46026 {space 3} {res} 117.3465
{txt} 58{c |} {space 3} {res} 149.72646 {space 3} {res} 405.28304 {space 3} {res} 118.73463
{txt} 59{c |} {space 3} {res} 136.42518 {space 3} {res} 405.2511 {space 3} {res} 120.1721
{txt} 60{c |} {space 3} {res} 124.30554 {space 3} {res} 405.2761 {space 3} {res} 121.62263
{txt} 61{c |} {space 3} {res} 113.26258 {space 3} {res} 403.59011 {space 3} {res} 122.41581
{txt} 62{c |} {space 3} {res} 103.20064 {space 3} {res} 401.82587 {space 3} {res} 122.98928
{txt} 63{c |} {space 3} {res} 94.032582 {space 3} {res} 402.94599 {space 3} {res} 124.26148
{txt} 64{c |} {space 3} {res} 85.678986 {space 3} {res} 404.20592 {space 3} {res} 125.21789
{txt} 65{c |} {space 3} {res} 78.067501 {space 3} {res} 403.68408 {space 3} {res} 125.62712
{txt} 66{c |} {space 3} {res} 71.1322 {space 3} {res} 400.91215 {space 3} {res} 125.64499
{txt} 67{c |} {space 3} {res} 64.813011 {space 3} {res} 398.9517 {space 3} {res} 126.02457
{txt} 68{c |} {space 3} {res} 59.055202 {space 3} {res} 397.76927 {space 3} {res} 126.60418
{txt} 69{c |} {space 3} {res} 53.8089 {space 3} {res} 396.84309 {space 3} {res} 127.16789
{txt} 70{c |} {space 3} {res} 49.028666 {space 3} {res} 395.36465 {space 3} {res} 127.77929
{txt} 71{c |} {space 3} {res} 44.673094 {space 3} {res} 392.86311 {space 3} {res} 128.06788
{txt} 72{c |} {space 3} {res} 40.70446 {space 3} {res} 391.49788 {space 3} {res} 128.48992
{txt} 73{c |} {space 3} {res} 37.088388 {space 3} {res} 391.07007 {space 3} {res} 129.00451
{txt} 74{c |} {space 3} {res} 33.793558 {space 3} {res} 392.16177 {space 3} {res} 129.49754
{txt} 75{c |} {space 3} {res} 30.791431 {space 3} {res} 395.08297 {space 3} {res} 129.54637
{txt} 76{c |} {space 3} {res} 28.056005 {space 3} {res} 398.32513 {space 3} {res} 129.52706
{txt} 77{c |} {space 3} {res} 25.563587 {space 3} {res} 401.15399 {space 3} {res} 129.44648
{txt} 78{c |} {space 3} {res} 23.292588 {space 3} {res} 403.24593 {space 3} {res} 129.10851
{txt} 79{c |} {space 3} {res} 21.223339 {space 3} {res} 405.54289 {space 3} {res} 128.94792
{txt} 80{c |} {space 3} {res} 19.337916 {space 3} {res} 409.33005 {space 3} {res} 129.52204
{txt} 81{c |} {space 3} {res} 17.619989 {space 3} {res} 414.58054 {space 3} {res} 130.50225
{txt} 82{c |} {space 3} {res} 16.054678 {space 3} {res} 423.29174 {space 3} {res} 131.10197
{txt} 83{c |} {space 3} {res} 14.628424 {space 3} {res} 431.51624 {space 3} {res} 130.67818
{txt} 84{c |} {space 3} {res} 13.328875 {space 3} {res} 436.86415 {space 3} {res} 129.31034
{txt} 85{c |} {space 3} {res} 12.144775 {space 3} {res} 440.37741 {space 3} {res} 128.09369
{txt} 86{c |} {space 3} {res} 11.065867 {space 3} {res} 442.49849 {space 3} {res} 127.09852
{txt} 87{c |} {space 3} {res} 10.082806 {space 3} {res} 444.85132 {space 3} {res} 126.41494
{txt} 88{c |} {space 3} {res} 9.1870769 {space 3} {res} 447.34397 {space 3} {res} 125.97551
{txt} 89{c |} {space 3} {res} 8.3709223 {space 3} {res} 449.9048 {space 3} {res} 125.72547
{txt} 90{c |} {space 3} {res} 7.6272726 {space 3} {res} 452.47857 {space 3} {res} 125.62067
{txt} 91{c |} {space 3} {res} 6.9496867 {space 3} {res} 455.02332 {space 3} {res} 125.62572
{txt} 92{c |} {space 3} {res} 6.3322957 {space 3} {res} 457.50773 {space 3} {res} 125.71243
{txt} 93{c |} {space 3} {res} 5.769752 {space 3} {res} 459.90901 {space 3} {res} 125.85849
{txt} 94{c |} {space 3} {res} 5.2571831 {space 3} {res} 462.21121 {space 3} {res} 126.04634
{txt} 95{c |} {space 3} {res} 4.7901495 {space 3} {res} 464.40372 {space 3} {res} 126.26225
{txt} 96{c |} {space 3} {res} 4.3646058 {space 3} {res} 466.48019 {space 3} {res} 126.49555
{txt} 97{c |} {space 3} {res} 3.9768663 {space 3} {res} 468.43756 {space 3} {res} 126.73804
{txt} 98{c |} {space 3} {res} 3.6235724 {space 3} {res} 470.27531 {space 3} {res} 126.98348
{txt} 99{c |} {space 3} {res} 3.3016642 {space 3} {res} 471.99485 {space 3} {res} 127.22718
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=20.27 20:22:44
{com}. // we should have 144-130-1=14 folds
. assert 13==`e(nfolds)'
{txt}r; t=0.00 20:22:44
{com}.
. cvlasso air L(1/12).air, rolling origin(130) fixedwin
{txt}Rolling forecasting cross-validation with 1-step ahead forecasts. Elastic net with alpha=1.
Training from-to (validation point): {res}13-130 (131), 14-131 (132), 15-132 (133), 16-133 (134), 17-134 (135), 18-135 (136), 19-136 (137), 20-137 (138), 21-138 (139), 22-139 (140), 23-140 (141), 24-141 (142), 25-142 (143), 26-143 (144).
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 30083.535 {space 3} {res} 29342.536 {space 3} {res} 7604.6329
{txt} 2{c |} {space 3} {res} 27410.996 {space 3} {res} 24556.677 {space 3} {res} 6355.4314
{txt} 3{c |} {space 3} {res} 24975.879 {space 3} {res} 20570.95 {space 3} {res} 5316.2899
{txt} 4{c |} {space 3} {res} 22757.091 {space 3} {res} 17250.611 {space 3} {res} 4451.7039
{txt} 5{c |} {space 3} {res} 20735.414 {space 3} {res} 14483.694 {space 3} {res} 3732.1806
{txt} 6{c |} {space 3} {res} 18893.337 {space 3} {res} 12177.154 {space 3} {res} 3133.2195
{txt} 7{c |} {space 3} {res} 17214.905 {space 3} {res} 10253.662 {space 3} {res} 2634.466
{txt} 8{c |} {space 3} {res} 15685.58 {space 3} {res} 8648.9434 {space 3} {res} 2219.0087
{txt} 9{c |} {space 3} {res} 14292.116 {space 3} {res} 7309.5692 {space 3} {res} 1872.7961
{txt} 10{c |} {space 3} {res} 13022.444 {space 3} {res} 6191.1202 {space 3} {res} 1584.1517
{txt} 11{c |} {space 3} {res} 11865.566 {space 3} {res} 5256.6626 {space 3} {res} 1343.3724
{txt} 12{c |} {space 3} {res} 10811.462 {space 3} {res} 4475.4822 {space 3} {res} 1142.3943
{txt} 13{c |} {space 3} {res} 9851.0014 {space 3} {res} 3822.0328 {space 3} {res} 974.51561
{txt} 14{c |} {space 3} {res} 8975.8656 {space 3} {res} 3272.4349 {space 3} {res} 844.16278
{txt} 15{c |} {space 3} {res} 8178.4744 {space 3} {res} 2805.5335 {space 3} {res} 735.84716
{txt} 16{c |} {space 3} {res} 7451.9213 {space 3} {res} 2415.5597 {space 3} {res} 645.3886
{txt} 17{c |} {space 3} {res} 6789.9131 {space 3} {res} 2089.5994 {space 3} {res} 569.63807
{txt} 18{c |} {space 3} {res} 6186.716 {space 3} {res} 1816.9795 {space 3} {res} 505.97842
{txt} 19{c |} {space 3} {res} 5637.1052 {space 3} {res} 1588.8216 {space 3} {res} 452.25745
{txt} 20{c |} {space 3} {res} 5136.3203 {space 3} {res} 1397.7387 {space 3} {res} 406.7116
{txt} 21{c |} {space 3} {res} 4680.0237 {space 3} {res} 1237.584 {space 3} {res} 367.90116
{txt} 22{c |} {space 3} {res} 4264.2633 {space 3} {res} 1103.2409 {space 3} {res} 334.65486
{txt} 23{c |} {space 3} {res} 3885.4379 {space 3} {res} 990.44955 {space 3} {res} 306.02247
{txt} 24{c |} {space 3} {res} 3540.2663 {space 3} {res} 895.6626 {space 3} {res} 281.23456
{txt} 25{c |} {space 3} {res} 3225.7588 {space 3} {res} 816.25649 {space 3} {res} 259.59417
{txt} 26{c |} {space 3} {res} 2939.1913 {space 3} {res} 750.07662 {space 3} {res} 240.58066
{txt} 27{c |} {space 3} {res} 2678.0817 {space 3} {res} 693.47635 {space 3} {res} 223.73861
{txt} 28{c |} {space 3} {res} 2440.1683 {space 3} {res} 643.46868 {space 3} {res} 208.49267
{txt} 29{c |} {space 3} {res} 2223.3904 {space 3} {res} 599.2883 {space 3} {res} 194.5465
{txt} 30{c |} {space 3} {res} 2025.8706 {space 3} {res} 561.87629 {space 3} {res} 182.29443
{txt} 31{c |} {space 3} {res} 1845.8978 {space 3} {res} 530.1486 {space 3} {res} 171.52546
{txt} 32{c |} {space 3} {res} 1681.9133 {space 3} {res} 503.19944 {space 3} {res} 162.05771
{txt} 33{c |} {space 3} {res} 1532.4968 {space 3} {res} 480.27153 {space 3} {res} 153.73349
{txt} 34{c |} {space 3} {res} 1396.354 {space 3} {res} 460.73137 {space 3} {res} 146.41531
{txt} 35{c |} {space 3} {res} 1272.3058 {space 3} {res} 444.04865 {space 3} {res} 139.98272 ^
{txt} 36{c |} {space 3} {res} 1159.2776 {space 3} {res} 429.7791 {space 3} {res} 134.32978
{txt} 37{c |} {space 3} {res} 1056.2906 {space 3} {res} 417.55025 {space 3} {res} 129.36305
{txt} 38{c |} {space 3} {res} 962.45264 {space 3} {res} 407.04957 {space 3} {res} 124.99996
{txt} 39{c |} {space 3} {res} 876.951 {space 3} {res} 398.01456 {space 3} {res} 121.16748
{txt} 40{c |} {space 3} {res} 799.04509 {space 3} {res} 390.22455 {space 3} {res} 117.80101
{txt} 41{c |} {space 3} {res} 728.06013 {space 3} {res} 383.49384 {space 3} {res} 114.84345
{txt} 42{c |} {space 3} {res} 663.38127 {space 3} {res} 377.66597 {space 3} {res} 112.2444
{txt} 43{c |} {space 3} {res} 604.44831 {space 3} {res} 372.60897 {space 3} {res} 109.95941
{txt} 44{c |} {space 3} {res} 550.75079 {space 3} {res} 368.21137 {space 3} {res} 107.94939
{txt} 45{c |} {space 3} {res} 501.82361 {space 3} {res} 364.37892 {space 3} {res} 106.17998
{txt} 46{c |} {space 3} {res} 457.24298 {space 3} {res} 361.03178 {space 3} {res} 104.62109
{txt} 47{c |} {space 3} {res} 416.62277 {space 3} {res} 358.10226 {space 3} {res} 103.24635
{txt} 48{c |} {space 3} {res} 379.61115 {space 3} {res} 355.53282 {space 3} {res} 102.03273
{txt} 49{c |} {space 3} {res} 345.88755 {space 3} {res} 353.27454 {space 3} {res} 100.96014 *
{txt} 50{c |} {space 3} {res} 315.15985 {space 3} {res} 353.56351 {space 3} {res} 100.54566
{txt} 51{c |} {space 3} {res} 287.16192 {space 3} {res} 358.15619 {space 3} {res} 101.22159
{txt} 52{c |} {space 3} {res} 261.65124 {space 3} {res} 365.35705 {space 3} {res} 102.96975
{txt} 53{c |} {space 3} {res} 238.40687 {space 3} {res} 369.66508 {space 3} {res} 104.79961
{txt} 54{c |} {space 3} {res} 217.22746 {space 3} {res} 370.95016 {space 3} {res} 106.38565
{txt} 55{c |} {space 3} {res} 197.92957 {space 3} {res} 372.74966 {space 3} {res} 108.15476
{txt} 56{c |} {space 3} {res} 180.34605 {space 3} {res} 375.87984 {space 3} {res} 109.75375
{txt} 57{c |} {space 3} {res} 164.32461 {space 3} {res} 378.13286 {space 3} {res} 111.19205
{txt} 58{c |} {space 3} {res} 149.72646 {space 3} {res} 379.31752 {space 3} {res} 112.39925
{txt} 59{c |} {space 3} {res} 136.42518 {space 3} {res} 379.96884 {space 3} {res} 113.65128
{txt} 60{c |} {space 3} {res} 124.30554 {space 3} {res} 379.47216 {space 3} {res} 114.64207
{txt} 61{c |} {space 3} {res} 113.26258 {space 3} {res} 378.6107 {space 3} {res} 115.2831
{txt} 62{c |} {space 3} {res} 103.20064 {space 3} {res} 379.47067 {space 3} {res} 116.07434
{txt} 63{c |} {space 3} {res} 94.032582 {space 3} {res} 380.87369 {space 3} {res} 116.91882
{txt} 64{c |} {space 3} {res} 85.678986 {space 3} {res} 382.03715 {space 3} {res} 117.67983
{txt} 65{c |} {space 3} {res} 78.067501 {space 3} {res} 380.53668 {space 3} {res} 118.00548
{txt} 66{c |} {space 3} {res} 71.1322 {space 3} {res} 377.904 {space 3} {res} 117.9601
{txt} 67{c |} {space 3} {res} 64.813011 {space 3} {res} 376.68599 {space 3} {res} 118.51554
{txt} 68{c |} {space 3} {res} 59.055202 {space 3} {res} 376.04184 {space 3} {res} 118.9979
{txt} 69{c |} {space 3} {res} 53.8089 {space 3} {res} 375.66725 {space 3} {res} 119.47501
{txt} 70{c |} {space 3} {res} 49.028666 {space 3} {res} 374.18355 {space 3} {res} 120.01102
{txt} 71{c |} {space 3} {res} 44.673094 {space 3} {res} 372.68744 {space 3} {res} 120.23184
{txt} 72{c |} {space 3} {res} 40.70446 {space 3} {res} 372.63602 {space 3} {res} 120.62715
{txt} 73{c |} {space 3} {res} 37.088388 {space 3} {res} 372.96002 {space 3} {res} 120.98856
{txt} 74{c |} {space 3} {res} 33.793558 {space 3} {res} 375.67225 {space 3} {res} 121.2765
{txt} 75{c |} {space 3} {res} 30.791431 {space 3} {res} 379.83266 {space 3} {res} 121.13771
{txt} 76{c |} {space 3} {res} 28.056005 {space 3} {res} 383.96921 {space 3} {res} 121.02467
{txt} 77{c |} {space 3} {res} 25.563587 {space 3} {res} 387.82565 {space 3} {res} 120.59418
{txt} 78{c |} {space 3} {res} 23.292588 {space 3} {res} 391.20473 {space 3} {res} 120.20296
{txt} 79{c |} {space 3} {res} 21.223339 {space 3} {res} 395.06233 {space 3} {res} 120.19574
{txt} 80{c |} {space 3} {res} 19.337916 {space 3} {res} 400.12432 {space 3} {res} 120.81217
{txt} 81{c |} {space 3} {res} 17.619989 {space 3} {res} 408.9831 {space 3} {res} 121.88139
{txt} 82{c |} {space 3} {res} 16.054678 {space 3} {res} 419.70456 {space 3} {res} 122.19761
{txt} 83{c |} {space 3} {res} 14.628424 {space 3} {res} 427.29042 {space 3} {res} 121.84983
{txt} 84{c |} {space 3} {res} 13.328875 {space 3} {res} 432.32449 {space 3} {res} 120.51138
{txt} 85{c |} {space 3} {res} 12.144775 {space 3} {res} 434.70003 {space 3} {res} 119.27437
{txt} 86{c |} {space 3} {res} 11.065867 {space 3} {res} 437.29344 {space 3} {res} 118.3797
{txt} 87{c |} {space 3} {res} 10.082806 {space 3} {res} 440.01255 {space 3} {res} 117.75625
{txt} 88{c |} {space 3} {res} 9.1870769 {space 3} {res} 442.78574 {space 3} {res} 117.34583
{txt} 89{c |} {space 3} {res} 8.3709223 {space 3} {res} 445.55799 {space 3} {res} 117.10114
{txt} 90{c |} {space 3} {res} 7.6272726 {space 3} {res} 448.28774 {space 3} {res} 116.98402
{txt} 91{c |} {space 3} {res} 6.9496867 {space 3} {res} 450.94415 {space 3} {res} 116.96386
{txt} 92{c |} {space 3} {res} 6.3322957 {space 3} {res} 453.50503 {space 3} {res} 117.01624
{txt} 93{c |} {space 3} {res} 5.769752 {space 3} {res} 455.955 {space 3} {res} 117.12177
{txt} 94{c |} {space 3} {res} 5.2571831 {space 3} {res} 458.28413 {space 3} {res} 117.26519
{txt} 95{c |} {space 3} {res} 4.7901495 {space 3} {res} 460.48672 {space 3} {res} 117.43449
{txt} 96{c |} {space 3} {res} 4.3646058 {space 3} {res} 462.56036 {space 3} {res} 117.62036
{txt} 97{c |} {space 3} {res} 3.9768663 {space 3} {res} 464.50518 {space 3} {res} 117.81559
{txt} 98{c |} {space 3} {res} 3.6235724 {space 3} {res} 466.32322 {space 3} {res} 118.01467
{txt} 99{c |} {space 3} {res} 3.3016642 {space 3} {res} 468.01793 {space 3} {res} 118.21343
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=21.95 20:23:06
{com}. assert 14==`e(nfolds)'
{txt}r; t=0.00 20:23:06
{com}.
. ********************************************************************************
. *** panel example
. ********************************************************************************
.
. use "http://fmwww.bc.edu/ec-p/data/macro/abdata.dta", clear
{txt}(Layard & Nickell, Unemployment in Britain, Economica 53, 1986 from Ox dist)
r; t=0.84 20:23:07
{com}.
. // FE and noftools options
. cvlasso ys l(0/3).k l(0/3).n, fe seed(123)
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 46.945458 {space 3} {res} .00843492 {space 3} {res} .00058496
{txt} 2{c |} {space 3} {res} 42.774952 {space 3} {res} .00813196 {space 3} {res} .0005897
{txt} 3{c |} {space 3} {res} 38.974944 {space 3} {res} .00773276 {space 3} {res} .00056315
{txt} 4{c |} {space 3} {res} 35.512517 {space 3} {res} .00737473 {space 3} {res} .00053581
{txt} 5{c |} {space 3} {res} 32.357683 {space 3} {res} .00706573 {space 3} {res} .0005092
{txt} 6{c |} {space 3} {res} 29.483116 {space 3} {res} .0068078 {space 3} {res} .0004852
{txt} 7{c |} {space 3} {res} 26.863917 {space 3} {res} .00659238 {space 3} {res} .0004636
{txt} 8{c |} {space 3} {res} 24.4774 {space 3} {res} .00641237 {space 3} {res} .00044421
{txt} 9{c |} {space 3} {res} 22.302896 {space 3} {res} .00626186 {space 3} {res} .00042685
{txt} 10{c |} {space 3} {res} 20.321568 {space 3} {res} .00613594 {space 3} {res} .00041134
{txt} 11{c |} {space 3} {res} 18.516256 {space 3} {res} .00603053 {space 3} {res} .00039754
{txt} 12{c |} {space 3} {res} 16.871323 {space 3} {res} .0059422 {space 3} {res} .00038527
{txt} 13{c |} {space 3} {res} 15.372521 {space 3} {res} .00586815 {space 3} {res} .00037439
{txt} 14{c |} {space 3} {res} 14.006868 {space 3} {res} .00580767 {space 3} {res} .00036394
{txt} 15{c |} {space 3} {res} 12.762537 {space 3} {res} .00575894 {space 3} {res} .00035376
{txt} 16{c |} {space 3} {res} 11.628748 {space 3} {res} .00571635 {space 3} {res} .00034367
{txt} 17{c |} {space 3} {res} 10.595682 {space 3} {res} .00567365 {space 3} {res} .00033312
{txt} 18{c |} {space 3} {res} 9.6543911 {space 3} {res} .00563169 {space 3} {res} .00032285
{txt} 19{c |} {space 3} {res} 8.7967216 {space 3} {res} .00558916 {space 3} {res} .00031273 ^
{txt} 20{c |} {space 3} {res} 8.0152451 {space 3} {res} .00555189 {space 3} {res} .00030398
{txt} 21{c |} {space 3} {res} 7.3031928 {space 3} {res} .00551614 {space 3} {res} .00029582
{txt} 22{c |} {space 3} {res} 6.6543973 {space 3} {res} .0054842 {space 3} {res} .00028853
{txt} 23{c |} {space 3} {res} 6.063239 {space 3} {res} .00545554 {space 3} {res} .00028109
{txt} 24{c |} {space 3} {res} 5.5245976 {space 3} {res} .00543376 {space 3} {res} .00027373
{txt} 25{c |} {space 3} {res} 5.0338075 {space 3} {res} .00541646 {space 3} {res} .00026706
{txt} 26{c |} {space 3} {res} 4.5866179 {space 3} {res} .00540234 {space 3} {res} .00026121
{txt} 27{c |} {space 3} {res} 4.1791554 {space 3} {res} .00539083 {space 3} {res} .00025608
{txt} 28{c |} {space 3} {res} 3.8078908 {space 3} {res} .00538147 {space 3} {res} .00025161
{txt} 29{c |} {space 3} {res} 3.4696083 {space 3} {res} .00537447 {space 3} {res} .00024786
{txt} 30{c |} {space 3} {res} 3.1613778 {space 3} {res} .00536953 {space 3} {res} .00024474
{txt} 31{c |} {space 3} {res} 2.8805297 {space 3} {res} .00536569 {space 3} {res} .00024204
{txt} 32{c |} {space 3} {res} 2.6246314 {space 3} {res} .00536274 {space 3} {res} .0002397
{txt} 33{c |} {space 3} {res} 2.3914664 {space 3} {res} .00536129 {space 3} {res} .00023773
{txt} 34{c |} {space 3} {res} 2.1790151 {space 3} {res} .0053607 {space 3} {res} .00023603
{txt} 35{c |} {space 3} {res} 1.9854374 {space 3} {res} .00536049 {space 3} {res} .00023456 *
{txt} 36{c |} {space 3} {res} 1.8090566 {space 3} {res} .0053616 {space 3} {res} .00023354
{txt} 37{c |} {space 3} {res} 1.648345 {space 3} {res} .00536378 {space 3} {res} .00023229
{txt} 38{c |} {space 3} {res} 1.5019106 {space 3} {res} .00536851 {space 3} {res} .00023011
{txt} 39{c |} {space 3} {res} 1.368485 {space 3} {res} .0053741 {space 3} {res} .00022843
{txt} 40{c |} {space 3} {res} 1.2469126 {space 3} {res} .00537969 {space 3} {res} .00022697
{txt} 41{c |} {space 3} {res} 1.1361403 {space 3} {res} .00538588 {space 3} {res} .00022581
{txt} 42{c |} {space 3} {res} 1.0352087 {space 3} {res} .00539219 {space 3} {res} .00022482
{txt} 43{c |} {space 3} {res} .94324363 {space 3} {res} .00539811 {space 3} {res} .00022394
{txt} 44{c |} {space 3} {res} .85944846 {space 3} {res} .00540365 {space 3} {res} .00022315
{txt} 45{c |} {space 3} {res} .78309743 {space 3} {res} .00540967 {space 3} {res} .00022263
{txt} 46{c |} {space 3} {res} .71352921 {space 3} {res} .0054163 {space 3} {res} .00022214
{txt} 47{c |} {space 3} {res} .65014124 {space 3} {res} .00542284 {space 3} {res} .00022161
{txt} 48{c |} {space 3} {res} .59238449 {space 3} {res} .00542904 {space 3} {res} .00022113
{txt} 49{c |} {space 3} {res} .53975868 {space 3} {res} .00543495 {space 3} {res} .00022071
{txt} 50{c |} {space 3} {res} .49180801 {space 3} {res} .00544044 {space 3} {res} .00022032
{txt} 51{c |} {space 3} {res} .44811714 {space 3} {res} .00544564 {space 3} {res} .00021997
{txt} 52{c |} {space 3} {res} .40830765 {space 3} {res} .00545055 {space 3} {res} .00021963
{txt} 53{c |} {space 3} {res} .37203472 {space 3} {res} .005455 {space 3} {res} .00021921
{txt} 54{c |} {space 3} {res} .33898418 {space 3} {res} .00545904 {space 3} {res} .00021881
{txt} 55{c |} {space 3} {res} .30886976 {space 3} {res} .0054628 {space 3} {res} .00021846
{txt} 56{c |} {space 3} {res} .28143062 {space 3} {res} .0054662 {space 3} {res} .00021811
{txt} 57{c |} {space 3} {res} .2564291 {space 3} {res} .00546937 {space 3} {res} .00021779
{txt} 58{c |} {space 3} {res} .23364865 {space 3} {res} .00547234 {space 3} {res} .00021749
{txt} 59{c |} {space 3} {res} .21289195 {space 3} {res} .00547504 {space 3} {res} .00021723
{txt} 60{c |} {space 3} {res} .19397921 {space 3} {res} .00547749 {space 3} {res} .000217
{txt} 61{c |} {space 3} {res} .17674663 {space 3} {res} .00547977 {space 3} {res} .0002168
{txt} 62{c |} {space 3} {res} .16104495 {space 3} {res} .00548186 {space 3} {res} .00021661
{txt} 63{c |} {space 3} {res} .14673816 {space 3} {res} .00548379 {space 3} {res} .00021644
{txt} 64{c |} {space 3} {res} .13370235 {space 3} {res} .00548544 {space 3} {res} .00021626
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=1.54 20:23:09
{com}. savedresults save ftools e()
{txt}r; t=0.01 20:23:09
{com}. cap noi assert "`e(noftools)'"=="" // will be error if ftools not installed
{txt}r; t=0.00 20:23:09
{com}. cvlasso ys l(0/3).k l(0/3).n, fe seed(123) noftools
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 46.945458 {space 3} {res} .00843492 {space 3} {res} .00058496
{txt} 2{c |} {space 3} {res} 42.774952 {space 3} {res} .00813196 {space 3} {res} .0005897
{txt} 3{c |} {space 3} {res} 38.974944 {space 3} {res} .00773276 {space 3} {res} .00056315
{txt} 4{c |} {space 3} {res} 35.512517 {space 3} {res} .00737473 {space 3} {res} .00053581
{txt} 5{c |} {space 3} {res} 32.357683 {space 3} {res} .00706573 {space 3} {res} .0005092
{txt} 6{c |} {space 3} {res} 29.483116 {space 3} {res} .0068078 {space 3} {res} .0004852
{txt} 7{c |} {space 3} {res} 26.863917 {space 3} {res} .00659238 {space 3} {res} .0004636
{txt} 8{c |} {space 3} {res} 24.4774 {space 3} {res} .00641237 {space 3} {res} .00044421
{txt} 9{c |} {space 3} {res} 22.302896 {space 3} {res} .00626186 {space 3} {res} .00042685
{txt} 10{c |} {space 3} {res} 20.321568 {space 3} {res} .00613594 {space 3} {res} .00041134
{txt} 11{c |} {space 3} {res} 18.516256 {space 3} {res} .00603053 {space 3} {res} .00039754
{txt} 12{c |} {space 3} {res} 16.871323 {space 3} {res} .0059422 {space 3} {res} .00038527
{txt} 13{c |} {space 3} {res} 15.372521 {space 3} {res} .00586815 {space 3} {res} .00037439
{txt} 14{c |} {space 3} {res} 14.006868 {space 3} {res} .00580767 {space 3} {res} .00036394
{txt} 15{c |} {space 3} {res} 12.762537 {space 3} {res} .00575894 {space 3} {res} .00035376
{txt} 16{c |} {space 3} {res} 11.628748 {space 3} {res} .00571635 {space 3} {res} .00034367
{txt} 17{c |} {space 3} {res} 10.595682 {space 3} {res} .00567365 {space 3} {res} .00033312
{txt} 18{c |} {space 3} {res} 9.6543911 {space 3} {res} .00563169 {space 3} {res} .00032285
{txt} 19{c |} {space 3} {res} 8.7967216 {space 3} {res} .00558916 {space 3} {res} .00031273 ^
{txt} 20{c |} {space 3} {res} 8.0152451 {space 3} {res} .00555189 {space 3} {res} .00030398
{txt} 21{c |} {space 3} {res} 7.3031928 {space 3} {res} .00551614 {space 3} {res} .00029582
{txt} 22{c |} {space 3} {res} 6.6543973 {space 3} {res} .0054842 {space 3} {res} .00028853
{txt} 23{c |} {space 3} {res} 6.063239 {space 3} {res} .00545554 {space 3} {res} .00028109
{txt} 24{c |} {space 3} {res} 5.5245976 {space 3} {res} .00543376 {space 3} {res} .00027373
{txt} 25{c |} {space 3} {res} 5.0338075 {space 3} {res} .00541646 {space 3} {res} .00026706
{txt} 26{c |} {space 3} {res} 4.5866179 {space 3} {res} .00540234 {space 3} {res} .00026121
{txt} 27{c |} {space 3} {res} 4.1791554 {space 3} {res} .00539083 {space 3} {res} .00025608
{txt} 28{c |} {space 3} {res} 3.8078908 {space 3} {res} .00538147 {space 3} {res} .00025161
{txt} 29{c |} {space 3} {res} 3.4696083 {space 3} {res} .00537447 {space 3} {res} .00024786
{txt} 30{c |} {space 3} {res} 3.1613778 {space 3} {res} .00536953 {space 3} {res} .00024474
{txt} 31{c |} {space 3} {res} 2.8805297 {space 3} {res} .00536569 {space 3} {res} .00024204
{txt} 32{c |} {space 3} {res} 2.6246314 {space 3} {res} .00536274 {space 3} {res} .0002397
{txt} 33{c |} {space 3} {res} 2.3914664 {space 3} {res} .00536129 {space 3} {res} .00023773
{txt} 34{c |} {space 3} {res} 2.1790151 {space 3} {res} .0053607 {space 3} {res} .00023603
{txt} 35{c |} {space 3} {res} 1.9854374 {space 3} {res} .00536049 {space 3} {res} .00023456 *
{txt} 36{c |} {space 3} {res} 1.8090566 {space 3} {res} .0053616 {space 3} {res} .00023354
{txt} 37{c |} {space 3} {res} 1.648345 {space 3} {res} .00536378 {space 3} {res} .00023229
{txt} 38{c |} {space 3} {res} 1.5019106 {space 3} {res} .00536851 {space 3} {res} .00023011
{txt} 39{c |} {space 3} {res} 1.368485 {space 3} {res} .0053741 {space 3} {res} .00022843
{txt} 40{c |} {space 3} {res} 1.2469126 {space 3} {res} .00537969 {space 3} {res} .00022697
{txt} 41{c |} {space 3} {res} 1.1361403 {space 3} {res} .00538588 {space 3} {res} .00022581
{txt} 42{c |} {space 3} {res} 1.0352087 {space 3} {res} .00539219 {space 3} {res} .00022482
{txt} 43{c |} {space 3} {res} .94324363 {space 3} {res} .00539811 {space 3} {res} .00022394
{txt} 44{c |} {space 3} {res} .85944846 {space 3} {res} .00540365 {space 3} {res} .00022315
{txt} 45{c |} {space 3} {res} .78309743 {space 3} {res} .00540967 {space 3} {res} .00022263
{txt} 46{c |} {space 3} {res} .71352921 {space 3} {res} .0054163 {space 3} {res} .00022214
{txt} 47{c |} {space 3} {res} .65014124 {space 3} {res} .00542284 {space 3} {res} .00022161
{txt} 48{c |} {space 3} {res} .59238449 {space 3} {res} .00542904 {space 3} {res} .00022113
{txt} 49{c |} {space 3} {res} .53975868 {space 3} {res} .00543495 {space 3} {res} .00022071
{txt} 50{c |} {space 3} {res} .49180801 {space 3} {res} .00544044 {space 3} {res} .00022032
{txt} 51{c |} {space 3} {res} .44811714 {space 3} {res} .00544564 {space 3} {res} .00021997
{txt} 52{c |} {space 3} {res} .40830765 {space 3} {res} .00545055 {space 3} {res} .00021963
{txt} 53{c |} {space 3} {res} .37203472 {space 3} {res} .005455 {space 3} {res} .00021921
{txt} 54{c |} {space 3} {res} .33898418 {space 3} {res} .00545904 {space 3} {res} .00021881
{txt} 55{c |} {space 3} {res} .30886976 {space 3} {res} .0054628 {space 3} {res} .00021846
{txt} 56{c |} {space 3} {res} .28143062 {space 3} {res} .0054662 {space 3} {res} .00021811
{txt} 57{c |} {space 3} {res} .2564291 {space 3} {res} .00546937 {space 3} {res} .00021779
{txt} 58{c |} {space 3} {res} .23364865 {space 3} {res} .00547234 {space 3} {res} .00021749
{txt} 59{c |} {space 3} {res} .21289195 {space 3} {res} .00547504 {space 3} {res} .00021723
{txt} 60{c |} {space 3} {res} .19397921 {space 3} {res} .00547749 {space 3} {res} .000217
{txt} 61{c |} {space 3} {res} .17674663 {space 3} {res} .00547977 {space 3} {res} .0002168
{txt} 62{c |} {space 3} {res} .16104495 {space 3} {res} .00548186 {space 3} {res} .00021661
{txt} 63{c |} {space 3} {res} .14673816 {space 3} {res} .00548379 {space 3} {res} .00021644
{txt} 64{c |} {space 3} {res} .13370235 {space 3} {res} .00548544 {space 3} {res} .00021626
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
r; t=0.99 20:23:10
{com}. assert "`e(noftools)'"=="noftools"
{txt}r; t=0.00 20:23:10
{com}. savedresults comp ftools e(), exclude(macros: lasso2opt)
{txt}r; t=0.00 20:23:10
{com}.
. ********************************************************************************
. *** check residuals with fe ***
. ********************************************************************************
.
. clear
{txt}r; t=0.00 20:23:10
{com}. use https://www.stata-press.com/data/r16/nlswork
{txt}(National Longitudinal Survey. Young Women 14-26 years of age in 1968)
r; t=2.75 20:23:12
{com}.
. replace ln_w = . if year == 80
{txt}(1,847 real changes made, 1,847 to missing)
r; t=0.00 20:23:12
{com}.
. cvlasso ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure ///
> c.tenure#c.tenure 2.race not_smsa south , fe
{txt}K-fold cross-validation with 10 folds. Elastic net with alpha=1.
Fold {res}1 2 3 4 5 6 7 8 9 10
{txt} {c |} {space 3} {txt} Lambda {space 3} {txt} MSPE {space 3} {txt} st. dev.
{hline 10}{c +}{hline 45}
{txt} 1{c |} {space 3} {res} 5773.8216 {space 3} {res} .19856956 {space 3} {res} .0049488
{txt} 2{c |} {space 3} {res} 5260.8912 {space 3} {res} .19510395 {space 3} {res} .004921
{txt} 3{c |} {space 3} {res} 4793.5281 {space 3} {res} .19181949 {space 3} {res} .00489047
{txt} 4{c |} {space 3} {res} 4367.6843 {space 3} {res} .18901926 {space 3} {res} .00486368
{txt} 5{c |} {space 3} {res} 3979.6712 {space 3} {res} .18662756 {space 3} {res} .00484006
{txt} 6{c |} {space 3} {res} 3626.1282 {space 3} {res} .18458098 {space 3} {res} .00481916
{txt} 7{c |} {space 3} {res} 3303.993 {space 3} {res} .18282633 {space 3} {res} .0048006
{txt} 8{c |} {space 3} {res} 3010.4753 {space 3} {res} .18130821 {space 3} {res} .00478317
{txt} 9{c |} {space 3} {res} 2743.033 {space 3} {res} .17993596 {space 3} {res} .004778
{txt} 10{c |} {space 3} {res} 2499.3495 {space 3} {res} .17872966 {space 3} {res} .00477046
{txt} 11{c |} {space 3} {res} 2277.3142 {space 3} {res} .17769003 {space 3} {res} .00476308
{txt} 12{c |} {space 3} {res} 2075.0039 {space 3} {res} .17679373 {space 3} {res} .00475651
{txt} 13{c |} {space 3} {res} 1890.6663 {space 3} {res} .17601938 {space 3} {res} .00475064
{txt} 14{c |} {space 3} {res} 1722.7047 {space 3} {res} .17534895 {space 3} {res} .00474538
{txt} 15{c |} {space 3} {res} 1569.6643 {space 3} {res} .17476725 {space 3} {res} .00474066
{txt} 16{c |} {space 3} {res} 1430.2197 {space 3} {res} .17426144 {space 3} {res} .00473641
{txt} 17{c |} {space 3} {res} 1303.1629 {space 3} {res} .17382067 {space 3} {res} .00473259
{txt} 18{c |} {space 3} {res} 1187.3935 {space 3} {res} .17343575 {space 3} {res} .00472914
{txt} 19{c |} {space 3} {res} 1081.9087 {space 3} {res} .17309888 {space 3} {res} .00472603
{txt} 20{c |} {space 3} {res} 985.79495 {space 3} {res} .17280815 {space 3} {res} .00472298
{txt} 21{c |} {space 3} {res} 898.21965 {space 3} {res} .17259251 {space 3} {res} .00472315
{txt} 22{c |} {space 3} {res} 818.42429 {space 3} {res} .1724332 {space 3} {res} .00472221
{txt} 23{c |} {space 3} {res} 745.71773 {space 3} {res} .17229934 {space 3} {res} .00471979
{txt} 24{c |} {space 3} {res} 679.47022 {space 3} {res} .17218835 {space 3} {res} .00471767
{txt} 25{c |} {space 3} {res} 619.10796 {space 3} {res} .17211746 {space 3} {res} .00471512
{txt} 26{c |} {space 3} {res} 564.10812 {space 3} {res} .17210271 {space 3} {res} .00471632
{txt} 27{c |} {space 3} {res} 513.99431 {space 3} {res} .17214254 {space 3} {res} .00471385
{txt} 28{c |} {space 3} {res} 468.33247 {space 3} {res} .17222045 {space 3} {res} .00471808
{txt} 29{c |} {space 3} {res} 426.7271 {space 3} {res} .17227965 {space 3} {res} .00472539
{txt} 30{c |} {space 3} {res} 388.81784 {space 3} {res} .17192789 {space 3} {res} .0047269
{txt} 31{c |} {space 3} {res} 354.27634 {space 3} {res} .17159449 {space 3} {res} .00471671
{txt} 32{c |} {space 3} {res} 322.8034 {space 3} {res} .17131531 {space 3} {res} .00470748
{txt} 33{c |} {space 3} {res} 294.12644 {space 3} {res} .17108137 {space 3} {res} .00469911
{txt} 34{c |} {space 3} {res} 267.99706 {space 3} {res} .17088517 {space 3} {res} .00469151
{txt} 35{c |} {space 3} {res} 244.18894 {space 3} {res} .17072048 {space 3} {res} .00468461
{txt} 36{c |} {space 3} {res} 222.49586 {space 3} {res} .17058212 {space 3} {res} .00467835
{txt} 37{c |} {space 3} {res} 202.72995 {space 3} {res} .17047156 {space 3} {res} .00467551
{txt} 38{c |} {space 3} {res} 184.71998 {space 3} {res} .17057963 {space 3} {res} .00469366
{txt} 39{c |} {space 3} {res} 168.30996 {space 3} {res} .17091839 {space 3} {res} .00471443
{txt} 40{c |} {space 3} {res} 153.35777 {space 3} {res} .17124862 {space 3} {res} .00473513
{txt} 41{c |} {space 3} {res} 139.73389 {space 3} {res} .17156271 {space 3} {res} .00475412
{txt} 42{c |} {space 3} {res} 127.32031 {space 3} {res} .17185986 {space 3} {res} .00477153
{txt} 43{c |} {space 3} {res} 116.00953 {space 3} {res} .1721397 {space 3} {res} .00478749
{txt} 44{c |} {space 3} {res} 105.70356 {space 3} {res} .17240223 {space 3} {res} .00480211
{txt} 45{c |} {space 3} {res} 96.313148 {space 3} {res} .17264771 {space 3} {res} .0048155
{txt} 46{c |} {space 3} {res} 87.756954 {space 3} {res} .17287589 {space 3} {res} .00482755
{txt} 47{c |} {space 3} {res} 79.960868 {space 3} {res} .17308128 {space 3} {res} .00483868
{txt} 48{c |} {space 3} {res} 72.857365 {space 3} {res} .17325719 {space 3} {res} .00484798
{txt} 49{c |} {space 3} {res} 66.384917 {space 3} {res} .17300192 {space 3} {res} .00484978
{txt} 50{c |} {space 3} {res} 60.487464 {space 3} {res} .16975386 {space 3} {res} .00474188
{txt} 51{c |} {space 3} {res} 55.113925 {space 3} {res} .16663803 {space 3} {res} .00459007
{txt} 52{c |} {space 3} {res} 50.217755 {space 3} {res} .16390797 {space 3} {res} .00446813
{txt} 53{c |} {space 3} {res} 45.756548 {space 3} {res} .16151347 {space 3} {res} .00436426
{txt} 54{c |} {space 3} {res} 41.691663 {space 3} {res} .15941168 {space 3} {res} .00426958
{txt} 55{c |} {space 3} {res} 37.98789 {space 3} {res} .15754081 {space 3} {res} .00418546
{txt} 56{c |} {space 3} {res} 34.613151 {space 3} {res} .155927 {space 3} {res} .00410732
{txt} 57{c |} {space 3} {res} 31.538214 {space 3} {res} .15449554 {space 3} {res} .00404327
{txt} 58{c |} {space 3} {res} 28.736446 {space 3} {res} .15321279 {space 3} {res} .00398651
{txt} 59{c |} {space 3} {res} 26.183579 {space 3} {res} .15206188 {space 3} {res} .00393612
{txt} 60{c |} {space 3} {res} 23.857502 {space 3} {res} .15102807 {space 3} {res} .00389131
{txt} 61{c |} {space 3} {res} 21.738068 {space 3} {res} .15009843 {space 3} {res} .00385139
{txt} 62{c |} {space 3} {res} 19.806918 {space 3} {res} .14927115 {space 3} {res} .00381774
{txt} 63{c |} {space 3} {res} 18.047326 {space 3} {res} .14852849 {space 3} {res} .00378817
{txt} 64{c |} {space 3} {res} 16.444051 {space 3} {res} .14785866 {space 3} {res} .00376163
{txt} 65{c |} {space 3} {res} 14.983207 {space 3} {res} .14725404 {space 3} {res} .00373777
{txt} 66{c |} {space 3} {res} 13.65214 {space 3} {res} .14668285 {space 3} {res} .00372168
{txt} 67{c |} {space 3} {res} 12.439321 {space 3} {res} .14613422 {space 3} {res} .00370749
{txt} 68{c |} {space 3} {res} 11.334246 {space 3} {res} .14561919 {space 3} {res} .00368416 ^
{txt} 69{c |} {space 3} {res} 10.327343 {space 3} {res} .14511215 {space 3} {res} .00366867
{txt} 70{c |} {space 3} {res} 9.4098905 {space 3} {res} .14465224 {space 3} {res} .00365593
{txt} 71{c |} {space 3} {res} 8.5739418 {space 3} {res} .1442048 {space 3} {res} .00364741
{txt} 72{c |} {space 3} {res} 7.8122564 {space 3} {res} .14377088 {space 3} {res} .00363502
{txt} 73{c |} {space 3} {res} 7.1182371 {space 3} {res} .14337589 {space 3} {res} .00362281
{txt} 74{c |} {space 3} {res} 6.4858725 {space 3} {res} .14301825 {space 3} {res} .00361182
{txt} 75{c |} {space 3} {res} 5.9096855 {space 3} {res} .14269424 {space 3} {res} .00360191
{txt} 76{c |} {space 3} {res} 5.3846853 {space 3} {res} .14240058 {space 3} {res} .00359296
{txt} 77{c |} {space 3} {res} 4.9063247 {space 3} {res} .14213084 {space 3} {res} .00358412 *
{txt}* lopt = the lambda that minimizes MSPE.
Run model: {stata cvlasso, lopt}
{p 0 8 2}^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.{p_end}
Run model: {stata cvlasso, lse}
{err}Warning: lopt is at the limit of the lambda range.
{txt}r; t=19.73 20:23:32
{com}. cvlasso, lse postres ols
{txt}Estimate lasso with lambda=11.334 (lse).
{res}
{txt}{hline 18}{c TT}{hline 32}
{col 10}Selected {c |} Lasso Post-est OLS
{hline 18}{c +}{hline 32}
{space 14}age {c |}{col 21}{res} 0.0276373 0.0330033
{txt}{space 17} {c |}
{space 6}c.age#c.age {c |}{col 21}{res} -0.0005866 -0.0006806
{txt}{space 17} {c |}
{space 10}ttl_exp {c |}{col 21}{res} 0.0367445 0.0372828
{txt}{space 11}tenure {c |}{col 21}{res} 0.0356436 0.0357082
{txt}{space 17} {c |}
c.tenure#c.tenure {c |}{col 21}{res} -0.0019053 -0.0019142
{txt}{space 17} {c |}
{space 9}not_smsa {c |}{col 21}{res} -0.0892079 -0.0899220
{txt}{space 12}south {c |}{col 21}{res} -0.0597044 -0.0605564
{txt}{hline 18}{c BT}{hline 32}
r; t=0.34 20:23:32
{com}.
. local sel = e(selected)
{txt}r; t=0.00 20:23:32
{com}. di "`sel'"
{res}age c.age#c.age ttl_exp tenure c.tenure#c.tenure not_smsa south
{txt}r; t=0.00 20:23:32
{com}.
. predict double uehat , ue noi
{txt}Use e(b) from previous lasso2 estimation (lambda=11.33424642913).
(2,253 missing values generated)
Beta used for predict:
{res}{txt} c.age# c.tenure#
age c.age ttl_exp tenure c.tenure not_smsa
y1 {res} .0330033 -.00068058 .03728278 .0357082 -.00191421 -.08992203
{txt}
south
y1 {res} -.06055644
{reset}r; t=0.08 20:23:32
{com}. predict double ehat , e noi
{txt}Use e(b) from previous lasso2 estimation (lambda=11.33424642913).
{res}{txt}(2,255 missing values generated)
Beta used for predict:
{res}{txt} c.age# c.tenure#
age c.age ttl_exp tenure c.tenure not_smsa
y1 {res} .0330033 -.00068058 .03728278 .0357082 -.00191421 -.08992203
{txt}
south
y1 {res} -.06055644
{reset}r; t=0.10 20:23:33
{com}. predict double xbhat , xb noi
{txt}Use e(b) from previous lasso2 estimation (lambda=11.33424642913).
(441 missing values generated)
Beta used for predict:
{res}{txt} c.age# c.tenure#
age c.age ttl_exp tenure c.tenure not_smsa
y1 {res} .0330033 -.00068058 .03728278 .0357082 -.00191421 -.08992203
{txt}
south
y1 {res} -.06055644
{reset}r; t=0.07 20:23:33
{com}. predict double xbuhat , xbu noi
{txt}Use e(b) from previous lasso2 estimation (lambda=11.33424642913).
{res}{txt}(2,255 missing values generated)
Beta used for predict:
{res}{txt} c.age# c.tenure#
age c.age ttl_exp tenure c.tenure not_smsa
y1 {res} .0330033 -.00068058 .03728278 .0357082 -.00191421 -.08992203
{txt}
south
y1 {res} -.06055644
{reset}r; t=0.10 20:23:33
{com}. predict double uhat , u noi
{txt}Use e(b) from previous lasso2 estimation (lambda=11.33424642913).
(2,255 missing values generated)
{res}Beta used for predict:
{txt} c.age# c.tenure#
age c.age ttl_exp tenure c.tenure not_smsa
y1 {res} .0330033 -.00068058 .03728278 .0357082 -.00191421 -.08992203
{txt}
south
y1 {res} -.06055644
{reset}r; t=0.10 20:23:33
{com}.
. xtreg ln_w `sel' if e(sample), fe
{res}
{txt}Fixed-effects (within) regression{col 49}Number of obs{col 67}={col 69}{res} 26,279
{txt}Group variable: {res}idcode{txt}{col 49}Number of groups{col 67}={col 69}{res} 4,686
{txt}R-sq:{col 49}Obs per group:
within = {res}0.1786{col 63}{txt}min{col 67}={col 69}{res} 1
{txt} between = {res}0.3530{col 63}{txt}avg{col 67}={col 69}{res} 5.6
{txt} overall = {res}0.2662{col 63}{txt}max{col 67}={col 69}{res} 14
{txt}{col 49}F({res}7{txt},{res}21586{txt}){col 67}={col 70}{res} 670.64
{txt}corr(u_i, Xb){col 16}= {res}0.1930{txt}{col 49}Prob > F{col 67}={col 73}{res}0.0000
{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1} ln_wage{col 14}{c |} Coef.{col 26} Std. Err.{col 38} t{col 46} P>|t|{col 54} [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}age {c |}{col 14}{res}{space 2} .0330033{col 26}{space 2} .0029458{col 37}{space 1} 11.20{col 46}{space 3}0.000{col 54}{space 4} .0272294{col 67}{space 3} .0387772
{txt}{space 12} {c |}
{space 1}c.age#c.age {c |}{col 14}{res}{space 2}-.0006806{col 26}{space 2} .0000487{col 37}{space 1} -13.97{col 46}{space 3}0.000{col 54}{space 4}-.0007761{col 67}{space 3}-.0005851
{txt}{space 12} {c |}
{space 5}ttl_exp {c |}{col 14}{res}{space 2} .0372828{col 26}{space 2} .0015061{col 37}{space 1} 24.75{col 46}{space 3}0.000{col 54}{space 4} .0343307{col 67}{space 3} .0402349
{txt}{space 6}tenure {c |}{col 14}{res}{space 2} .0357082{col 26}{space 2} .0017123{col 37}{space 1} 20.85{col 46}{space 3}0.000{col 54}{space 4} .032352{col 67}{space 3} .0390644
{txt}{space 12} {c |}
{space 4}c.tenure#{c |}
{space 4}c.tenure {c |}{col 14}{res}{space 2}-.0019142{col 26}{space 2} .0001095{col 37}{space 1} -17.47{col 46}{space 3}0.000{col 54}{space 4}-.0021289{col 67}{space 3}-.0016995
{txt}{space 12} {c |}
{space 4}not_smsa {c |}{col 14}{res}{space 2} -.089922{col 26}{space 2} .0099008{col 37}{space 1} -9.08{col 46}{space 3}0.000{col 54}{space 4}-.1093284{col 67}{space 3}-.0705157
{txt}{space 7}south {c |}{col 14}{res}{space 2}-.0605564{col 26}{space 2} .0114483{col 37}{space 1} -5.29{col 46}{space 3}0.000{col 54}{space 4}-.0829959{col 67}{space 3} -.038117
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} 1.074643{col 26}{space 2} .0433838{col 37}{space 1} 24.77{col 46}{space 3}0.000{col 54}{space 4} .9896076{col 67}{space 3} 1.159678
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
sigma_u {c |} {res} .35740248
{txt}sigma_e {c |} {res} .29207998
{txt}rho {c |} {res} .59956903{txt} (fraction of variance due to u_i)
{hline 13}{c BT}{hline 64}
F test that all u_i=0: F({res}4685{txt}, {res}21586{txt}) = {res}6.23{col 62}{txt}Prob > F = {res}0.0000
{txt}r; t=1.22 20:23:34
{com}. mat bxtreg = e(b)
{txt}r; t=0.01 20:23:34
{com}.
. predict double uehat_xtreg , ue
{txt}(2,253 missing values generated)
r; t=0.02 20:23:34
{com}. predict double ehat_xtreg , e
{txt}(2,255 missing values generated)
r; t=0.15 20:23:34
{com}. predict double xbhat_xtreg , xb
{txt}(441 missing values generated)
r; t=0.01 20:23:34
{com}. predict double xbuhat_xtreg , xbu
{txt}(2,255 missing values generated)
r; t=0.13 20:23:34
{com}. predict double uhat_xtreg , u
{txt}(2,255 missing values generated)
r; t=0.13 20:23:35
{com}.
. assert abs(ehat_xtreg-ehat)<10e-8 | (missing(ehat_xtreg) | missing(ehat))
{txt}r; t=0.01 20:23:35
{com}. assert abs(uehat_xtreg-uehat)<10e-8 | (missing(uehat_xtreg) | missing(uehat))
{txt}r; t=0.01 20:23:35
{com}. assert abs(xbhat_xtreg-xbhat)<10e-8 | (missing(xbhat_xtreg) | missing(xbhat))
{txt}r; t=0.01 20:23:35
{com}. assert abs(xbuhat_xtreg-xbuhat)<10e-8 | (missing(xbuhat_xtreg) | missing(xbuhat))
{txt}r; t=0.01 20:23:35
{com}. assert abs(uhat_xtreg-uhat)<10e-8 | (missing(uhat_xtreg) | missing(uhat))
{txt}r; t=0.01 20:23:35
{com}.
.
. ********************************************************************************
. *** finish ***
. ********************************************************************************
.
. cap log close
{smcl}
{com}{sf}{ul off}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/arlionn/lassopack.git
git@gitee.com:arlionn/lassopack.git
arlionn
lassopack
lassopack
master

搜索帮助