Fin Maverick
Foundations VocabularyAccounting & ReportingEconomics & MacroQuant Methods & ProgrammingBusiness & Company AnalysisCorporate Finance & ValuationBehavioural Finance
Banking & Market InfrastructureFixed Income & RatesDerivatives & Structured ProductsPublic EquitiesTransactions & DealsPortfolio ConstructionFunds & AMCs
Private Markets & AlternativesRisk, Treasury & ControlAI & Digital FinanceStochastic Calculus & PricingWealth & Personal FinanceIndian Markets & RegulationProfessional Practice
CalculatorComparison
Frameworks
Explore Bootcamps
Equity ResearchPortfolio ManagementMutual Fund MasteryFinancial LiteracyInvestment Banking Analyst
Private Equity AnalystHedge Funds AnalystBreaking Into VCBreaking Into QuantsAI For Finance
Financial Analyst ProgramRisk Management ProgramPrivate Wealth ManagementDebt Capital MarketsDerivatives Foundation
Explore Internships
Equity Research InternMutual Fund Intern
Portfolio Management InternFinancial Literacy Intern
Explore Micro Courses

Equity Research6

Writing an Investment ThesisBuilding a Discounted Cash FlowReading an Annual Report FastReading a Sector Before a CompanySpotting Quality of Earnings Red FlagsBuilding a Revenue Forecast From Drivers

Portfolio Management3

Rebalancing: When, Why and What It CostsStrategic and Tactical Asset AllocationMeasuring Risk in a Portfolio

Mutual Fund Mastery3

Comparing Funds Without Being FooledHow a NAV Is Struck and Which Day You GetReading a Fund Factsheet Properly

Derivatives Unlocked4

Hedging a Real ExposureThe Greeks, PracticallyFutures, the Basis and What Moves ItReading an Option Payoff

AI For Finance2

Retrieval and Grounding for FinanceDocument Extraction in Finance

Breaking Into Quants4

Backtesting a StrategyHypothesis TestingCleaning Financial DataRegression for Finance

Breaking Into VC3

Sizing a MarketReading a Term Sheet as a FounderHow a Venture Round Actually Works

Financial Analyst Program4

Common Size and Trend AnalysisReading a Cash Flow StatementRatio Analysis That Says SomethingBuilding a Working Capital Schedule

Risk Management Program2

Credit Exposure and How It Is ReducedValue at Risk and What It Hides

Investment Banking Analyst3

Precedent Transactions and Why They DifferReading a Term Sheet StructurallyBuilding a Comparable Companies Table

Private Wealth Management3

Tax Aware Portfolio DecisionsBuilding a Client Risk ProfileGoal Based Planning Arithmetic

Debt Capital Markets3

Analysing an Issuer's CreditDuration and What It Does Not Tell YouBond Pricing and Yield Mechanics

Private Equity Analyst2

Fund Waterfalls and CarryThe LBO in Structure

Hedge Funds Analyst2

