SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
NON-LINEAR REGRESSION 1
Non-Linear Regression
© 2006-2008 Samuel L. Baker
The linear least squares method that you have been using fits a
straight line or a flat plane to a bunch of data points. Sometimes
the true relationship that you want to model is curved, rather than
flat. For example, if something is growing exponentially, which
means growing at a steady rate, the relationship between X and
Y is curve, like that shown to the right.
To fit something like this, you need non-linear regression. Often,
you can adapt linear least squares to do this. The method is to
create new variables from your data. The new variables are non-
linear functions of the variables in your data. If you construct
your new variables properly, the curved function of your original
variables can be expressed as a linear function of your new
variables.
We will be discussing two popular non-linear equation forms that
are amenable to this technique:
Equation Interpretation Linear Form
Y = Ae u Y is growing (or shrinking) at abX
constant relative rate of b.
ln(Y) = ln(A) + bX + ln(u)
Y = AX u The elasticity of Y with respectb
to X is a constant, b.
ln(Y) = ln(A) + b@ln(X) + ln(u)
Consider the first equation, Y = Ae u. This is an exponential growth equation. b is the growth rate. u isbX
a random error term.
If you take the logarithm of both sides of that equation, you get ln(Y) = ln(A) + bX + ln(u). This equation
has logarithms in it, but they relate in a linear way. It is in the form y=a+bX+error, except that y, a, and
the error are logarithms. (A review of logarithms and e is coming up on the next page. Bear with me until
then.)
This means that if you create a new variable, the base-e logarithm of Y, written as ln(Y), you can use the
regular least squares method to fit ln(Y) = ln(A) + bX + ln(u). That is a way of fitting the curve Y = AebX
to your data. (We will go over this again after the review of logarithms.)
Similarly, consider the second equation, Y = AX u. This is a constant-elasticity equation (more on why Ib
call it that later), typically used for demand curves. Take the logarithm of both sides of that equation and
you get ln(Y) = ln(A) + b@ln(X) + ln(u).
For this equation, if you create the variable ln(Y) and also a variable for the base-e logarithm of X, written
NON-LINEAR REGRESSION 2
as ln(X), you can use the regular least squares method to fit the curve Y = AX to your data.b
Before we go further into how to use these new equations, we had better review logarithms and e.
Logarithms defined:
aIf a = c then b = log c .b
ab = log c is read, “b is the log to the base a of c.”
I remember the logarithm definition by remembering that:
The log of 1 is 0, regardless of the base.
Anything to the 0 power is 1.
If I can remember those two facts, then I can arbitrarily pick 10 as my base and write:
1010 = 1 and log 1 = 0.0
aFrom that I get a = c and log c = b, by substituting “a” for 10, “b” for 0, and “c” for 1.b
aYou can't take the log of 0 or of a negative number. The c in log c must be a positive number.
ee (. 2.718282) is the base of the “natural logarithms” (log is written “ln”).
Natural logarithms are used for continuous growth rates.
Something growing at a 100% annual rate, compounded continuously, will grow to e times its
original size in one year. (The diagram on the preceding page shows a 100% growth rate.)
Something growing at an r annual rate, compounded continuously, will grow to e times itsr
original size in one year.
In Excel, the function =EXP(A1) raises e the power of whatever number is in cell A1. =LN(A1) takes
ethe natural log of whatever is in cell A1.
Some exponential algebra rules
e = e ea+b a b
e = (e )ab a b
e = aln(a)
e = ab•ln(a) b
e = 10
Some corresponding logarithm algebra rules
ln( ab ) = ln( a )+ln( b )
ln( a ) = bAln( a )b
ln( e ) = aa
ln( 1 ) = 0
Non-linear models that can be made linear using logarithms:
Now we can get back to the curved models introduced at the beginning of this section and give fuller
explanations.
Constant growth or decay equation Y = Ae ubX
Suppose you’re modeling a process that you think has continuous growth at a constant growth rate. This is
like the diagram on page 1. You want to estimate the growth rate from your data.
NON-LINEAR REGRESSION 3
Y = Ae u is your equation.bX
X is often a measure of time. X goes up by 1 for each second, hour, day, year, or whatever time unit you
are using. Sometimes, X is a measure of dosage.
A is the starting amount, the amount expected when X is 0.
b is the relative growth rate, with continuous compounding.
u is the random error. Notice that we multiply by the error, rather than adding or subtracting the error as in
standard linear regression. u has a mean of 1 and is always bigger than 0. u is never 0 or negative.
Use this equation if:
The analogy with steady growth or decay makes sense.
Y cannot be 0 or negative.
X can be positive, 0, or negative.
The interpretation of b in Y = Ae u:bX
b is the parameter in which you are most interested, usually. Your estimate of b is your estimate of the
relative change in Y associated with a unit change in X.
Mathematically, if X goes up by 1, Y is multiplied by e . That is because Ae equals Ae , whichb b(X+1) bX+b
equals Ae e , which is Y is multiplied by e . That may not look like “relative change,” but it is, if you arebX b b
using continuous compounding.
People who use these models usually make a simpler statement about b. They say that if X goes up by 1,
Y goes up by 100b percent. They mean that if X goes up by 1, Y is multiplied by (1+b). For example, if
your estimate for b is 0.02, then it is said that if X goes up by 1, Y goes up by 2%, because Y is multiplied
by 1.02. (1 + .02 = 1.02.)
The 1+b idea is fine so long as b is near 0. For small values of b, e is close to 1+b. Multiplying by 1+b isb
close to the same as multiplying by e . For example, if b is 0.05 and X increases by 1, Y is multiplied byb
e , which is about 1.051, so Y really increases by 5.1%. That is pretty close to 5%. Most things in the.5
financial world and the public health world grow pretty slowly, so the 1+b or b-percent idea is OK. The
downloadable file about time series has more details on this.
How to make the growth/decay equation linear:
To convert Y = Ae u to a linear equation, take the natural log of both sides:bX
ln(Y) = ln(Ae u) Apply the rules above and you get:bX
ln(Y) = ln(A) + bX + ln(u)
To implement this, create a new variable y = ln(Y). (The Y in the original equation is “big Y.” The new
variable is “little y.”)
Also, define v as equaling ln(u) and a as equaling ln(A).
NON-LINEAR REGRESSION 4
Subsitute y for ln(Y), a for ln(A), and v for ln(u) in ln(Y) = ln(A) + bX + ln(u) and you get:
y = a + bX + v
This is a linear equation! It may seem like cheating to turn a curve equation into a straight line equation
this way, but that is how it’s done.
Doing the analysis this way is not exactly the same as fitting a curve to points using least squares. This
method this method minimizes the sum of the squares of ln(Y) - (ln(A) + bX), not the sum of the squares of
Y - Ae . In our equation, the error term is something we multiply by rather than add. Our equation isbX
Y=Ae u, rather than Y = Ae +u.bX bX
We make our equation Y=Ae u, rather than Y = Ae +u, so that when we take the log of both sides we getbX bX
an error, which we call v, the logarithm of u in the original equation, that behaves like errors are supposed
to behave for linear regression. For example, for linear regression we have to assume that the error’s
expected value is 0. To make this work, we assume that the expected value of u is 1. That makes the
expected value of ln(u) equal zero, because ln(1) = 0. In Y=Ae u, u is never 0 or negative, but v can takebX
on positive or negative values, because if u is less than 1, v=ln(u) is less than 0.
When you transform Y=Ae u to y = a + bX + v and do a least squares regression, here is how youbX
interpret the coefficients:
b8 is your estimate of the growth rate. a8 is your estimate of ln(A). To get an estimate of A, calcualte e to the
a-hat power.
Getting a prediction for Y from your prediction for y
After you calculate a prediction for little y, you have to convert it to big Y.
Your prediction for Y = e . In Excel, use the =EXP() function.Your prediction for y
An example
The first two columns are your data in a dose-response experiment. The third column is calculated from
the second by taking the natural logarithm.
Dose Bacteria LnBacteria
1 35500 10.4773
2 21100 9.95703
3 19700 9.88837
4 16600 9.71716
5 14200 9.561
6 10600 9.26861
7 10400 9.24956
8 6000 8.69951
9 5600 8.63052
10 3800 8.24276
NON-LINEAR REGRESSION 5
11 3600 8.18869
12 3200 8.07091
13 2100 7.64969
14 1900 7.54961
15 1500 7.31322
Your regression results are:
LnBacteria is the dependent variable, with a mean of 8.8309284
Variable Coefficient Std Error T-statistic P-Value
Intercept 10.57833 0.0597781 176.95997 0
Dose -0.2184253 0.0065747 -33.222015 0
You have found that each dose reduces the number of bacteria by about 22%.
Prediction, showing how it is calculated:
Variable Coefficient * Your Value = Product
Intercept 10.57833 1.0 10.57833
Dose -0.2184253 16.0 -3.4948041
Total is the prediction: 7.0835264
90% conf. interval is 6.861792 to 7.3052607
Your prediction for the number of bacteria if the dose is 16 is e = 1192. In Excel, calculate7.0835264
=EXP(7.0835264). The 90% confidence interval for that prediction is from e to e , which is6.861792 7.3052607
about 955 to 1488.
NON-LINEAR REGRESSION 6
Graph of Y=X u2
u is log-normally distributed with
a mean of 1.
b<1 example: Y = 5x u-1
Constant elasticity equation Y=AX ub
Another non-linear equation that is commonly used is the
constant elasticity model. Applications include supply,
demand, cost, and production functions.
Y = AX u is your equationb
X is some continuous variable that’s always bigger than 0.
A determines the scale.
b is the elasticity of Y with respect to X (more on elasticity
below).
u , the error, has a mean of 1 and is always bigger than 0.
Use this equation if:
• X and Y are always positive. X and Y can not be 0 or
negative.
• You suspect, or wish to test for, diminishing (|b|<1) or increasing (|b|>1) returns to scale
• If it is reasonable that the percentage change in Y caused by a 1% change in X is the same at any
level of X (or any level of Z, if you are doing a multiple regression). That is why this is called a
“constant elasticity” equation.
A constant elasticity model can never give a negative prediction. If a negative prediction would make
sense, you do not want this model. If a negative prediction would not make sense, this model may be what
you want.
The interpretation of b, the elasticity:
b is the percentage change in Y that you get when X changes by 1%. Economists call b the elasticity of Y
with respect to X.
If b is positive, you see a pattern like in the diagram above.
If b is negative in this equation, the pattern is like a hyperbola. The points
get closer and closer to the X axis as you go the right. The points get closer
and closer to the Y axis and they get higher and higher as X goes to the left
and gets near 0.
If you do a multiple regression version of this, with the equation Y =
AAX AZ Au, then b is the percentage change in Y that you get when X changesb c
by 1% and Z does not change. Economists say b and c are elasticities of Y
with respect to X and Z.
How to make this linear:
If you take the log of both sides of Y = AAX Au , you get:b
NON-LINEAR REGRESSION 7
ln(Y) = ln(A) + bAln(X) + ln(u)
To make this linear, create two new variables, y = ln(Y) and x = ln(X). (If you have more than one X
variable, take the logs of all of them.) Let a be ln(A) and v be ln(u), and our equation becomes nice and
linear:
y = a + bx + v
As with the growth model, to use least squares, we must assume that v behaves like errors are supposed to
behave for linear regression. One of those assumptions is that v’s expected value is 0. That is why we
assume that the mean of u is 1. That fits because ln(1) = 0. u is never 0 or negative, but v can take on
positive or negative values, because if u is less than 1, v=ln(u) is less than 0.
The multiple regression version of the constant elasticity model works like this:
Y = AAX AZ Au is the equation.b c
Take the log of both sides to get:
ln(Y) = ln(A) + bAln(X) + cAln(Z) + ln(u)
which you estimate as
y = a + bAx + cAz + v
where y = Ln(Y), a = ln(A), x = ln(X), etc.
This equation lets you look for diminishing or increases returns to scale. If |b+c| < 1, you have diminishing
returns. Doubling X and Z makes Y go up less than twofold. If |b+c|>1, you have increasing returns.
Doubling X and Z makes Y more than double.
Sometimes a linear model shows heteroskedasticity -- apparently unequal variances of the errors -- that
takes the form of the residuals fanning out or in as you look down the residual plot. This constant elasticity
form can correct that.
Getting a prediction for Y from your prediction for y
As with the growth-decay model, when you calculate a prediction for y, you have to convert it to Y. You
do this by raising e to the y power, because Y = e . In Excel, use the =EXP() function.y
An example
Here are some data:
Price Visits LnPrice LnVisits
10 512 2.30259 6.23832
NON-LINEAR REGRESSION 8
10 396 2.30259 5.98141
10 456 2.30259 6.12249
10 525 2.30259 6.2634
20 347 2.99573 5.84932
20 377 2.99573 5.93225
20 423 2.99573 6.04737
20 330 2.99573 5.79909
30 366 3.4012 5.90263
30 335 3.4012 5.81413
30 301 3.4012 5.70711
30 309 3.4012 5.73334
40 345 3.68888 5.84354
40 320 3.68888 5.76832
40 325 3.68888 5.78383
40 285 3.68888 5.65249
The first two columns are the actual data. The third and fourth columns are calculated as the natural logs
of the first two columns. 3.6888 approximately = LN(40), for example.
LnVisits is the dependent variable, with a mean of 5.9024412
Variable Coefficient Std Error T-statistic P-Value
Intercept 6.8044237 0.1496568 45.466851 0
LnPrice -0.2912347 0.047653 -6.1115685 0.0000269
The estimated coefficient of LnPrice says that when the price is 1% higher, there are 0.29% fewer visits.
To predict visits if the price is $25, first calculate =EXP(25). It is about 3.218875825. Use that in the
prediction form.
Prediction, showing how it is calculated:
Variable Coefficient * Your Value = Product
Intercept 6.8044237 1.0 6.8044237
LnPrice -0.2912347 3.2188758 -0.9374482
Total is the prediction: 5.8669755
90% conf. interval is 5.6865181 to 6.0474328
The prediction for the logarithm of visits is 5.8669755. The prediction for visits is =EXP(5.8669755),
which is about 353. The 90% confidence interval for that prediction is from =EXP(5.6865181) to
=EXP(6.0474328), which is about 295 to 423. Notice that 353 is not in the middle of this confidence
interval.
NON-LINEAR REGRESSION 9
More comments on our two non-linear models
Time series often use the ln(Y) = ln(A) + bX + ln(u) form.
The multiple regression version has more than one X variable. Your independent (X) variables
measure time, either
Sequentially: 0,1,2,3,... or 1996, 1997, 1998 , ... or
Cyclically: seasonal dummy variables (to be explained next week)
Notice that you do not take the logs of these X variables, just the Y variable.
The coefficient b is the growth/decline rate, meaning that a change in X of 1 corresponds with a
100b percent change in Y, if b is small.
Cross section studies, that look for causation rather than time trends, often use the constant elasticity form,
ln(Y) = ln(A) + bAln(X) + ln(u)
For this model, your independent variables have a proportional effect on your Y variable.
You do take the logs of your X variables.
Coefficients are elasticities, meaning that a change in X by 1% (of X) changes Y by b percent.
General comments on working with transformed equations
You must assume that the error in the transformed equation has the desired properties (normal distribution
with mean 0).
Once you get your estimates from the transformed equation, going back to the original equation can be
tricky. Some original-equation parameter estimates are biased, but consistent, if the parameter was
transformed (e.g. A in the models above). Confidence intervals around predicted values are no longer
symmetrical. You must get the confidence interval from the transformed equation and then transform the
ends back.
Before you start with using a non-linear regression equation:
Have a good reason for not using a linear model, such as
a theory of how the process that you're observing works, or
a pattern you see on a graph or in the residuals from a linear regression
Determine which non-linear equation is best for your data. Can you make a sensible analogy with
steady growth or decay? How about with demand or production?
To do the regression:
Use algebra (or just read the above) to transform your original non-linear equation into one that is
linear. For example, Y = AX u transforms tob
ln(Y) = ln(A) + bAln(X) + ln(u).
Create the variables you need from your data.
NON-LINEAR REGRESSION 10
Use least squares, including the transformed variables in your data set.
Your predictions, and at least some of your estimated coefficients, will have to be transformed to
anti-logs to get back to the parameters in the original non-linear equation. In both of these
equations, the predicted value of ln(Y) must be transformed with the exp function to get a predicted
value for Y.

