Lecture 20 : Random Variables: Continuous and Discrete

IIT Kanpur July 201
20 followers
Jun 5, 2024
[Music]
Hello friends welcome to the course
multivariate procedure with r now from
this lecture and in the next couple of
lecture we are going to talk about the
random variables and probability
distributions and uh we are going to
begin with a univariate case and then
gradually I will extend it to a
multivariate case now the next question
comes why do we need a random variable
the basic uh job of a statistics is to
analyze the
data now how the data is collected on
what it depends on the objective suppose
the objective is to know the age of the
persons staying in a
colony then what are you going to
do you are going to collect the
observations on
age of those people who are staying in
that
Colony you are not going to collect the
observation on the weight of those
people who are staying in the same
Colony also you are not going to collect
the age of those people who are staying
in some other area some other colony so
if you try to see in this very simple
example when the objective is to find
out the average age of the people who
are staying in a colony you are going to
collect the observations on the age of
people who are staying in that
Colony so now what is age age is a
variable on which you you are going to
collect the
observation similarly if you want to
know the effect of a medicine in
controlling the direct blood pressure
what do you like to do you will try to
give the dose of the
medicine to a group of patients and then
you will try to record the data on blood
pressure you are not going to collect
the data on the body temperature of
those
patients but in case if your objective
is that how the medicine is going going
to control the body temperature or fever
of the people then what are you going to
do then you are going to collect the
data on the body
temperature so you see based on the
objective of the study you always try to
Define a variable on which you are going
to collect the data now when you are
trying to collect the
data on certain variable there is always
going to be some random
variation which is beyond our control
suppose if I ask
you that what is the content of nitrogen
in the soil in a field do you agree with
me that the content of the
nitrogen of the soil in the entire field
is going to be the same or similarly if
I say what is the level of
moisture in the soil in that field do
you think that the level of moisture at
every point in the field is going to be
the same no
there will be a small variation so that
is
why there is some uncertainty involved
in the
observation and that is why in practice
or practically we say that we have got a
random variable on which we are going to
collect the
observation now different questions crop
off how should you define the random
variable how should you measure this un
uncertainty and uh and when the
observations are going to have
uncertainty their behavior will depend
on the type of process what they
have so how to characterize the behavior
of the process through a mathematical
function why do you need a mathematical
function we understand and we believe
that any result which is based on the
foundations of mathematics is acceptable
and it is well accepted
at every place it is just like if I
declare in my
class that all the students who are
wearing a blue shirt they will be
getting a grade A and all the students
who are wearing a say this white shirt
they will be getting a Grade B and all
those student who are getting say this
grade c those who want to have grade C
they have to wear suppose a black color
shirt and so on do you think that this
type of decision is going to be
acceptable certainly not but if I say
okay I will take your
exam and I will give you some questions
for which I have taught you in the whole
semester and if you get more than 90%
marks I will give you grade A in case if
you say get a between 75 and 90% Mark
then I will give you Grade B and so on
do you think that this decision is going
to be acceptable answer is yes now what
is the difference between the two ways
of of making decision in the second case
there is an involvement of mathematics
so that is why whenever we are trying to
find anything from the data that has to
be in some mathematical format and that
is why whatever we are observing that
has to be a numerical value whatever is
the uncertainty involved that has to be
defined in s in such a way which is
mathematically compatible so now all
these different aspects
we are going to discuss in this lecture
and in a couple of lectures in the
future now in this lecture we are going
to talk about the random
variables so basically I can tell you we
have
a a very well
defined definition of random
variables which is based on strong
foundations of
mathematics
but definitely uh the objective in the
course is not to go into the details of
mathematical
statistics we have a topic major theory
in which we try to define the random
variables in a proper way using the
proper mathematical definition but
definitely here I'm going to make it in
a very simple way so that you can
understand it from the application point
of view now in case if I try to broadly
classify you can have have two types of
observations for example if you roll a
dice then there can be possibilities of
number like 1 2 3 4 5 and
six but if I ask you to measure the
heights of the
students that can be 155 CM that can be
155.0 CM that can be
150 51 1 cm and so on so you can see
that in the case of height the values
can be taken in a defined
interval whereas in the rolling of a
dice the values are going to be taken
are only the integer
values and beside this thing when you
try to roll a DI then there is always
the probability of occurrence of the
event and in case if you try to Define
your event then the probability also
probability is defined and if the event
changes then the probability of event
also changes
so so even what you are going to observe
is something but you want to translate
it to a mathematical function because
the basic requirement in statistics is
that we need the mathematical data or we
need the values in mathematics on which
we can do different types of
mathematical
operations so now we try to understand
these things one by one and in this
lecture let us try to understand the
basic concept of continuous and discrete
random variables so let us begin our
lecture so now the first question comes
here why do you need a random variable
and this random variable can be
univariate by variate or say
multivariate univariate mean there is
only one variable by variate mean there
are two variables and multivariate mean
there are say this more than one
variable by variate is also a particular
case of multivariate so so we know that
some concepts are required to draw the
statistical conclusion from a sample of
data about a population of Interest why
if you try to see what is the basic
objective of Statistics statistics is
always trying to observe a small sample
of data and based on that it always try
to take the some statistical conclusions
which are valid for the entire
population right for example in case if
you want to know that uh what is the
initial salary of students uh who are
graduating in the St six subject from a
university now what you can do that you
can draw there a sample suppose I try to
draw a sample of say 100 student who are
going to complete their degrees in the
statistics program and based on that we
will try to find out that what is the
average salary of these hand students
but we are going to use it to define or
to give the information for the whole
population that mean the expected salary
of all the students who are graduating
or completing their degree with the
statistic subject similar is the case
when we are trying to deal with a
clinical trial uh medicine is exposed or
given to a group of people but whatever
are the conclusions they are going to be
valid over the entire population right
Suppose there is some new medicine new
drug that is given to a sample of
selected patients and suppose some
patients show Improvement and some
patient does not show the Improvement so
and our objective is that we want to
understand what is the what are the
different effects or Consequences of
this medicine when it is given to the
people in this country or in this world
so that mean the population of patients
so now in order to understand this thing
in order to implement this concept that
how to implement the conclusion based on
a small sample to a whole population we
need some basic statistical concept and
among them the random variables are
going to lay the foundation of the
theoretical Concepts which are required
to make such a statistical inferences
and conclusion you would like to go for
sampling you would like to go for
estimation we would like to go for test
of hypothesis which are the different
components of the statistical inference
and you will see the beginning of all
these procedure is the random variable
now let me try to give you an idea or an
example through which I can explain you
that what is an experiment what are the
outcomes and how a random variable is
associated and how it is transformed to
a statistical function so let me take
here a very simple example of coin where
we toss the coin and whenever we toss a
coin the outcomes are either either head
or tail right so we know that the sample
space in such a case which we are trying
to denote by Capital Omega that's a a
standard symbol for the sample space it
is a collection of all such points which
I'm trying to indicate by small Omega
where Omega where this small Omega can
be either head or tail right so I can
say now here that okay the outcome of a
crossing of a coin is either head or
tail so just by writing St or head or
tail do you think that is it really
going to help us it is very difficult to
handle the elements in statistics if
they are not in numbers so now we need
to do something so that we can convert
this outcome of head and tail into some
numbers which is in turn going to help
us in doing different types of
statistical calculations so now we
suppose we Define this capital x to be a
function such that when Omega is
observed as head that is small Omega
then the value of the X which is
indicated by here x Omega takes one and
if the outcome is tail then X Omega
takes value zero so now if you try to
see on one side you have here head and
tail and on other side you have here the
numericals some numbers and in
statistics as soon as we have numbers we
are in a position to implement our
mathematical functions so you can see
here that now X is the real valued
function which is defined on the sample
space Capital Omega but what is
happening that Capital Omega has had and
tail now it is bringing us to some other
space where these are going to be
indicated by here two numbers like this
one for head and zero for tail so this
type of transformation is needed and
this type of transformation is being
done by this function here x right so
this x is called as random
variable why this is called as a random
variable because when you cross a coin
then unless and until the experiment is
completed you don't know whether you are
going to get head or tail so there is
some Randomness involved so now this
head is denoted by one and tail by zero
so this sample space Omega has now 2
points Zer and one right so you can see
here earlier this Omega was here s and T
but now Omega is transformed to a new
set of values where which takes value 0
and one so now in any random experiment
we are always interested in the value of
some numerical quantity which is
determined by the result we are not
really interested in all the details of
the experiment I'm not really interested
that how you have tossed the coin
whether 5T high or 7 ft high or in the
20° centigrade or say 100° Centigrades
this is not my concern what I want I
just want please give me the outcome
head tail tail head Etc and these
quantities of Interest they are
determined by the result of the
experiment and these are associated with
this random variables now the because
this these values are determined by the
outcome of an experiment and we are
trying to associate here a random
variable whose outcome is not known with
100% confidence that if you toss a coin
unless and until it comes on the ground
you don't know whether it is going to be
head or tail both the possibilities are
there so suppose we assume or we say
that okay there are 50% chances a head
will come and and 50% chances the tail
will come so in that case we can
associate the probability with the
outcomes of the random variable so you
can see here that X is taking values
here one and zero one forhead so if I
say that x equal to 1 that means head is
observed and the probability of
observing xal to 1 that is the
probability of observing here head this
is 1 upon 2 0.5 and similarly the
probability of observing tail that is
the random variable X takes value zero
is also here 1 by two so now we can view
X as a random variable which collects
the possible outcomes of the random
experiment and capture the uncertainty
associated with them right so this is
how we are going to introduce the random
variable so now if I try to translate
whatever I have explained you so now in
short I can say here that let Capital
Omega represent the sample space of the
random experiment that what are the
possible values which can be observed
and let this capital r be the set of
real numbers right now I can Define or I
can see that a random variable is a
function X which assigns to each element
small Omega belonging to Capital Omega
one and only one number for example X X
Omega is equal to small X small X
belongs to r that is X is trying to map
Capital Omega to R so that you can see
here Capital Omega in the earlier
example had two points H and T and R had
here two points 1 and zero H is being
transported to one and T being
transported to zero so H and T are
mapped to one and zero respectively
right so before I go further with the
details of uh this random variable and
other aspect you C me try to explain you
here what is the convention in statistic
that how do we indicate the random
variable and its values you know that
when you are trying to define a random
variable then you are going to get the
observation on them for example suppose
if I say that I want to have the
observation on the heights of the
students Heights of of a
students so these Heights are going to
be measured for different student and
say suppose CM so I can Define the
heights of the student as a random
variable capital x and suppose now I now
I obtain the height
of say
student number say here one and suppose
it comes out to be suppose here 100 cm
so this is indicated by here small X and
this is the first observation so I can
say here this is a small X1 and
similarly if if I say that height of the
St number two is suppose 180 cm then
this can be denoted by here small X2 so
now what I'm trying to do I'm trying to
indicate the height of the student as
capital X in capital alphabets and the
associate values in lower case alphabets
and this numbers are trying to indicate
the observation number this the first
observation second observation and so on
similarly in case if I try to suppose I
decide that okay let me try to also
collect the weights of the
students so now I can use here another
variable here say here capital Y to
indicate the weights of the student and
suppose we are going to measure them in
kilogram suppose the weight of the
student number one comes out to be
suppose here 50 kg so this will be
denoted by here a small y1 and suppose
the weight of the second stent comes out
to be 60 kg then it is going to be
indicated by small Y2 so if you try to
see what I have done I'm trying to
indicate the random variables by the
uppercase
alphabets and their values by the lower
case alphabets so actually this is a
convention in statistics to indicate or
denote the random values by capital
letter alphabets uppercase alphabets and
their values by small letters say this
lowercase alphabets so if I try to take
the random variable to be here capital X
then their values will be small X right
so that is and if I try to write down
here say suppose if I write down here
let X1 X2 say
x00 be
the
heights of students what does this mean
that means we have got 100 numerical
values or we have got the heights of the
hand
students which are some number which are
some numerical values right okay now
when we are talking about the random
variables then we have two types of
random
variable one
is called as discrete random variable RV
means random variable and other is
continuous random variable what are
these things so let me try to uh first
give you a brief idea and uh then I will
try to give some more examples of these
type of random variables so when you are
trying to consider a random variable
which is taking the values only at some
points then it is called in simple word
as discrete for example if I say the
number of heads obtained when you are
crossing a coin 100 times so you cross a
coin 100 times try to count the number
of HS once again try to Coss a coin 100
times count the number of heads so this
number is always going to be an integer
and it can take all possible values
between 1 2 3 4 up to 100 but if I say
there are
25.5 heads it's not there so all the
values they are concentrated only at
some points so the random variable whose
set of possible values can be written as
a finite sequin x1x2 xn or as an
infinite sequin X1 X2 dot dot dot they
are said to be discrete so the sample
space of uh such a random variable that
is said to be discrete if it consists of
a finite or countable set of outcomes
right for example in the example which I
just explained you that you try to c a
coin for 100 times and then try to count
the number of heads in such a case the
random variable it is a random variable
whose set of possible values is the set
of non- negative integers 1 to 100 and
this is a discrete random variable so
now we consider an example Suppose there
is a c customer care phone and which has
30 external lines that means there are
something like 30 telephone connection
and different customers are calling to
the customer care so at a particular
time that some of the lines may be used
and others may be free so at a given
point of time suppose five customers are
calling then five of the lines will get
occupied if there are 10 customers which
are calling then the 10 lines will be
occupied and suppose if more than 30
customers are call calling at the same
time then the all the 30 lines will be
used and the customer will be asked to
wait right so now at a given point of
Time how many telephone lines are being
used that is not known to us so this can
be indicated by a random variable X so
now can see here x can take difference
between different values uh say from 1
to 30 that means only one line is being
used or two lines are used or 30 lines
are used now suppose if I say that at a
particular time there are five telephone
lines which are being used that means
the value of the capital x here is five
so this is going to be indicated by
small X so I can say here if five lines
are used then small X will be equal to
five and this is how we are going to
interpret it okay now I have given you a
faar idea about the discrete random
variable now I come to continuous random
variable suppose the length
or temperature fluctuation or
calibration cutting tool Veer bearing
weer Etc they have to be measured right
and they are going to be measured in
some units for example the temperature
fluctuation that can be in degree
Centigrades or degree
Fahrenheit whereas those cutting tool we
are mean that means when you when you
are trying to use an equipment it gets
distorted so how much it has been
distorted after being used
that can be measured in some units like
how that how much material is reduced in
grams or volume Etc but anyway you can
see that whenever you are trying to
measure such observations then what is
going to happen first of all there will
be small variations in the
measurements and this variations may be
due to different reasons for example uh
just now I had given you an example that
if you want to measure the moisture
level in the soil in a field then the
level of moisture contain in different
parts of the field it is not going to be
same but there will be small variation
so now in such a situation if you try to
represent by capital x the quantity
which you are going to measure then you
cannot say that the random variable is
going to take the values only at some
finite values for example as in the case
of
discrete we say that if there are five
telephone lines are going to be used
then the value of the random variable is
five and if a eight lines are going to
be used then the value of the random
variable is eight but in the case of
this moisture level in the soil or say
temperature this can be 30° CG 30.1 de
Cen 30.1 1° C 30. 111° Centigrades and
so on so there will be some random
variation and these values are going to
be defined as if the random variable is
going to assume the values in in the
form of an interval of real numbers
right so if I try to consider that for
any equipment you are going to measure
the length temperature fluctuation
calibration etc etc this type of model
will give us an idea about the Precision
in the length measurements but these
values are going to be measured on some
continuous scale there will always exist
values between two values that is what I
mean to say so now I can say that uh
there exist random variable that take on
a Continuum of possible values and such
variables are known as continuous random
variables and another example I can give
you is the for uh measuring the lifetime
of a bulb that can be one day one day
one hour one day 1 hour one second Etc
so in case if you want to make an
assumption on the bulb's lifetime then
we can assume that the lifetime of the
bulb is lying in some interval say A and
B where A and B both are positive right
so in such a case we have a concept of
say this continuous random variable and
in both the we have considered the
univariate case that mean there are only
there is only one variable now we are
going to consider a situation where the
process is going to be affected by two
random variables so we call them as a by
variate random variable so these two
random variables they can be independent
they may be dependent what does this
mean the two random variables are going
to be independent if the occurrence or
non-occurrence of one variable does not
affect the occurrence or say
nonoccurrence of the second variable and
they are dependent that if the
occurrence in the first variable affect
the outcome in the second variable right
well we will understand that how to
define such a Independence through the
random variable in the forcoming
lectures and both these random variables
they can be continuous means both are
continuous both are discrete or a
combination of them that one of them is
continuous and another is discrete so
this is the general setup of a by
variate random variable right for
example in case if I say I want to
measure the height and weight of a
person so this can be indicated by
saying that let X1 indicates the height
and X2 indicate the weight of a person
and both we know that height and weight
they are the positive value so I can say
that the person's height and weights are
assumed to take on any value in the
interval A1 B1 and A2 B2 respectively
right so height lies between A1 B1 and
weight lies between A2 B2 for example
height can be between suppose say 50 cm
to suppose 1770 cm and the weight can be
suppose here 10 kg to here 60 kilog
right so these are some numerical values
so now the question is this in
statistics how do we we express such by
variate random variable so it is
indicated by a 2 cross one vector now
this is a mathematical vector vector
like vectors and matrices it is not a
data Vector of the r software so we try
to indicate here as say here it's a
vector of random variable X1 and X2 and
we write this here as a xcore is a 2
cross one vector or I can write down
here as a X1 X2 transpose and when we
are trying to have this two random
variables then some other properties
also come into existence now if you try
to see I I started with a unived random
variable I extended to two random
variable and similarly I can extend to a
general setup where we have more than
two random
variables right and this setup will be
called as multivariate random variables
so Suppose there are more than two
random variables and once again all the
random variables they can be independent
they can be dependent and we have a
statistical measur by which we can
actually judge and it is possible that
all the random variables they can be
continuous they can be discrete or they
can be a combination that some are
continuous and some some are discrete so
this is the setup of a multivariate
random variable right so say one simple
example can be if I try to extend the
example of height and weight that
suppose I want to measure measure the
this different parameters of a human
being so suppose I want to measure the
person's height weight age blood sugar
and blood pressure so there are going to
be height can be measured by X1 weight
can be measured by X2 a can be measured
by X3 blood sugar can be measured by X4
and blood pressure can be measured by X5
right and suppose these all these
variables will have some numerical
values which are going to be assume that
let that height which is indicated by X1
it is lying between A1 B1 second
variable X2 is lying between A2 B2 third
variable is lying between A3 B3 fourth
variable is lying between A4 B4 and
fifth variable is lying between A5 B5
and for example I can assume depending
on the situation suppose I assume that
all Ai and V they are greater than zero
right although I am taking here in
example where all the variables I'm
assuming to be continuous but they can
be discrete also or it is possible that
suppose X1 X2 X3 are continuous and X4
and X5 are discrete that is also
possible but here my objective is to
give you the idea of uh what is a
multivariate random variable so now all
these five variables they can be
expressed in a vector which is of order
5 by one and the way I had expressed X1
and X2 similarly I can extend it to X1
X2 X3 X4 X5 or this is a transpose of X1
X2 X3 X4 X5 now in case if you want to
uh take the observations so suppose if I
consider here the by cutup so suppose if
I say here person number here one and
say person number here two and suppose
the height of the person number one
comes out to be 150 cm and the weight of
the person number one this comes out to
be suppose here 50 kg and for the person
number two suppose the height comes out
to be 160 cm and the weight is suppose
60 kg so now these are the observations
which are going to be indicated by X1
underscore like this and the second
observation is going to be like here X2
uncore right similarly if you try to
consider here a multivariate setup so
now you will have suppose I have the
data of here person number one and
person number two for the person number
one you will have here a vector of 5 by1
height weight age blood sugar blood p PR
and similarly for the person number two
height weight age blood sugar and blood
pressure and this will be indicated by
here xcore one and uh the data of the
second person will be indicated by xcore
two so that is indicating that these are
the observations on the here five
variables right so now I can now Express
in general that suppose we have got here
P random variables which are indicated
by Capital X1 Capital X2 up to here
Capital XP so all these variables can be
defined in a in the setup of a p cross
one random vector and this Vector can be
indicated by here as xcore and which
will be here A P cross one vector
consisting of values X1 X2 XP and which
can also be written as say here X1 X2 XP
transpose now in case if you want to get
here the first value then it will be
like as a first value on X1 first value
on x2 first value on here see here XP
like I can say X11 X12 up to here X1 p
and similarly you can have here the
second value third value and so on so in
such a case the space of X this random
Vector will consist of of set of n
tuples that means n sets of observation
if I see here we are getting here X1 X2
xn like this okay so now we come to an
end to this lecture and uh you can see
here uh that was a pretty Elementary
lecture but my objective was to expose
you with the concept of random variables
because you will see that in all the
statical tool our first sentence is
going to be let X be a random variable
that can be a unived random variable
that can be a bate random variable or
that can be a multiv random variable it
depends on the requirement and objective
of the study that what we really want to
do and depending on the setup that
depending on the choice of random
variables our statistical tools are
going are also going to differ in case
if my random variable is continuous then
the way I am going to operate or find
out different types of tools for example
mean or even
variance that is going to be a different
way in comparison to when my random
variable is
discrete and suppose if we have a
combination then we have to see that how
are we going to compute different
statistical
quantities now depending on the nature
of random variable we have different
types of characterization of the
probability function and based on that
all other
tools they also change so now but at
this moment my request to you will be
try to have a loop in some
books and try to read more about this
random variables once again again I will
say the way I have explained you the
random variable Concept in this lecture
this is a very Elementary one but my
objective was to expose you so that I
can take you forward to a multivarious
setup in case if my objective is to give
you a course on probability Theory or
major Theory possibly I will give you
all those basic definitions here and
believe me we have very concrete solid
definitions which are based on Hardcore
mathematics for uh random variables and
different types of concept that we are
going to use further but once again I
will say that I'm not going into the
mathematical details well I have limited
time here but I will request you that
you try to now start reading a book on
any this probability Theory or the
probability distribution mathematical
statistics whatever book you want uh
there are books which are varying from
lower level of mathematics to a hardcore
mathematics and this is the how this is
the way uh by which we both can go
together and the learning and and in the
same time the learning process can make
you learn better you will understand
More
Concept so you try to read from the book
try to understand these concept and I
will see you in the next lecture till
then
[Music]
goodbye
[Music]
[Music]
[Music]