Short Selling MechanicsLong Short Mechanics
Courses
Explore Career Roadmaps
Investment Banking AnalystEquity Research AnalystVC AnalystPrivate Equity AnalystHedge Funds Analyst
Quant AnalystAI For FinanceFinancial Analyst ProgramPrivate Wealth ManagementDebt Capital Markets
Risk Management ProgramDerivatives FoundationPortfolio ManagementMutual Fund Mastery
PartnershipsShowdown
Log inSign up
Quantitative Methods, Financial Data & Programming
1Probability
Probability in FinanceRandom VariableProbability DistributionsThe Normal DistributionNormal Distribution ProbabilityThe Lognormal DistributionRandomness vs Uncertainty
2Statistics and Inference
Population and SampleMean, Median and ModePrecision and AccuracyVariable TypesVariance, Standard Deviation and…Dispersion MeasuresStatistical BiasEffect SizeHypothesis TestingThe Sampling DistributionSkewnessKurtosisCovarianceConfidence IntervalArithmetic Mean vs Geometric MeanStatistical Significance vs Economic…Confidence Interval vs Prediction IntervalHow to Summarise a…
3Correlation and Regression
RegressionCorrelation and CausationOrdinary Least SquaresInteraction TermsRegression CoefficientsRegression vs ClassificationHow to Build a…Spurious CorrelationRegression, Correlation and FitResidualsMulticollinearityAutocorrelation and Partial Autocorrelation
4Time Series
Time Series in FinanceSimple, Weighted and Exponential…Moving Average CalculatorPrice, Return and Level SeriesHow to Prepare Time-Series…LagFrequencySeasonalityTimestampsTrendStationarity and the Unit RootHeteroskedasticityLeadRolling WindowsDifferencing
5Simulation and Numerical Methods
SimulationMonte Carlo SimulationHow to Run a…Numerical MethodsIterationResampling and the BootstrapPseudorandom Numbers and the SeedConvergence and ToleranceNumerical Stability
6Optimisation
OptimisationLocal and Global OptimaConstraintsConvex OptimisationThe SolverLinear ProgrammingThe Objective FunctionConstraint ViolationThe Feasible SetLagrange MultipliersQuadratic Programming
7Modelling Practice
Linear, Logistic, Ridge and…Training, Validation and Test…The ModelModel ErrorDependent and Independent VariablesThe ROC Curve and AUCWhat a Model HoldsMSE, RMSE, MAE and MAPEPrecision and RecallCross Validation and RegularisationOverfitting and UnderfittingReturn Series MeasuresSimple, Compound and Log Return
8Backtesting and Research Integrity
BacktestingBacktest vs Live PerformanceHow to Document a…How to Prevent Backtest…Out-of-Sample TestingWalk-Forward AnalysisMultiple TestingP-HackingData Snooping
9Data Quality and Structure
Data QualityThe DatasetSelection and Survivorship BiasVersioned DatasetsData Structures in FinanceData CleaningMissing Data and Null ValuesStructured Data vs Unstructured DataMissing Data vs ZeroData Validation vs Data CleaningOutliersDuplicate Records
10Programming for Finance
Data PipelinesAPIs for Financial DataAPI vs CSV FileDatabases in FinancePython for FinanceJoinsSQL for FinanceThe Analysis Workflow
11Quantitative Research
Research DesignThe Data Generating ProcessReproducibilityPeer Review in Analytical WorkThe Research HypothesisRobustness and Sensitivity

Linear, Logistic, Ridge and Lasso Regression Compared

Four things arrive here already finished: a fitted line, the claim each of its two numbers makes, the way a fit gets scored, and the leftover when a rule misses. Earlier reading settled all four. The ten paired months worked through below arrive the same way, whole and unedited, down to the last decimal place.

What do all four of these forms have in common?

One thing is rarely said outright, and it makes the next thousand words much easier. All four of these forms do the same arithmetic. Every one of them takes the inputs it is given, multiplies each input by its own number, adds the results together, and then reads an answer off that total. The multiplying number attached to each input is called its coefficientThe number a fitted rule multiplies one input by. If the coefficient on rainfall is 1.5, the rule adds 1.5 for every extra unit of rain. It is settled by the fitting and is not chosen by hand., and fitting, in every one of these four forms, is the work of settling those numbers.

Picture three shops on one street, all selling the same thing, all setting tomorrow's price by adding up the same handful of costs: what they paid for the goods, what the rent works out to per item, what the electricity costs, what they think the shop next door will do. The three of them never argue about the arithmetic. Adding things up is adding things up. The three shopkeepers argue about how much weight each cost should carry, and about whether anybody is allowed to put an enormous weight on one item just because it made last month's numbers come out neatly. The argument over weights is the entire disagreement between these four forms, and it comes down to exactly two questions.