Contenu connexe

Tendances

Multiple Regression.ppt
Multiple Regression.pptMultiple Regression.ppt
Multiple Regression.pptTanyaWadhwani4
 
Chi-square, Yates, Fisher & McNemar
Chi-square, Yates, Fisher & McNemarChi-square, Yates, Fisher & McNemar
Chi-square, Yates, Fisher & McNemarAzmi Mohd Tamil
 
Two-sample Hypothesis Tests
Two-sample Hypothesis Tests Two-sample Hypothesis Tests
Two-sample Hypothesis Tests mgbardossy
 
Logarithmic transformations
Logarithmic transformationsLogarithmic transformations
Logarithmic transformationsamylute
 
Ordinary least squares linear regression
Ordinary least squares linear regressionOrdinary least squares linear regression
Ordinary least squares linear regressionElkana Rorio
 
Analysis of Time Series
Analysis of Time SeriesAnalysis of Time Series
Analysis of Time SeriesManu Antony
 
Non linear curve fitting
Non linear curve fitting Non linear curve fitting
Non linear curve fitting Anumita Mondal
 
09 ch ken black solution
09 ch ken black solution09 ch ken black solution
09 ch ken black solutionKrunal Shah
 
Normal Distribution
Normal DistributionNormal Distribution
Normal DistributionCIToolkit
 
