Now we are going to start building SBM model in.
If you do not know how to set up our or our our studio or you are not comfortable with the basic operations
and art, I would recommend that you first complete these section on basics of R.
In that section.
You will know how to set up our studio and how to do some basic operation than art so that you do not
face difficulty by creating this as a model.
So let's start.
The first step of building a model is getting the data.
I have the data in Aceh as we fly.
And that's CSP file is saved at this location.
So I'm importing that data into art, using this lead CSP we function.
So whenever you have your data in text format or Exelis format or CSP format, try to create us.
As we find out of it.
And it will be very easy to get the data from that as we file.
However, in order, you can also import data from text files.
But reading from us, ESV is more efficient and there'll be less chance of any error when you do it
like this.
So in the lead.
Yes, we function.
You first have to give the.
Location of defile.
No, two things here.
First thing is.
If you copy paste the location of the file, by default, you'll be getting backslash, is it?
But in art, when you're giving the location.
Should be forewords flashes.
So it should be like this.
That is a forward slash and not like this.
That is a backward slash.
The second parameter is header, which specifies that whether the first column of your data contains
headers or not.
That is the variable names are not.
So sent in my CSP file, the first row contains the header or the variable names.
That is why I have written here that is equal to true.
Now the result of this function will be stored in movie.
And the result is the data from the CSP.
So when I ran this by pressing control into.
You can see that our data frame called Movies' created and did write fiction.
If I click on movie.
A command incident with his View movie, so you can either run this command, which is a new movie to
look at the data or you can click here, which automatically Prentis Command.
And you can see that this is the data that we want to do analysis on.
It has all the variables and columns and all the observations and growth.
And the last column, which is static Oscar, which we want to predict, contains devalue one or zero,
meaning that if that particular movie won an Oscar, there be one here.
And if that particular movie did not win an Oscar, there'll be zero.
So let's get back.
Now, we have imported the data and it is stored in this movie very well.
But before we start analyzing the data, just certain steps that we need to take, which are part of
data processing data, pre processing is critical to the model.
If the debris processing is done correctly, only then we'll be able to get good model results.
I'm showing here only one step of data processing, which is missing value imputation because it is
mandatory that there should not be any missing value in any sale of the data.
If there is any missing value, our model will not be able to run.
So because this is mandatory.
That is why I am telling you.
But in general, data preprocessing contains many steps such as outlier treatment.
Looking at the variable distributions by plotting histograms and identifying skewness or finding or
correlations and removing variables which are highly correlated and so on.
So there are several steps in data preprocessing.
So here we'll be doing missing value imputation.
First, we need to identify the variable in which there are any missing values.
So we'll run the summary command, which gives us a summary of all the variables in our database.
So you can see for all the variables, I'm good at getting minimum, maximum, average.
First, second and third quartile values.
But for this variable I'm taking, that is an additional value, which is and is.
So whenever in your CSP file there is a blank cell.
And we import that data into are that blank cell will be saved as an A..
And this time taken variable has a will.
And is that is there are 12 cells which are empty.
Now, when we have empty cells in a variable, we need to put some value in those cells.
Usually we have to look at business knowledge to determine.
But value to be used to replace these blank values.
Sometimes it makes sense to use zero.
Or it may make sense to use maximum value out of all the observations.
As the replacement to blank cells, generally, it makes more sense to replace those values with mean
or median of the other values that we actually have in that variable.
So here I am showing you the method to replace these blank values.
Using the mean of other observations that we have.
So let me explain to you this line of code.
We first find out the mean of all the values which do not have a name then.
So for the movie dataset, in the time taken variable, we removed the Emmys and find or demean this
value is to be placed in those cells where I am taken variable has any value.
So wherever in time taken variable we have any value, we will replace that any value with the mean
of all the other cells where the value is not any.
So if I had done this.
Come on.
And then look at somebody again, you you'll see that am big and variable now does not have any any.
So in this way we do missing value imputation.
This is the only thing we are doing in data processing.
There are other steps also that you should take.
And I recommend that you learn all those steps so that you create a better model after importing the
data and doing data prepossessing.
We are ready to work on our data.