The first question is about what the answer describes. Linear regression, ridge and lasso all hand back a size: a number carrying the outcome's own units, whatever those happen to be. Logistic regression hands back something else entirely: a chance, a number obliged to sit between nought and one because it is a statement about how likely a yes is.

The second question is whether the size of the coefficients is punished. Plain linear regression and logistic regression do not care how large a coefficient grows, so long as the fit comes out well. Ridge and lasso both add a charge that grows as the coefficients grow, and they differ in how that charge is worked out. Between them the two questions place a form nobody has met before, and placing a form is worth more than memorising four recipes.

THE FORM WHAT THE ANSWER IS ABOUT IS SIZE CHARGED FOR? linear the SIZE of the outcome any number at all, no ceiling no logistic the CHANCE of a yes always between nought and one no ridge the SIZE of the outcome the same as linear yes, by the SQUARED size lasso the SIZE of the outcome the same as linear yes, by the PLAIN size All four add up inputs multiplied by coefficients. That part never changes, and it is not what separates them. Only these two columns do.
The four forms differ in exactly two places, what the answer is a statement about and whether the size of the coefficients is charged for, and the shared arithmetic underneath is identical in all four.
Try it out

Name the two questions that separate all four of these forms from each other.

What does linear regression fit, and what does it read at the edges?

The worked record here is ten months long. Two invented columns of figures run down it, the Nakshatra unit and the Vasant unit, and every month carries one reading from each. Which column plays which part is settled already: readings of the first go in, and readings of the second are what a rule has to produce. Earlier reading ran a straight line through those ten pairs, and it came out as 0.5000, with a further 1.5000 added for each point the Nakshatra reading carries. Its interceptThe number a fitted rule returns when every input reads nought. It is where the line meets the vertical axis, and it is settled by the fitting alongside the coefficients. is 0.5000, its coefficient is 1.5000, and its R squaredA score between nought and one saying what share of the outcome's up and down movement the rule accounted for. It was built and explained in the earlier reading on fitting a line. is 0.7559.

The next question is what comes out of that line when a number goes in. A Nakshatra reading of 6.00 per cent gives back 9.50 per cent. Minus 9.00 gives back minus 13.00. And 400.00 gives back 600.50 without hesitation. Nothing anywhere in the arithmetic says that a Vasant change of 600.50 per cent is a strange thing to say. Linear regression answers a question about a size, and a size is allowed to be any number at all. Being allowed any number is exactly right when the question is how much, and exactly wrong when the question is whether.

The freedom to return any number at all is a feature and not a bug. If the question is how many litres of water a housing society tank will need tomorrow, the answer has to be free to come out at 4,200 or 11,600 or anything in between, and it has to be able to come out larger than anything that has happened before. A rule that quietly refused to say a number above 10,000 would be lying. The trouble starts only when the same freedom is pointed at a question that has a ceiling built into it.

Try it out

The straight line on the size of the Vasant unit's monthly change has an R squared of 0.7559. Does that say how often it calls the direction correctly?

Breaking Into Quants Bootcamp — Fin Maverick

What happens when that same straight line is handed a yes or no question?

Here is the experiment, and it changes only one thing. Keep the same ten months and the same Nakshatra readings, and throw away the size of the Vasant unit's monthly change, keeping only whether it rose. The month that moved 18.50 per cent is now simply an up month. So is the month that moved 2.50 per cent. The biggest month on the record and one that barely twitched have collapsed into a single category. Down swallows minus 1.00 per cent and minus 13.00 per cent with equal indifference. Counted out, the ten split five each way. The up or down reading is the month's labelA short word standing for which group something falls into, rather than a measurement of it. Here each month carries one of two labels, up or down, and there is nothing in between them..

Now a straight line is fitted to that, exactly the way a line was fitted to the size. The arithmetic does not object. With up as one and down as nought, the same fitting returns a line that starts at 0.4500 and climbs by 0.0500 for each Nakshatra point. The slope checks in one step: the ten Nakshatra readings sit 300 in squared distance from their own average, they cross with the labels at 15, and 15 divided by 300 is 0.0500.