Simple linear regression
Simple linear regressionSimple linear regression
Simple linear regressionMaria Theresa
 
Linear regression
Linear regressionLinear regression
Linear regressionTech_MX
 
Time Series
Time SeriesTime Series
Time Seriesyush313
 
Regression analysis
Regression analysisRegression analysis
Regression analysisRavi shankar
 
Principle of Least Square, its Properties, Regression line and standard error...
Principle of Least Square, its Properties, Regression line and standard error...Principle of Least Square, its Properties, Regression line and standard error...
Principle of Least Square, its Properties, Regression line and standard error...Ali Lodhra
 

Tendances (20)

Covariance
CovarianceCovariance
Covariance
 
Crosstabs
CrosstabsCrosstabs
Crosstabs
 
BISECTION METHOD
BISECTION METHODBISECTION METHOD
BISECTION METHOD
 
Multiple Regression.ppt
Multiple Regression.pptMultiple Regression.ppt
Multiple Regression.ppt
 
Chi-square, Yates, Fisher & McNemar
Chi-square, Yates, Fisher & McNemarChi-square, Yates, Fisher & McNemar
Chi-square, Yates, Fisher & McNemar
 
Two-sample Hypothesis Tests
Two-sample Hypothesis Tests Two-sample Hypothesis Tests
Two-sample Hypothesis Tests
 
