noc19-ma14 Lecture 33-Fitting of linear Models:Least Square method- One Variable

IIT Kanpur July 201
20 followers
Dec 3, 2023
This lecture discusses variables, relationship between variables, idea of parameters. The method of least squares is introduced to obtain the parameter estimates in a linear model on the basis of a given sample of data.
[Music]
[Music]
welcome to that lecture on the course
descriptive stats it with our software
in this lecture we are going to start
with a new topic fitting of linear
models so you see what happens whenever
we have a sample of data then the first
information is obtained from the
graphical tool and suppose we have data
on two variables and both the variables
are associated they are not independent
then definitely this observation will
have some correlation structure so first
step will be to create a plot like as a
graphic plot a smooth a scatter plot and
so on those plots are going to give us
an idea there is an association present
in the data now after this we try to use
different types of tools for example
correlation coefficient to quantify the
degree of Association or the degree of
linear relationship now the final
question which is remaining is can we
find out the mathematical relationship
between the two variables or can we find
a statistical model between the two
variables and if yes how to do it so
that is the question which we are going
to entertain in this topic fitting of
linear models now we are assuming that
there are two variables or there can be
more than two variables and there exists
some relationship between those
variables right and whenever there is a
relationship there are going to be two
types of variable one output variable
that mean the the variable on which we
obtain the values of the output and
second aspect will be
input variable so whatever are the
values which are given to the so called
input variable based on that we will
have an output for example suppose if I
say that whenever we are doing some
agriculture then the weight of a crop
that depends on the quantity of
fertilizer that in case if I try to
increase or decrease the quantity of
fertilizer in the field then up to a
certain extent the craft will increase
or decrease yeah obviously if you try to
increase it more than the crop will get
burnt up so this is a case where we can
see that relationship between the yield
of the crop the quantity and the
quantity of fertilizer similarly if I
try to extend this relationship then we
know from our experience that the
outcome of a variable in this case for
example the field of the crop it does
not depend only on one variable the
quantity of fertilizer but it depends on
other variables also quantity of
fertilizer temperature rainfall
irrigation moisture and so on so now I
have given you two situations where the
outcome is going to be dependent on one
variable and on more than one variables
so now how to handle this situation this
is what we are going to understand in
this lecture we assume that a
relationship exists between two
variables or this can be generalized
that the relationship exists between our
variable and more than one variables and
so on
that we will see later on and in this
type of relationship we assume that the
outcome of variable is affected by one
or more than one variables for example
the example which we have just
considered that the yield of a crop
increases with an increase in the
quantity of fertilizer
right similarly if you try to see in
case if you try to observe the phenomena
of an electric fan so whenever we try to
increase the speed how it is done that
is controlled by a switch and we try to
control the switch from police number
one to position number two position
number two to position number three and
in this process what is happening inside
the switch the quantity of current that
is increased so I can say that when I am
trying to increase the position of the
switches from one to two to three and so
on then automatically inside the switch
the amount of current flowing in the
circuit increases and finally the
outcome of the fan which is the RPM that
is rotation per minutes increases or in
simple words the speed of the fan say
increases similarly in another example
we have seen that as the temperature of
the Heather increases then the quantity
of water consumed is more you can see
that will consume more water during
summer than winter right so in this type
of example where I am saying that the
speed of an electric fan which is
measured by the rotations per minute
because increases as the voltage or
current increases people drink more
water as the weather temperature
increases and similarly the same example
that the yield of a crop depends on
other variables also like as quantity of
fertilizer rainfall weather temperature
irrigation etc right so now we are
assuming that such type of relationships
can be expressed through models and
model is a very fancy word in nowadays
everybody wants to find out a model
among the variables and so how to do it
but first question comes what is a model
this model is only a
so what of mathematical or aesthetical
relationship among the variables and
this relationship is in such a way such
that it is representing or depicting the
phenomena that whatever is happening
this is indicated by the mathematical
functioning of the mathematical
relationship or the statistical
relationship so when we talk of this
modeling then modeling and relationship
among the variables they are the same
thing and in such a case the
relationship is characterized by two
things one is variables and say another
is parameters so the first question
comes that what is the difference
between variables and parameters so this
one will try to address in a very simple
language through a very simple example
but before going further back we clarify
here that what type of relationships can
exist then there can be different type
of relationship and broadly I can
classify them into two parts linear and
nonlinear now in this course we are
going to entertain only the linear
relationships now I come back to my
means earlier issued that how to start
so whenever there is a phenomena or
whenever there is something is happening
then in that phenomena is you have to
observe that usually there will be two
types of variables or the variables can
be divided into two categories one
category is input variables and another
category is output variables now the
first question comes that how to pick a
call or how to decide that which of the
variable is an input variable and which
of the variable is an output variable so
this I can explain you with the two
simple example for example we
from our experience that whenever a
student is studying more usually he or
she will get more marks so now I have
here two variables one is the marks in
the examination and second is the number
of hours a student studies so now in
this situation I will try to ask two
question that there are two
possibilities one possibility is that I
can assume that marks depends on the
number of our studies and second option
will be that the number of hours studied
depends on the marks obtained now in
such situation there is no mathematical
rule or statistical rule which can
explain you but this is only your
experience with the data the information
about the phenomena that is going to
help you in taking a call or in taking a
decision that which is affecting what so
in this case we have two options as I
have given in the slides that the marks
depend upon the number of hours a
student studies or the second option is
the number of hours of study depends
upon the marks obtained by the student
right now each one is correct this is
correct and this statement is wrong and
similarly if I try to take another
example that the end of a crop depends
on the quantity of fertilizer and
temperature of Heather or the reverse
happened that the quantity of fertilizer
or the temperature of that depends on
the yield so in this case second option
is not possible and we know only from
our experience that weather temperature
and the quantity of fertilizer both are
going to affect the amount of eel up to
a certain extent so in this case the
quantity of fertilizer and the
temperature of
whether they become the input variables
and the ield of the crop becomes an
output variable so in this case if you
try to see we have two options which are
written on the slide that the yield of a
crop depends upon the rainfall and
weather temperature or the second option
is that the rainfall and this is either
temperature depends upon the field of
the crop so obviously the four sentence
is correct and second sentences wrong
this is wrong and similarly in the first
case this was wrong
right so this is how we try to decide in
a phenomenon that what is going to be an
input variable and what is going to be
an output variable in any given
situation now the next question is that
whenever we are trying to write down a
model model is essentially going to be a
mathematical equation yes the statical
concept will be used to obtain that
mathematical equation but in that
equation there will be two components
one is variable and another this
parameter so I will try to take here a
very simple example to explain you that
what is the difference between the two
and what is the role of variable and
parameters in a model now I am going to
take an example of the equation of a
simple linear line which you have
possibly studied in class 10 11 or 12 y
equal to MX plus C you see y equal to MX
plus C has two types of component one
category I can define as X&Y and another
category is M and C out of these two
categories one set of quantities is a
variable and another set of quantities
is a parameter now how to take a call
how to decide what is what so let me try
to explain you here so we know that the
equation of a straight line is given by
y equal to MX plus C where your C's
interceptive and this line suppose it
looks like this so here X is the x-axis
and this X is going to indicate the
values on the x axis and this is my here
y-axis and here this Y is going to
denote here the values on y-axis and
this quantity here is C here C so C is
going to be an intercept term right and
this angle that is going to be
represented by M in terms of it can of
the angle the trigonometric function so
this is how we denote this equation y
equal to MX plus C now in this equation
if you see there are two options which I
can explain you here one is here X and y
and second here is M and C and now out
of this one of them is parameter one of
the set is representing parameter and
another set is representing variable now
means I can give you a simple theory
that please mash these two columns so
you column one and column two that is
the simple type of question that you
have solved that please match match the
columns so now let us try to understand
through an example that how you can do
it
suppose I give you first option as that
you know the value of x and y suppose I
know the value of x and y to be say X
equal to 4 and y equal to 2 then my
question is can we know the entire
information or all the information about
the line so in this case your y equal to
MX plus C will become say here y equal
to 2 X equal to 4 and then M plus C now
looking at this line do you think that
you have the entire information above
the line
certainly not
I just know that there is a point X
equal to 4 and y equal to 2 now the
second option is this that instead of
having the values of x and y I know the
value of M and C and suppose M is equal
to 5 and C is equal to 6 in this case
the equation becomes here y is equal to
5x plus 6 now my question is do we know
the entire information about this line
or can we really know by looking at this
equation all the information contained
in this equation about the line the
answer is yes if you wish even I can
plot this line here see here 1 2 up to
up to here so here is 6 so this line is
somewhere here like this where this is
going to present the intercept MC and
similarly this angle is given by this
quantity here 5 10 of theta is equal to
5 or 10 of angle is equal to 5 so now
one can see here by looking at the
values of M and C I can have the entire
information about this line so this
option one was incorrect and option two
is correct so now if you try to have
here in more detail that what is
happening in this equation you have to
keep in mind that your ultimate
objective is to know the equation y
equal to MX plus C now when I say that I
want to know the equation y equal to MX
plus C then it is equivalent to knowing
M and C means if you tell me the values
of M and C then I know the entire line
if we know m and C we know the entire
line
whereas just by knowing X&Y I do not
know the entire line so in this
situation such quantities MNC they are
called as parameters
another values on which we try to
collect the values they are called as
variables so what will happen that if I
try to take the earlier example of marks
obtained in the examination they depends
upon see here some parameter here M in
two numbers of hours of study plus C so
we see here that here this marks and
here number of hours of study they are
my variables and M and here C they are
the parameters so what we try to do we
try to conduct an experiment and we
collect the data on variables collect
the data on variables right so now I can
solve your this question and I can say
here that x and y are the variables and
M and C are the parameters so if you try
to see what is the advantage or how you
are trying to make a decision the
parameters are those values which we
give you the entire information about
the model so whenever we call that we
want to find out a model in simple word
I'm trying to say I want to know the
values of the parameter so whenever we
hear the sentence like that we want to
construct a model that is equivalent to
saying that I want to estimate or I want
to know the values of the parameters on
the basis of
given sample of data right so now how
this data is collected and how to
indicate in our stat scale language how
to make symbols and notation for the
data so we try to take an example here
and and we try to understand so now we
take an example here this is the same
example what we can consider about the
quantity of fertilizer and eel suppose
capital X is a variable which is
denoting the quantity of fertilizer in
kilogram and Y is the variable which is
denoting the field of a crop in kilogram
so what is being done here we are trying
to conduct an experiment and we are
trying to collect the data so that we
know what we have in our hand and our
objective is that we want to find out
the relationship between x and y that is
the quantity of fertilizer and yield of
the crop so now we conduct the
experiment and collect the observation
in the following way suppose I take a
plot of some fixed size yeah don't
change the size of the plot fixed size
and then we put 1 kilogram of portrayer
in the field and after some time we get
here say sis kilogram of ield so this is
going to give us the value of x 1 and
this 6 kg of yield is going to give me
the value of y 1 similarly i try to
repeat the experiment and then on a plot
of the same size I try to put 2 kilogram
of fertilizer so this quantity will be
denoted as say X 2 which is the second
observation on X then after some time we
are suppose we observe that 7 kg of ield
is obtained so in this case the value of
y for the second observation is 2
converted as y 2 and similarly I can
keep on repeating for example I can take
three kilogram of fertilizer and its
value is going to be denoted by X 3 and
then we obtain 6 kg of field suppose and
this value is here y 3 so you can see
here we are going to obtain here the
paired observations like when I give the
value of X 1 then I get the value of y 1
when I give the value of x 2 then I get
the value of y 2 and when I give the
value of x 3 then only I get the value
of y 3 and so on and suppose we say that
we have obtained si n number of
observations so all these paired
observations are going to be denoted by
X 1 y 1 x 2 y 2 up to here X and yn
right now once we have obtained such
paired observations x1 y1 x2 y2 x and y
n then the first information is given by
the graphical plots so we try to plot
this data on a scatter diagram so for
example I have just made it here these
are the point which are indicating the
data points suppose this is here X 1
this is here Y 1 so this data point is
denoting the value of x 1 y 1 similarly
suppose this is here X 2 this is
indicating here Y 2 so this data is
point is the location of the point x2 y2
and so on right so now you can see here
that looking at this graph you can
decide whether there is going to be a
linear trend or not right so you can see
here that the things are going in this
direction soda there is a presence of
linear trend in the data or they can be
a nonlinear trend also but my objective
is here that by looking at the values of
these observations how to know the
equation of this line how to know
this thing or how to know the equation
of the curve and this equation is going
to be found in such a way such that it
is representing the population what is
the meaning of discontents you see
whenever we are trying to make a model
the model is given a Honda or say for
the entire population and the problem is
that we do not know the entire
population so we have to work on the
basis of given sample of data for
example have you ever heard a statement
like this medicine controls the body
temperature of Americans for seven hours
and the same medicine controls the body
temperature of Indians say for 10 hours
and the same medicine controls the body
temperature of say say German people
only for five hours it doesn't happen
medicine is a medicine and the effect of
medicine under the similar type of
persons we will also be the same and
that will be valid for the entire
population all over the world right but
when we are trying to know the duration
of the temperature control we try to
conduct an experiment by giving the
doses of the medicine to some people we
try to obtain the data and then we try
to find out the equation of the curve or
the line and based on that we make a
conclusion and this conclusion is valid
for the entire population this is the
entire process of modeling but here in
the Cris course we are going to find
only the equation right the remaining
part
there is a course on say linear
regression analysis and the tools are
for linear regression analysis gives you
all the information that how to
construct a linear model right but here
we are just going to concentrate only on
one aspect okay
so that is our now objective so now that
we try to take here the same example
what we had considered in the earlier
lectures and we try to see how to get
this equation of the curve so you may
recall that we had considered an example
we had recorded the marks in the
examination obtained by twenty students
out of five hundred marks and the number
of hours they studied in a week so this
data is given here for example in the
first row here the marks are obtained
and in the second row the number of
hours studied by that corresponding
students are given so say this is to n
number one he studied he or she studied
for 23 hours and he or she has got 37
marks out of 500 and so on so this data
is here for twenty students so this is
two number one is student number two is
two number three up to here is student
number twenty right
so now we want to know what is the
relationship between the marks obtained
and the number of hours studied in a
week although we know from our
experience that marks obtained by
students in increase as the number of
hours increase but we would like to see
whether this statement is correct or not
right so suppose I have a stored this
data on marks inside a variable named
marks like this in the our software and
similarly the data on number of hours is
stored inside a variable named hours
like this inside the our software and
how this data is presenting that is what
you have to see so we have collected
this data and this is how we are going
to represent the data that
x1 is equal to 23 then y1 is equal to
337 score that data inside the hours and
marks a data vector that is given in the
same order you can see here this is 23
337 so this is 337 in the first position
and 23 in the first position similarly
we have the second value 25 of X 2 and 3
1 6 4 y 2 so this is again in the same
order say 3 1 6 here and 25 here so the
data for the paired observation is given
in two different vectors but the order
of the observation remain the same in
both the vectors this is very important
and you should keep in mind so you can
see here this 23 occurring is here 25
occurring is here 26 occurring is here 3
37 is occurring here 3 1 6 is occurring
here 3 27 is occurring here and then
after this these are the peer
observation 23 and 3 237 25 and 3 1 6
and similarly here
26 and 327 right this is what you have
to keep in mind now what is your first
step first of all I would try to create
here a plot that we already have
actually done by including the command
plot inside the argument our sin marks
right so you get here a plot like this
and you can see here that there is a
sort of linear trend and in case if you
try to make plots like a.j scatter it is
smooth another thing they will also give
a sort of estimated clothesline but my
objective here is to know that how this
line is created so before going into the
details of this let me give you here a
small information on the notations in
the language of statistics the variables
are denoted by Singlish alphabets like
as ABC X Y Z and so on and whereas the
rameters they are indicated by the Greek
letters like Alpha Beta Gamma Delta and
so on so that is our standard language
so now the equation which I had just
expressed as Y is equal to MX plus C we
had understood that M and C are the
parameters so I try to represent it in
the statistical way and we try to write
down the variable here as say Y and
instead of here M I use here beta X plus
here alpha so that is a standard
notation when we are trying to say that
the model is linear now we consider the
same example and we move forward so you
can see here in the same scatter plot
these points here this small circle they
are going to denote the data points and
by my experience I have drawn a line
here which is indicated in the red color
and I have done it manually and I feel
that this is a line which is
representing the values or the
relationship between the values of x and
y and my objective is to know the
equation of this line which is in here
in red color so suppose I try to denote
the equation the mathematical equation
of this line by here y is equal to alpha
plus beta X and now you know that Y I am
using here alpha and beta and not M and
C so now in this equation y equal to
alpha plus beta X this X is going to
denote the number of hours which is here
and Y is going to indicate the marks
obtained which is plotted on the y-axis
here
and now my objective is very simple I
want to find out the relationship
between x and y in terms of y equal to
alpha plus beta x and now you also
understand and we have already discussed
that this line is known to us only when
the parameters alpha and beta are known
to us so I can say if we know alpha and
beta then the entire equation will be
known to us so now the fundamental
question comes in front of us how to
know this alpha and beta so that is the
objective what I am going to now explain
here but if we're going that try to
observe suppose I try to take in the
same figure I try to take this small
section and I am trying to enlarge it so
this is the figure here which is simply
the enlarged part of this say circle so
you can see here that this point is here
this point is here and so on and there
are one two three four points here one
two three four points here right so now
if you try to see what are you trying to
do you are saying that this red line
this is y equal to alpha plus beta X and
you assume that all the observation
point should lie on this line that is
your idea that all the observations
should lie on this line so that you can
say that this is the mathematical
equation between x and y and this is how
the experiment is being controlled but
in practice this will not happen all the
points are not going to lie exactly on
the same line so you can see here if
here is this point then
you want or you expect that this point
should lie here somewhere here and
similarly if you try to take another
point here see here this point you
expect that this point should lie
exactly on this line so you can observe
in this graph that this is not really
happening and there is some difference
between these two points and that
difference or the deviations or the
deviation between say this point and
this point indicating here is a sort of
error which is happening in our
approximation right similarly you can
see here that in all other cases also us
there's an error here here there is
error is here the error is here
and it is here error is here so you can
now notice here that there is a
deviation between the absurd points and
the corresponding points lying over the
line right and one thing what you have
to observe here that in this case there
are two values X and here Y one is here
indicating here x-axis and here it is
indicating y-axis so if you try to see
here in this case in the case where I am
making this line the values of X remains
the same in this case values of X remain
the same only Y is changing why Y is
changing you can see here one here is
Chris Y and another here is this Y so
this is essentially it called as error
and now we would like to find out the
values of alpha and beta such that
at a certain minimum and you can see
here that these others are happening in
each and every observation here here
here here here and so on so now the
question is how to compile all these
errors so that by minimizing that
quantity I can find out the value of
alpha and beta
so one objective is to minimize the sum
of such errors means I can simply
measure this error and then I try to
take the sum of all the errors and I try
to minimize them but you can see here
that when we want to measure these
errors then these errors are measured
with respect to this line this red line
so this observation which I'm indicating
here this has got an error e 1 but this
is above the line and this second
observation here for with the error here
is e 2 this is lying below the line so
now we need to measure the direction of
the points whether they are lying above
the line or below the line so we assign
that all the points which are lying
above the line I will indicate them by
plus sign and all the observation which
are lying below the line that I'm trying
to indicate with negative sign so now
when I am trying to act all these errors
then some errors are in the positive
direction and some errors are in the
negative direction with respect to the
line and hence when I try to sum them
there some may become very close to zero
or exactly zero
and this might be indicating as if there
is no error in the data or if this sum
is very small very close to zero that
will indicate that the amount of error
in the data is very small which is not
correct so now I need to devise a
methodology by which I can change the
sign or I can get rid of the sign so I
have two options either I take absolute
value or I try to square these in errors
so I opt here that we try to consider
the sum of squares of this errors that
is a better option why I am calling the
better option it's just due to
mathematical simplicity I can say at
this stage and in this case I can find
out the clear-cut expressions for the
values of alpha and beta in case if you
try to take here absolute values that is
also possible but that I am NOT
discussing in this lecture so now you
can see here that when you are really
trying to represent the values of this
observation so as we have discussed here
that there are two values corresponding
to every observation for example this is
the value here which I am observing
inside the experiment and these values
are supposed corresponding to here X
equal to say here X 1 so this quantity
will have coordinate say here X 1 and
small Y 1 now I assume that this point
should lie on this line and this line is
being denoted by Y Capital y is equal to
alpha plus beta capital X so this
coordinate is going to be small X 1 and
capital y 1 right and there is some
error in this data and we call or read
Express this error s as e1 so now in
case if I try to express this fact here
then I can express in general that every
pair of the observations satisfies the
equation like y is equal to alpha plus
beta X I plus e i we are e is are the
errors they can be in the
positive direction or they can be in the
negative direction and now we are going
to find out the values of alpha and beta
such that the sum of squares of this e
is minimum so now we take a call that we
will try to find out the equation of
this line which line this line red color
line on the basis of the given data set
or say it using all the small n paired
observation on X I and why I such that
the line is passing through with maximum
number of points and the deviations or
points with the headline are minimum so
you can see in the same picture that
this difference or this error or this
deviation this is essentially the
difference between this value see here
capital y1 and this value here is small
y1 on the y axis so this difference is
denoted as say Y I difference
Capital y I and this difference between
y and capital y can be positive or can
be negative but you have to use the same
structure that either you try to measure
them by Y I minus Capital y or y I minus
y i right
so now we will try to find out the value
of alpha and beta such that the sum of
squares of these deviations G is minimum
how to obtain it right so for that I can
use the principle of maxima and minima
and we minimize the quantity summation I
goes from 1 to n AI square which is the
sum of square of all the deviations AI
and this is denoted by capital S so now
my objective is now defined I want to
find out the values of parameters alpha
I
beta such that the line is passing
through with the maximum number of given
data points and the sum of squared
deviation or errors from the line is
minimum and this is called as method of
least square or principle of least
squares and the principle of least
square is simply saying that try to find
out the the equation of the lines in
such a way such that the line is passing
through with the maximum number of given
data points and the sum of squared
deviation from the line is as minimum as
possible so now in order to find out the
value of alpha and beta using the
principle of least square we try to
write down the sum of squares of errors
like here this and you know that e I is
given by Y ie minus alpha minus beta X I
so I try to replace this e is over here
by Y I minus alpha minus beta X I whole
square and now I have to use the
principle of maxima and minima so for
that I need to find out the first order
derivative of this s with respect to
alpha and beta I need to put it equal to
zero and then I need to check by finding
out the second order derivative that
whether the maxima or minima has been
achieved so I try to find out the first
order partial derivative of s with
respect to alpha and this give us this
equation and following the principle of
maximum minima I try to put this first
order condition equal to zero so now in
case if you try to solve it you get here
that summation Y I I goes from 1 to n
minus summation I goes from 1 to N alpha
minus beta times summation I goes from 1
to n X I is equal to 0 so this quantity
is simply your here n times y bar minus
n times alpha minus n times beta X bar
right because X bar and y bar are
defined as 1 upon n summation X I and
why
is 1 upon n summation weii right so now
you can solve this equation and this
gives you here Y bar minus alpha minus
beta X bar is equal to 0 and this gives
us that alpha is equal to Y bar minus
beta X bar which is here so now on the
basis of given set of data I can find
out the values of say here X bar and y
bar because we have observations X I and
Y I I goes from 1 to N so now this value
of alpha is going to be known to us if
beta is known so Y bar is known from the
sample data X bar is also known from the
sample data and beta is unknown so now
my next objective is how to find out
this beta so we try to do the same
process and we obtain the first order
partial derivative of s with respect to
beta and I try to substitute it equal to
0 then I get this equation and I put it
equal to 0 this is the first order
equation and now if you solve it that's
a pretty simple algebra you will get the
value of here beta like this which is
summation X I minus X bar Y I minus y
bar summation goes from 1 to n divided
by summation I goes from 1 to nxi minus
X bar whole square and now this is the
value of beta that can be obtained on
the basis of given set of data on say X
I and why I write so this estimated
value of beta which is obtained on the
basis of given sample it is denoted here
as a beta hat just write beta and put
here a gap hat right so now I can obtain
the value of beta as beta hat from the
given sample of data and
I try to substitute the value of beta
equal to beta hat in this equation of
alpha so once I try to substitute here
beta equal to the beta hat I get here
the value of alpha which now I can find
out on the basis of given set of data so
this is denoted as alpha hat so now you
can see here we have obtained two values
of parameters alpha hat and beta hat so
alpha hat is the value of alpha and beta
hat is the value of beta that can be
obtained on the basis of given sample of
data now mathematically the next issue
is how do I know whether this value of
alpha and beta are minimizing the sum of
squared deviations or not so I try to
find out here the second-order partial
derivatives of s with respect to alpha
and beta and I try to substitute the
value alpha equal to alpha hat and beta
equal to beta hat and these values comes
out to be zero that you can verify
yourself so now I have a value of alpha
hat and beta hat like this so this beta
hat is given by this expression which is
telling us the what is the value of beta
on the basis of given sample of data and
this beta hat is called as least squares
estimate of beta this is based on the
principle of least squares and similarly
the value of alpha we which is obtained
here is alpha hat y bar is minus beta
hat X bar and this can also be estimated
on the given sample of data and this is
called the least square estimate of
alpha so now you can see here the
equation y equal to alpha plus beta x
plus e that was our original model that
we wanted to find and now we have found
the value of alpha to be alpha hat and
beta 2 B beta hat X and now it will
become 0 because we have obtained this
equation in such a way such that sum of
I I square is minimum and the value of e
I for which this sum is minimum is 0 so
that is why this is called as fitted
model
right and this is simply called here as
a model and now we try to compute these
two values the values of beta hat and
alpha hat on the basis of given sample
of data on the basis of example that we
were considering earlier so you can see
here this marks is here your Y and
number of hours per week is your here X
so this is the value of y1 and this is
the value of x1 and this is the value of
x2 this is the value of y2 and so on
this is you here all that data set now I
try to compute the values of x bar and y
bar which is here y bar if you try to
compute 1 upon 20 summation I goes from
1 to 20 Y I this comes out to be 3 89.9
and X bar says simply comes out to be a
sample mean of all the values of x i's
as 35.1 and similarly the expression of
beta hat if you try to substitute all
the values this will come out to be beta
hat is equal to six point three and the
expression for alpha hat will come out
to be one sixty eight point six five so
now you can see here that your model
becomes here marks is equal to 168 point
six five plus six point three in two
hours so this is your here fitted model
and you can see here that this model has
been obtained on the basis of given
sample of data only right okay so we
stop here now in this long lecture and
you have seen that how we have computed
the values of parameters alpha and beta
on the basis of given sample of data but
we have done this computation manually
now I will try to show you in the
finished lecture that how to get all
these values from the our software
directly but it is important for you to
understand that how the values inside
the software are obtained and what are
the computations and philosophy and the
concept which has been used in the
computation so you try to understand
this concept and I will see you in the
next layer
till then goodbye
[Music]
[Music]
[Music]