Read that rule across the record and it looks almost suspiciously tidy. At the smallest month on the record, a Nakshatra change of minus 9.00 per cent, it returns exactly 0.0000. At the largest month, a change of 11.00 per cent, it returns exactly 1.0000. Everything in between lands somewhere inside, at 0.2500, 0.5000 and 0.7500. A reader glancing at that could easily conclude the form is well behaved and move on.

So push it one step further out, to a Nakshatra reading of 15.00 per cent, four points past the largest month anybody has recorded. The rule returns 1.2000. Offered as a chance, 1.2000 is meaningless, and not one step of the arithmetic paused over it, flinched, or warned anybody. Go the other way, to a reading of minus 15.00 per cent, and it returns minus 0.3000. Minus 0.3000 is not a chance either. Having a floor and a ceiling was never part of what a straight line is, so a straight line has no floor and no ceiling.

a chance of one, the ceiling a chance has a chance of nought, the floor a chance has 1.00 0.50 0.00 1.20 minus 0.30 reads 1.2000, above the ceiling and it is under the floor for every reading below minus 9.00 exactly 1.0000 exactly 0.0000 minus 9.00 minus 4.00 1.00 6.00 11.00 the Nakshatra unit's monthly change, in per cent. All figures invented. outside the band. not a chance.
The straight line fitted to the label reads exactly 1.0000 at the largest month and exactly 0.0000 at the smallest, then walks straight out of the nought to one band at both ends, reaching 1.2000 at a reading of 15.00 per cent.
Try it out

Before the answer below. The straight line on the label reads exactly 1.0000 at the largest month on the record. Four points further out, at a Nakshatra change of 15.00 per cent, what does it read?

What does Logistic Regression fit instead, and what does it read at those same edges?

Logistic regression is the form built for exactly this problem. Logistic regression takes the same inputs, multiplies each by its own coefficient and adds them up in the same way, and then does one extra thing at the end: it pushes that total through a squashing step before reporting it. The squashing step takes any total at all, however wild, and returns one divided by one plus a positive number. Since the thing on the bottom is always larger than one, the answer is always smaller than one, and since the thing on the bottom is always positive, the answer is always larger than nought. The ceiling and the floor are not rules bolted on afterwards. Both fall out of the shape of the squashing step itself.

Fit that form to the same ten months, the same Nakshatra readings and the same up or down labels, and it settles on a curve that crosses one half at a Nakshatra change of exactly 1.00 per cent, the Nakshatra unit's own average across the ten months. The coefficient it settles on is 0.2839. Read the curve at the five distinct readings the record actually contains and it returns 0.0553 at minus 9.00, 0.1947 at minus 4.00, 0.5000 at 1.00, 0.8053 at 6.00 and 0.9447 at 11.00.

Now push the curve to the same place that broke the straight line, a reading of 15.00 per cent. The curve returns 0.9816. Push it much harder, to 44.00 per cent, four times the largest month on the record, and it returns 0.999995. Push it to 110.00 per cent, ten times the largest month, and the answer is so close to one that four decimal places cannot show the difference any more. But one divided by one plus a positive number is below one no matter how large that positive number grows, so the difference is still there, and it is there for every reading that could ever be named. The curve approaches one forever and arrives never, and that is the whole reason the form exists.

1.00 0.50 0.00 0.0553 0.1947 0.5000 0.8053 0.9447 minus 9.00 minus 4.00 1.00 6.00 11.00 the curve never leaves the band, at either end the Nakshatra unit's monthly change, in per cent. All figures invented. MAGNIFIED: READINGS 10.00 TO 15.00, CHANCES 0.92 TO 1.02 1.00 0.96 0.92 1.02 the straight line crosses one here, at 11.00 the curve reaches 0.9816 and keeps climbing and leaves the top of this strip at 11.40 11.00 12.00 13.00 14.00 15.00 The gap between the curve and a chance of one is real at every reading. It shrinks forever and it never closes, which is why the strip has to be magnified to show it at all.
The logistic curve reads 0.0553, 0.1947, 0.5000, 0.8053 and 0.9447 across the record and 0.9816 at a reading of 15.00 per cent, staying under one at every reading while the straight line has already crossed it.
Try it out