Logarithmic transformations
Logarithmic transformationsLogarithmic transformations
Logarithmic transformations
 
Ordinary least squares linear regression
Ordinary least squares linear regressionOrdinary least squares linear regression
Ordinary least squares linear regression
 
Time series
Time seriesTime series
Time series
 
Analysis of Time Series
Analysis of Time SeriesAnalysis of Time Series
Analysis of Time Series
 
Non linear curve fitting
Non linear curve fitting Non linear curve fitting
Non linear curve fitting
 
09 ch ken black solution
09 ch ken black solution09 ch ken black solution
09 ch ken black solution
 
Normal Distribution
Normal DistributionNormal Distribution
Normal Distribution
 
Simple linear regression
Simple linear regressionSimple linear regression
Simple linear regression
 
Regression
RegressionRegression
Regression
 
BS6_Measurement of Trend.pptx
BS6_Measurement of Trend.pptxBS6_Measurement of Trend.pptx
BS6_Measurement of Trend.pptx
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Time Series
Time SeriesTime Series
Time Series
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
 
Principle of Least Square, its Properties, Regression line and standard error...
Principle of Least Square, its Properties, Regression line and standard error...Principle of Least Square, its Properties, Regression line and standard error...
Principle of Least Square, its Properties, Regression line and standard error...
 

En vedette

Тиждень правових занань у яслах-садку №5 "Червона Шапочка"
Тиждень правових занань у  яслах-садку №5 "Червона Шапочка"Тиждень правових занань у  яслах-садку №5 "Червона Шапочка"
Тиждень правових занань у яслах-садку №5 "Червона Шапочка"Галина Савоник
 
Escuela de padres, segunda actividad
Escuela de padres, segunda actividadEscuela de padres, segunda actividad
Escuela de padres, segunda actividadauladeapoyoiesf
 
911129 RICS PROFESSIONAL CERTIFICATE
911129 RICS PROFESSIONAL CERTIFICATE911129 RICS PROFESSIONAL CERTIFICATE
911129 RICS PROFESSIONAL CERTIFICATEStewart Dunn
 
서비스 제출
서비스 제출서비스 제출
서비스 제출진실 김
 
I'm to amazing
I'm to amazingI'm to amazing
I'm to amazingsanchezam
 
Avances medicina cubana
Avances medicina cubanaAvances medicina cubana
Avances medicina cubanaDraco703
 
Midia kit finalizado.compressed
Midia kit finalizado.compressedMidia kit finalizado.compressed
Midia kit finalizado.compressedKassem Azanki
 
COOP PBL in VET Project
COOP PBL in VET ProjectCOOP PBL in VET Project
COOP PBL in VET Projectmartamanas
 
спортивное соревнование 17.04.2015
спортивное соревнование 17.04.2015спортивное соревнование 17.04.2015
спортивное соревнование 17.04.2015virtualtaganrog
 

En vedette (20)

Adivina
AdivinaAdivina
Adivina
 
온오쇼 발표용
온오쇼 발표용온오쇼 발표용
온오쇼 발표용
 
a4h1-RecordOfAchievement
a4h1-RecordOfAchievementa4h1-RecordOfAchievement
a4h1-RecordOfAchievement
 
벌써 일년
벌써 일년벌써 일년
벌써 일년
 
TEDxEdges 2010
TEDxEdges 2010TEDxEdges 2010
TEDxEdges 2010
 
Тиждень правових занань у яслах-садку №5 "Червона Шапочка"
Тиждень правових занань у  яслах-садку №5 "Червона Шапочка"Тиждень правових занань у  яслах-садку №5 "Червона Шапочка"
Тиждень правових занань у яслах-садку №5 "Червона Шапочка"
 
Acad12 tips online
Acad12 tips onlineAcad12 tips online
Acad12 tips online
 
Escuela de padres, segunda actividad
Escuela de padres, segunda actividadEscuela de padres, segunda actividad
Escuela de padres, segunda actividad
 
The circle 2
The circle 2The circle 2
The circle 2
 
Timeline of childhood
Timeline of childhoodTimeline of childhood
Timeline of childhood
 
Katalog sani rozdrabniaczy SFA e-millennium.eu
Katalog sani rozdrabniaczy SFA e-millennium.euKatalog sani rozdrabniaczy SFA e-millennium.eu
Katalog sani rozdrabniaczy SFA e-millennium.eu
 
Portfolio
PortfolioPortfolio
Portfolio
 
911129 RICS PROFESSIONAL CERTIFICATE
911129 RICS PROFESSIONAL CERTIFICATE911129 RICS PROFESSIONAL CERTIFICATE
911129 RICS PROFESSIONAL CERTIFICATE
 
서비스 제출
서비스 제출서비스 제출
서비스 제출
 
I'm to amazing
I'm to amazingI'm to amazing
I'm to amazing
 
Avances medicina cubana
Avances medicina cubanaAvances medicina cubana
Avances medicina cubana
 
Midia kit finalizado.compressed
Midia kit finalizado.compressedMidia kit finalizado.compressed
Midia kit finalizado.compressed
 
COOP PBL in VET Project
COOP PBL in VET ProjectCOOP PBL in VET Project
COOP PBL in VET Project
 
спортивное соревнование 17.04.2015
спортивное соревнование 17.04.2015спортивное соревнование 17.04.2015
спортивное соревнование 17.04.2015
 
Verkosto 2012
Verkosto 2012Verkosto 2012
Verkosto 2012
 

Similaire à Non linearregression 4+

Similaire à Non linearregression 4+ (20)

Exponential functions
Exponential functionsExponential functions
Exponential functions
 
Chapter 5 algebra
Chapter 5 algebraChapter 5 algebra
Chapter 5 algebra
 
Two-Variable (Bivariate) RegressionIn the last unit, we covered
Two-Variable (Bivariate) RegressionIn the last unit, we covered Two-Variable (Bivariate) RegressionIn the last unit, we covered
Two-Variable (Bivariate) RegressionIn the last unit, we covered
 
3.1 2
3.1 23.1 2
3.1 2
 
IVS-B UNIT-1_merged. Semester 2 fundamental of sciencepdf
IVS-B UNIT-1_merged. Semester 2 fundamental of sciencepdfIVS-B UNIT-1_merged. Semester 2 fundamental of sciencepdf
IVS-B UNIT-1_merged. Semester 2 fundamental of sciencepdf
 
Physics 1.3 scalars and vectors
Physics 1.3 scalars and vectorsPhysics 1.3 scalars and vectors
Physics 1.3 scalars and vectors
 
Chapter 14 Part I
Chapter 14 Part IChapter 14 Part I
Chapter 14 Part I
 
Exponential functions
Exponential functionsExponential functions
Exponential functions
 
Logmodels2
Logmodels2Logmodels2
Logmodels2
 
Logmodels2
Logmodels2Logmodels2
Logmodels2
 
For this assignment, use the aschooltest.sav dataset.The d
For this assignment, use the aschooltest.sav dataset.The dFor this assignment, use the aschooltest.sav dataset.The d
For this assignment, use the aschooltest.sav dataset.The d
 
Calculus Homework Help
Calculus Homework HelpCalculus Homework Help
Calculus Homework Help
 
Calculus Assignment Help
Calculus Assignment HelpCalculus Assignment Help
Calculus Assignment Help
 
2006 10 1-2
2006 10 1-22006 10 1-2
2006 10 1-2
 
2006 10 1
2006 10 12006 10 1
2006 10 1
 
Reg
RegReg
Reg
 
Single Variable Calculus Assignment Help
Single Variable Calculus Assignment HelpSingle Variable Calculus Assignment Help
Single Variable Calculus Assignment Help
 
Single Variable Calculus Assignment Help
Single Variable Calculus Assignment HelpSingle Variable Calculus Assignment Help
Single Variable Calculus Assignment Help
 
Regression Analysis
Regression AnalysisRegression Analysis
Regression Analysis
 
Relations among variables
Relations among variablesRelations among variables
Relations among variables
 

Dernier

The Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfThe Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfGale Pooley
 
The Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfThe Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfGale Pooley
 
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptxFinTech Belgium
 
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )Pooja Nehwal
 
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...dipikadinghjn ( Why You Choose Us? ) Escorts
 
The Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfThe Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfGale Pooley
 
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsHigh Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Booking open Available Pune Call Girls Wadgaon Sheri 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Wadgaon Sheri  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Wadgaon Sheri  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Wadgaon Sheri 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...Pooja Nehwal
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceanilsa9823
 
The Economic History of the U.S. Lecture 26.pdf
The Economic History of the U.S. Lecture 26.pdfThe Economic History of the U.S. Lecture 26.pdf
The Economic History of the U.S. Lecture 26.pdfGale Pooley
 
The Economic History of the U.S. Lecture 25.pdf
The Economic History of the U.S. Lecture 25.pdfThe Economic History of the U.S. Lecture 25.pdf
The Economic History of the U.S. Lecture 25.pdfGale Pooley
 
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptxFinTech Belgium
 
Gurley shaw Theory of Monetary Economics.
Gurley shaw Theory of Monetary Economics.Gurley shaw Theory of Monetary Economics.
Gurley shaw Theory of Monetary Economics.Vinodha Devi
 
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...Call Girls in Nagpur High Profile
 
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service NashikHigh Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
WhatsApp 📞 Call : 9892124323 ✅Call Girls In Chembur ( Mumbai ) secure service
WhatsApp 📞 Call : 9892124323  ✅Call Girls In Chembur ( Mumbai ) secure serviceWhatsApp 📞 Call : 9892124323  ✅Call Girls In Chembur ( Mumbai ) secure service
WhatsApp 📞 Call : 9892124323 ✅Call Girls In Chembur ( Mumbai ) secure servicePooja Nehwal
 

Dernier (20)

The Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfThe Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdf
 
The Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfThe Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdf
 
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
 
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
 
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
 
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
 
The Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfThe Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdf
 
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsHigh Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
 