The logistic curve reads 0.9816 at a Nakshatra change of 15.00 per cent. How far would the reading have to be pushed to make it reach exactly one?

Play with it

Walk one reading outward and watch which shape survives it.

One control moves the Nakshatra reading a chance is being asked for, from minus 15.00 per cent to 15.00 per cent. Both fitted shapes redraw with a marker sliding along each, and the nought to one band stays shaded, so which shape leaves it is visible at a glance. The second row of buttons widens the whole horizontal scale without touching either shape. Out past the record is where the two shapes part company for good. Left alone, the control rests at 15.00 per cent, where the straight line returns 1.2000 and the logistic curve returns 0.9816, reproducing the worked example above exactly.

Jump the reading to:
Widen the horizontal scale:
The straight line reads
1.2000
Still a chance?
no
The logistic curve reads
0.9816
Still a chance?
yes
Held still at every setting: the ten months, both fitted shapes, the straight line starting at 0.4500 and rising 0.0500 a point, and the logistic curve crossing one half at 1.00 per cent. Only the reading and the width of the scale move.

Educational illustration. Both columns were made up for this lesson alone and match nothing outside it, and the ten months never happened. Walking the reading outward shows what each fitted shape returns and nothing more, and a chance read off ten made up months is a statement about arithmetic rather than about anything real.

AI For Finance Bootcamp — Fin Maverick

Do the two forms actually disagree on this record?

Most treatments skip the next question, and skipping it turns an honest comparison into a sales pitch. After the straight line embarrasses itself at 1.2000, the logistic curve might be expected to beat it on the ten months as well. It does not. It ties.

Call a month up whenever the fitted chance is one half or more. The half way cut is called a thresholdThe line somebody draws across a fitted chance to turn it into a call. Above the line the answer is yes, below it the answer is no. Where to draw it is a separate question taken up in later reading.. Apply it to the straight line and it calls seven of the ten months up. Apply it to the logistic curve and it calls the same seven months up. Not a similar seven. The same seven, month for month. Both shapes rise with the Nakshatra reading, and both cross one half at exactly the same place, a reading of 1.00 per cent.

So the two forms produce one identical scoreboard. Four months called up really rose, three called up really fell, one called down really rose and two called down really fell. Six calls out of ten came out right, an accuracyThe share of calls that came out right, counted across every case. Six right out of ten is 60.00 per cent. Two other views of the same set of calls are built in later reading. of 60.00 per cent for both, against 50.00 per cent for a rule that never glances at the Nakshatra reading and answers up to whatever is put in front of it. And because the logistic curve is a rising rearrangement of the very same total, it ranks the ten months in exactly the order the straight line ranks them, so every score built out of that ranking comes out the same too, including an area under the curve of 0.8000 that later reading takes apart properly.

One housekeeping note while three numbers are on the table together. The 0.8000 just quoted, the 60.00 per cent beside it, and a recall of 80.00 per cent that later reading will quote from this same set of calls are three different quantities on three different scales that happen to look alike, and the resemblance between them means nothing whatsoever.

The two forms differ where the record does not reach, and this record does not reach there, so a claim that the logistic form calls these ten months better would be inventing a difference that is not in the arithmetic. The reason to reach for the logistic form is not that it wins here. The reason is that the logistic form cannot produce 1.2000 and the straight line can, and the question being asked will not always fall inside the record it was fitted on.