Booking open Available Pune Call Girls Wadgaon Sheri 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Wadgaon Sheri  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Wadgaon Sheri  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Wadgaon Sheri 6297143586 Call Hot Ind...
 
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
Dharavi Russian callg Girls, { 09892124323 } || Call Girl In Mumbai ...
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
 
The Economic History of the U.S. Lecture 26.pdf
The Economic History of the U.S. Lecture 26.pdfThe Economic History of the U.S. Lecture 26.pdf
The Economic History of the U.S. Lecture 26.pdf
 
The Economic History of the U.S. Lecture 25.pdf
The Economic History of the U.S. Lecture 25.pdfThe Economic History of the U.S. Lecture 25.pdf
The Economic History of the U.S. Lecture 25.pdf
 
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
 
Gurley shaw Theory of Monetary Economics.
Gurley shaw Theory of Monetary Economics.Gurley shaw Theory of Monetary Economics.
Gurley shaw Theory of Monetary Economics.
 
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...
 
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service NashikHigh Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
High Class Call Girls Nashik Maya 7001305949 Independent Escort Service Nashik
 
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
WhatsApp 📞 Call : 9892124323 ✅Call Girls In Chembur ( Mumbai ) secure service
WhatsApp 📞 Call : 9892124323  ✅Call Girls In Chembur ( Mumbai ) secure serviceWhatsApp 📞 Call : 9892124323  ✅Call Girls In Chembur ( Mumbai ) secure service
WhatsApp 📞 Call : 9892124323 ✅Call Girls In Chembur ( Mumbai ) secure service
 