TEN MONTHS, TWO FORMS, ONE SET OF CALLS AT A THRESHOLD OF ONE HALF MONTH NAKSHATRA STRAIGHT LINE LOGISTIC CURVE IT REALLY 11.00upuprose 26.00upuprose 3minus4.00downdownrose 411.00upuprose 51.00upupfell 6minus9.00downdownfell 76.00upuprose 81.00upupfell 9minus4.00downdownfell 101.00upupfell ONE ACCURACY, PRINTED ONCE, BECAUSE BOTH FORMS SHARE IT: 60.00 PER CENT
Called at a threshold of one half the two forms make exactly the same ten calls month for month, so a single scoreboard serves both and neither can be said to beat the other on this record.
Try it out

On these ten months the straight line and the logistic curve both score an accuracy of 60.00 per cent. How much does that settle about which form to reach for?

Risk Management Program Bootcamp — Fin Maverick

What is a penalty, and what does ridge do with one?

Everything so far has been about the first of the two questions. Now for the second. A penalty is a charge added to the thing the fitting is trying to make small. Normally the fitting is trying to make the misses small and nothing else. With a penalty in place it is trying to make the misses small plus some charge that grows as the coefficients grow, so a coefficient of 40 has to earn its keep against a coefficient of 4 rather than simply arriving free.

Why would anyone want that? Because of a specific and very common mess. Bring in a third invented column, the Chandana unit: the Nakshatra unit nudged by one twentieth of a percentage point in eight of the ten months and left completely alone in the other two. The Chandana unit is not a copy of the Nakshatra unit, but it is very nearly one. Its correlationA number from minus one to one saying how tightly two columns move together. At one they move in perfect step. It was built and explained in the earlier reading on two moving columns. with the Nakshatra unit is 0.999967, and the standard warning score for this situation, the variance inflation factor, comes out at 15,001.

Fit the Vasant unit on both of those columns at once with no penalty and look at what falls out: a coefficient of minus 1.0000 on the Nakshatra unit and 2.5000 on the Chandana unit. Two columns that agree with each other to five decimal places have been handed a large negative weight and a large positive weight. The split is arithmetic nonsense dressed as a result. The nonsense happens because the two columns nearly cancel, so the fitting can add almost anything to one coefficient and take almost the same amount off the other without the misses noticing. Notice, though, that the two still add to 1.5000, exactly the coefficient the Nakshatra unit carried on its own.

Now switch on a penalty of one, charged on the squared size of the coefficients. A charge on squared size is ridge. The pair becomes 0.7314 and 0.7661. The two coefficients close from 3.5000 apart to 0.0347 apart. R squared moves only from 0.756019 to 0.755950, a distance of 0.000069, so the coefficient pair travels roughly 24,974 times as far as the fit does. The comparison is the whole argument for a penalty, and it is also easy to overstate. Read it carefully. The fit did move. The fit moved by one unit in the fourth decimal place, and anybody who says the fit was unchanged has said something slightly false. A fit which barely moved across a huge stretch of coefficient pairs was never pinning those coefficients down in the first place.

TWO NEARLY IDENTICAL COLUMNS, AND WHAT A PENALTY DOES TO THEIR COEFFICIENTS NO PENALTY R squared 0.756019 0 1.5 minus 1.0000 2.5000 3.5000 apart PENALTY OF ONE R squared 0.755950 0 1.5 0.7314 and 0.7661, only 0.0347 apart the two markers overlap here The fit did not stand still. It moved by 0.000069, one unit in the fourth decimal place, while the Nakshatra coefficient moved 1.7314, roughly 24,974 times as far. All figures invented.
A penalty of one closes the pair from 3.5000 apart to 0.0347 apart while R squared moves only from 0.756019 to 0.755950, so the coefficients travel enormously further than the fit does.
Try it out

A penalty of one moves the Nakshatra coefficient from minus 1.0000 to 0.7314 while R squared moves by 0.000069. Which of those two coefficient values was the record really pinning down?

Regression for Finance — free micro-course from Fin Maverick

What does lasso do differently, and what does a coefficient of nought mean?

Lasso changes one thing about ridge, and the change looks tiny written down. Charge the coefficients by their plain size rather than by their squared size. That is it. But the behaviour that falls out is a different kind of thing altogether. A charge on plain size does not tail off as a coefficient approaches nought the way a charge on squared size does. The charge keeps pushing right up to the edge, and so lasso can push a coefficient all the way there and leave it.

Run it on the same two columns at a penalty of one. The Nakshatra coefficient comes out at exactly nought. Not 0.0004, not something that rounds to nothing. Nought. And the Chandana unit is left carrying 1.4967 entirely on its own, with an R squared of 0.7560, barely distinguishable from what the pair managed together. Ridge keeps both columns and splits the relationship between them; lasso refuses to split and hands the whole relationship to one column.

Two things are worth checking before the nought is believed. First, is it an accident of the order the arithmetic visited the two columns in? It is not. Settling the Chandana coefficient first instead produces the identical answer, so the result is a property of the problem rather than a quirk of the procedure. Second, and much more important: which column did it drop? Lasso dropped the Nakshatra unit, the original, and kept the Chandana unit, the near duplicateA column built out of another one with only a very small change, so that the two carry almost the same information as each other. Here one is the other nudged by one twentieth of a percentage point in eight of ten months. that was built by nudging the original. Nothing in the output says which of the two was kept, and nothing in it says why.

THE SAME TWO COLUMNS, THE SAME PENALTY OF ONE, TWO DIFFERENT ANSWERS RIDGE: SPLITS IT LASSO: CHOOSES 0.7314 0.7661 Nakshatra Chandana exactly nought 1.4967 Nakshatra Chandana 1.6 0.8 1.6 0.8
Ridge keeps both columns and splits the relationship almost evenly between them, while lasso sets the Nakshatra coefficient to exactly nought and leaves the Chandana unit carrying 1.4967 by itself.
Try it out

Lasso returns exactly nought for the Nakshatra unit. Name the one fact about the record that makes reading that nought as a finding untrustworthy.

The failure: a nought read as a verdict

Somebody fits lasso to the Nakshatra unit and the Chandana unit, sees a coefficient of exactly nought against the Nakshatra unit, and writes in the summary that the Nakshatra unit does not matter. The mistake is completely natural, and it is exactly backwards.

The two columns carry the same information as each other. Keeping both at full strength costs more in penalty than it earns in fit, so the arithmetic was going to drop one of them, and it dropped the one it dropped. Lasso kept the nudged copy and discarded the original. Had the nudge gone the other way, it could as easily have kept the original and discarded the copy, and the printed output would have looked just as confident either way. A coefficient of nought from a form that charges for size is a statement about a competition between columns, not a measurement of any single column's importance.

Here is the habit that fixes it, and it costs about thirty seconds. Before any coefficient is read at all, the columns are checked for two that carry the same information. Two columns at 0.999967 are not two pieces of evidence, they are one piece of evidence entered twice, and any procedure asked to divide credit between them is being asked an unanswerable question. The correlations come first, the coefficients second. The output panel does not know what it was not shown, so it never raises the duplication on its own.

WHAT THE FITTED OUTPUT PRINTS COLUMN COEFFICIENT Chandana unit 1.4967 Nakshatra unit 0.0000 R squared 0.7560 penalty 1 WHAT IT DOES NOT PRINT how alike the two columns are 0.999967 that keeping both at full strength cost more than it earned, so one had to go that the one it kept is the nudged copy and the one it dropped is the original and that it does not report which, ever
A lasso coefficient of nought sitting beside a correlation of 0.999967 that the printout never shows is a choice between duplicate columns rather than evidence about either of them.
Lasso charges plain size and drives a coefficient to nought. See what regression drops.

How would somebody choose between the four?

Two questions, asked in order, and they sort all four without any judgement calls.