Non linearregression 4+

  • 1. NON-LINEAR REGRESSION 1 Non-Linear Regression © 2006-2008 Samuel L. Baker The linear least squares method that you have been using fits a straight line or a flat plane to a bunch of data points. Sometimes the true relationship that you want to model is curved, rather than flat. For example, if something is growing exponentially, which means growing at a steady rate, the relationship between X and Y is curve, like that shown to the right. To fit something like this, you need non-linear regression. Often, you can adapt linear least squares to do this. The method is to create new variables from your data. The new variables are non- linear functions of the variables in your data. If you construct your new variables properly, the curved function of your original variables can be expressed as a linear function of your new variables. We will be discussing two popular non-linear equation forms that are amenable to this technique: Equation Interpretation Linear Form Y = Ae u Y is growing (or shrinking) at abX constant relative rate of b. ln(Y) = ln(A) + bX + ln(u) Y = AX u The elasticity of Y with respectb to X is a constant, b. ln(Y) = ln(A) + b@ln(X) + ln(u) Consider the first equation, Y = Ae u. This is an exponential growth equation. b is the growth rate. u isbX a random error term. If you take the logarithm of both sides of that equation, you get ln(Y) = ln(A) + bX + ln(u). This equation has logarithms in it, but they relate in a linear way. It is in the form y=a+bX+error, except that y, a, and the error are logarithms. (A review of logarithms and e is coming up on the next page. Bear with me until then.) This means that if you create a new variable, the base-e logarithm of Y, written as ln(Y), you can use the regular least squares method to fit ln(Y) = ln(A) + bX + ln(u). That is a way of fitting the curve Y = AebX to your data. (We will go over this again after the review of logarithms.) Similarly, consider the second equation, Y = AX u. This is a constant-elasticity equation (more on why Ib call it that later), typically used for demand curves. Take the logarithm of both sides of that equation and you get ln(Y) = ln(A) + b@ln(X) + ln(u). For this equation, if you create the variable ln(Y) and also a variable for the base-e logarithm of X, written
  • 2. NON-LINEAR REGRESSION 2 as ln(X), you can use the regular least squares method to fit the curve Y = AX to your data.b Before we go further into how to use these new equations, we had better review logarithms and e. Logarithms defined: aIf a = c then b = log c .b ab = log c is read, “b is the log to the base a of c.” I remember the logarithm definition by remembering that: The log of 1 is 0, regardless of the base. Anything to the 0 power is 1. If I can remember those two facts, then I can arbitrarily pick 10 as my base and write: 1010 = 1 and log 1 = 0.0 aFrom that I get a = c and log c = b, by substituting “a” for 10, “b” for 0, and “c” for 1.b aYou can't take the log of 0 or of a negative number. The c in log c must be a positive number. ee (. 2.718282) is the base of the “natural logarithms” (log is written “ln”). Natural logarithms are used for continuous growth rates. Something growing at a 100% annual rate, compounded continuously, will grow to e times its original size in one year. (The diagram on the preceding page shows a 100% growth rate.) Something growing at an r annual rate, compounded continuously, will grow to e times itsr original size in one year. In Excel, the function =EXP(A1) raises e the power of whatever number is in cell A1. =LN(A1) takes ethe natural log of whatever is in cell A1. Some exponential algebra rules e = e ea+b a b e = (e )ab a b e = aln(a) e = ab•ln(a) b e = 10 Some corresponding logarithm algebra rules ln( ab ) = ln( a )+ln( b ) ln( a ) = bAln( a )b ln( e ) = aa ln( 1 ) = 0 Non-linear models that can be made linear using logarithms: Now we can get back to the curved models introduced at the beginning of this section and give fuller explanations. Constant growth or decay equation Y = Ae ubX Suppose you’re modeling a process that you think has continuous growth at a constant growth rate. This is like the diagram on page 1. You want to estimate the growth rate from your data.
  • 3. NON-LINEAR REGRESSION 3 Y = Ae u is your equation.bX X is often a measure of time. X goes up by 1 for each second, hour, day, year, or whatever time unit you are using. Sometimes, X is a measure of dosage. A is the starting amount, the amount expected when X is 0. b is the relative growth rate, with continuous compounding. u is the random error. Notice that we multiply by the error, rather than adding or subtracting the error as in standard linear regression. u has a mean of 1 and is always bigger than 0. u is never 0 or negative. Use this equation if: The analogy with steady growth or decay makes sense. Y cannot be 0 or negative. X can be positive, 0, or negative. The interpretation of b in Y = Ae u:bX b is the parameter in which you are most interested, usually. Your estimate of b is your estimate of the relative change in Y associated with a unit change in X. Mathematically, if X goes up by 1, Y is multiplied by e . That is because Ae equals Ae , whichb b(X+1) bX+b equals Ae e , which is Y is multiplied by e . That may not look like “relative change,” but it is, if you arebX b b using continuous compounding. People who use these models usually make a simpler statement about b. They say that if X goes up by 1, Y goes up by 100b percent. They mean that if X goes up by 1, Y is multiplied by (1+b). For example, if your estimate for b is 0.02, then it is said that if X goes up by 1, Y goes up by 2%, because Y is multiplied by 1.02. (1 + .02 = 1.02.) The 1+b idea is fine so long as b is near 0. For small values of b, e is close to 1+b. Multiplying by 1+b isb close to the same as multiplying by e . For example, if b is 0.05 and X increases by 1, Y is multiplied byb e , which is about 1.051, so Y really increases by 5.1%. That is pretty close to 5%. Most things in the.5 financial world and the public health world grow pretty slowly, so the 1+b or b-percent idea is OK. The downloadable file about time series has more details on this. How to make the growth/decay equation linear: To convert Y = Ae u to a linear equation, take the natural log of both sides:bX ln(Y) = ln(Ae u) Apply the rules above and you get:bX ln(Y) = ln(A) + bX + ln(u) To implement this, create a new variable y = ln(Y). (The Y in the original equation is “big Y.” The new variable is “little y.”) Also, define v as equaling ln(u) and a as equaling ln(A).
  • 4. NON-LINEAR REGRESSION 4 Subsitute y for ln(Y), a for ln(A), and v for ln(u) in ln(Y) = ln(A) + bX + ln(u) and you get: y = a + bX + v This is a linear equation! It may seem like cheating to turn a curve equation into a straight line equation this way, but that is how it’s done. Doing the analysis this way is not exactly the same as fitting a curve to points using least squares. This method this method minimizes the sum of the squares of ln(Y) - (ln(A) + bX), not the sum of the squares of Y - Ae . In our equation, the error term is something we multiply by rather than add. Our equation isbX Y=Ae u, rather than Y = Ae +u.bX bX We make our equation Y=Ae u, rather than Y = Ae +u, so that when we take the log of both sides we getbX bX an error, which we call v, the logarithm of u in the original equation, that behaves like errors are supposed to behave for linear regression. For example, for linear regression we have to assume that the error’s expected value is 0. To make this work, we assume that the expected value of u is 1. That makes the expected value of ln(u) equal zero, because ln(1) = 0. In Y=Ae u, u is never 0 or negative, but v can takebX on positive or negative values, because if u is less than 1, v=ln(u) is less than 0. When you transform Y=Ae u to y = a + bX + v and do a least squares regression, here is how youbX interpret the coefficients: b8 is your estimate of the growth rate. a8 is your estimate of ln(A). To get an estimate of A, calcualte e to the a-hat power. Getting a prediction for Y from your prediction for y After you calculate a prediction for little y, you have to convert it to big Y. Your prediction for Y = e . In Excel, use the =EXP() function.Your prediction for y An example The first two columns are your data in a dose-response experiment. The third column is calculated from the second by taking the natural logarithm. Dose Bacteria LnBacteria 1 35500 10.4773 2 21100 9.95703 3 19700 9.88837 4 16600 9.71716 5 14200 9.561 6 10600 9.26861 7 10400 9.24956 8 6000 8.69951 9 5600 8.63052 10 3800 8.24276
  • 5. NON-LINEAR REGRESSION 5 11 3600 8.18869 12 3200 8.07091 13 2100 7.64969 14 1900 7.54961 15 1500 7.31322 Your regression results are: LnBacteria is the dependent variable, with a mean of 8.8309284 Variable Coefficient Std Error T-statistic P-Value Intercept 10.57833 0.0597781 176.95997 0 Dose -0.2184253 0.0065747 -33.222015 0 You have found that each dose reduces the number of bacteria by about 22%. Prediction, showing how it is calculated: Variable Coefficient * Your Value = Product Intercept 10.57833 1.0 10.57833 Dose -0.2184253 16.0 -3.4948041 Total is the prediction: 7.0835264 90% conf. interval is 6.861792 to 7.3052607 Your prediction for the number of bacteria if the dose is 16 is e = 1192. In Excel, calculate7.0835264 =EXP(7.0835264). The 90% confidence interval for that prediction is from e to e , which is6.861792 7.3052607 about 955 to 1488.
  • 6. NON-LINEAR REGRESSION 6 Graph of Y=X u2 u is log-normally distributed with a mean of 1. b<1 example: Y = 5x u-1 Constant elasticity equation Y=AX ub Another non-linear equation that is commonly used is the constant elasticity model. Applications include supply, demand, cost, and production functions. Y = AX u is your equationb X is some continuous variable that’s always bigger than 0. A determines the scale. b is the elasticity of Y with respect to X (more on elasticity below). u , the error, has a mean of 1 and is always bigger than 0. Use this equation if: • X and Y are always positive. X and Y can not be 0 or negative. • You suspect, or wish to test for, diminishing (|b|<1) or increasing (|b|>1) returns to scale • If it is reasonable that the percentage change in Y caused by a 1% change in X is the same at any level of X (or any level of Z, if you are doing a multiple regression). That is why this is called a “constant elasticity” equation. A constant elasticity model can never give a negative prediction. If a negative prediction would make sense, you do not want this model. If a negative prediction would not make sense, this model may be what you want. The interpretation of b, the elasticity: b is the percentage change in Y that you get when X changes by 1%. Economists call b the elasticity of Y with respect to X. If b is positive, you see a pattern like in the diagram above. If b is negative in this equation, the pattern is like a hyperbola. The points get closer and closer to the X axis as you go the right. The points get closer and closer to the Y axis and they get higher and higher as X goes to the left and gets near 0. If you do a multiple regression version of this, with the equation Y = AAX AZ Au, then b is the percentage change in Y that you get when X changesb c by 1% and Z does not change. Economists say b and c are elasticities of Y with respect to X and Z. How to make this linear: If you take the log of both sides of Y = AAX Au , you get:b
  • 7. NON-LINEAR REGRESSION 7 ln(Y) = ln(A) + bAln(X) + ln(u) To make this linear, create two new variables, y = ln(Y) and x = ln(X). (If you have more than one X variable, take the logs of all of them.) Let a be ln(A) and v be ln(u), and our equation becomes nice and linear: y = a + bx + v As with the growth model, to use least squares, we must assume that v behaves like errors are supposed to behave for linear regression. One of those assumptions is that v’s expected value is 0. That is why we assume that the mean of u is 1. That fits because ln(1) = 0. u is never 0 or negative, but v can take on positive or negative values, because if u is less than 1, v=ln(u) is less than 0. The multiple regression version of the constant elasticity model works like this: Y = AAX AZ Au is the equation.b c Take the log of both sides to get: ln(Y) = ln(A) + bAln(X) + cAln(Z) + ln(u) which you estimate as y = a + bAx + cAz + v where y = Ln(Y), a = ln(A), x = ln(X), etc. This equation lets you look for diminishing or increases returns to scale. If |b+c| < 1, you have diminishing returns. Doubling X and Z makes Y go up less than twofold. If |b+c|>1, you have increasing returns. Doubling X and Z makes Y more than double. Sometimes a linear model shows heteroskedasticity -- apparently unequal variances of the errors -- that takes the form of the residuals fanning out or in as you look down the residual plot. This constant elasticity form can correct that. Getting a prediction for Y from your prediction for y As with the growth-decay model, when you calculate a prediction for y, you have to convert it to Y. You do this by raising e to the y power, because Y = e . In Excel, use the =EXP() function.y An example Here are some data: Price Visits LnPrice LnVisits 10 512 2.30259 6.23832
  • 8. NON-LINEAR REGRESSION 8 10 396 2.30259 5.98141 10 456 2.30259 6.12249 10 525 2.30259 6.2634 20 347 2.99573 5.84932 20 377 2.99573 5.93225 20 423 2.99573 6.04737 20 330 2.99573 5.79909 30 366 3.4012 5.90263 30 335 3.4012 5.81413 30 301 3.4012 5.70711 30 309 3.4012 5.73334 40 345 3.68888 5.84354 40 320 3.68888 5.76832 40 325 3.68888 5.78383 40 285 3.68888 5.65249 The first two columns are the actual data. The third and fourth columns are calculated as the natural logs of the first two columns. 3.6888 approximately = LN(40), for example. LnVisits is the dependent variable, with a mean of 5.9024412 Variable Coefficient Std Error T-statistic P-Value Intercept 6.8044237 0.1496568 45.466851 0 LnPrice -0.2912347 0.047653 -6.1115685 0.0000269 The estimated coefficient of LnPrice says that when the price is 1% higher, there are 0.29% fewer visits. To predict visits if the price is $25, first calculate =EXP(25). It is about 3.218875825. Use that in the prediction form. Prediction, showing how it is calculated: Variable Coefficient * Your Value = Product Intercept 6.8044237 1.0 6.8044237 LnPrice -0.2912347 3.2188758 -0.9374482 Total is the prediction: 5.8669755 90% conf. interval is 5.6865181 to 6.0474328 The prediction for the logarithm of visits is 5.8669755. The prediction for visits is =EXP(5.8669755), which is about 353. The 90% confidence interval for that prediction is from =EXP(5.6865181) to =EXP(6.0474328), which is about 295 to 423. Notice that 353 is not in the middle of this confidence interval.
  • 9. NON-LINEAR REGRESSION 9 More comments on our two non-linear models Time series often use the ln(Y) = ln(A) + bX + ln(u) form. The multiple regression version has more than one X variable. Your independent (X) variables measure time, either Sequentially: 0,1,2,3,... or 1996, 1997, 1998 , ... or Cyclically: seasonal dummy variables (to be explained next week) Notice that you do not take the logs of these X variables, just the Y variable. The coefficient b is the growth/decline rate, meaning that a change in X of 1 corresponds with a 100b percent change in Y, if b is small. Cross section studies, that look for causation rather than time trends, often use the constant elasticity form, ln(Y) = ln(A) + bAln(X) + ln(u) For this model, your independent variables have a proportional effect on your Y variable. You do take the logs of your X variables. Coefficients are elasticities, meaning that a change in X by 1% (of X) changes Y by b percent. General comments on working with transformed equations You must assume that the error in the transformed equation has the desired properties (normal distribution with mean 0). Once you get your estimates from the transformed equation, going back to the original equation can be tricky. Some original-equation parameter estimates are biased, but consistent, if the parameter was transformed (e.g. A in the models above). Confidence intervals around predicted values are no longer symmetrical. You must get the confidence interval from the transformed equation and then transform the ends back. Before you start with using a non-linear regression equation: Have a good reason for not using a linear model, such as a theory of how the process that you're observing works, or a pattern you see on a graph or in the residuals from a linear regression Determine which non-linear equation is best for your data. Can you make a sensible analogy with steady growth or decay? How about with demand or production? To do the regression: Use algebra (or just read the above) to transform your original non-linear equation into one that is linear. For example, Y = AX u transforms tob ln(Y) = ln(A) + bAln(X) + ln(u). Create the variables you need from your data.
  • 10. NON-LINEAR REGRESSION 10 Use least squares, including the transformed variables in your data set. Your predictions, and at least some of your estimated coefficients, will have to be transformed to anti-logs to get back to the parameters in the original non-linear equation. In both of these equations, the predicted value of ln(Y) must be transformed with the exp function to get a predicted value for Y.