First: is the answer wanted a size, or a yes or no? A size takes linear regression, or one of its penalised versions. A yes or no takes logistic regression. A housing society committee looking at its water tank faces both kinds. How many litres will be drawn tomorrow is a size question, and the honest answer might be larger than any day so far. Whether the tank will run dry before evening is a yes or no question, and the honest answer can never be more certain than certain. Handing the second question to a form built for the first is how a printed chance of 1.2000 ends up sitting unnoticed for a month.

Second: are two of the inputs carrying the same information as each other? If they genuinely differ, plain linear regression is doing nothing wrong and a penalty buys very little. If two or more of them are near duplicates, the coefficients will fly apart the way minus 1.0000 and 2.5000 flew apart, and a penalty is what stops that. Ridge keeps every column and shares the relationship out among the ones that agree. Lasso picks one and zeroes the rest. The choice between sharing and dropping changes what the output looks like, and which behaviour has been switched on is worth knowing before a coefficient is read out loud to anybody.

One warning to carry out of this, and it is the mistake that costs most often. Neither penalty is a way of finding out which input matters, and a lasso nought is not a vote. A workshop owner who tracks both the number of machines repaired and the number of machines collected, when almost every machine repaired is collected the same day, has two columns saying one thing. No penalty, and no procedure of any kind, can tell that owner which of the two drove the week. The record simply does not contain the answer. A penalty gives something else, and it is genuinely useful: a stable set of coefficients instead of a wild one.

FIRST QUESTION: IS THE ANSWER A SIZE, OR A YES OR NO? if the answer is a yes or no logistic regression and the second question does not arise if the answer is a size carry on to the second question SECOND QUESTION: ARE TWO INPUTS CARRYING THE SAME INFORMATION? if they genuinely differ linear regression a penalty buys very little here, so there is nothing to switch on if two of them are near duplicates ridge keeps every column and shares the relationship out lasso picks one and zeroes the rest Neither question is a judgement call. Both are questions about the job in hand.
Ask what the answer is a statement about, then ask whether any two inputs are carrying the same information, and the four forms sort themselves into their places without a single judgement call.
Try it out

A fitted rule produces a number between nought and one, and the question is whether it is linear or logistic. Name the single check that settles it.

What is left for later reading?

How the size of a penalty is settled, how a rule is tested honestly on months it has never seen, and what happens when a shape is allowed to bend more and more freely are all covered later, and the second and third are where the interesting arguments live. The scoreboard is taken apart separately as well: the two other views of the same ten calls, and the curve drawn by sweeping the threshold across its whole range, both belong to later reading.

Whether any of these four forms suits a decision about something bought or sold is a separate subject with its own conditions, and ten made up months of arithmetic settle none of it.

Where do these figures come from, and why is there nothing outside to cite?

What is used aboveWhere it came fromWhat kind of thing that is
The ten paired months of the Nakshatra unit and the Vasant unitMade up for teaching, and carried in unchanged from the earlier reading on fitting a lineAn invented record
Every slope, chance, penalty result and score printed aboveWorked out from those ten months by the arithmetic script kept beside these notesComputed here
The names linear, logistic, ridge and lassoOrdinary teaching vocabulary that turns up in any statistics textNamed, and credited to nobody

The Nakshatra unit, the Vasant unit and the Chandana unit are invented.
Educational material. Not advice on any investment, tax, budget or market position.

Next →
Fin Maverick Micro CoursesExplore Micro Courses
Fin Maverick BootcampsExplore Bootcamps
Fin Maverick

Finance education that ends in a job, not a certificate that gathers dust. Built for young India.

LEARN
CalculatorsFrameworksComparisonsCareersShowdown
RESOURCES
All CoursesMicro CoursesBootcampsInternships
COMPANY
AboutJob openingPartnership
LEGAL
Privacy PolicyTerms & ConditionsContent LicenseReturn & Refund Policy
© 2026 FIN MAVERICK / BUILT FOR INDIA.DO FINANCE, DO NOT JUST READ ABOUT IT.