Presentation on demonstrating the model with new Entries as Random Effects
Ashu Guru
Author
03/13/2019
Added
809
Plays
Description
Presentation on demonstrating the model with new Entries as Random Effects, by Ashu Guru, University of Nebraska Raikes School (4.0 mins)
Searchable Transcript
Toggle between list and paragraph view.
- [00:00:00.680]In this video we are going to look at the new entries as a random effect.
- [00:00:06.360]Majority of the code that we will use here is similar to the one where we used
- [00:00:12.482]and new entries as fixed effects.
- [00:00:15.640]There are a couple of additions like we have to add indicator variables and how
- [00:00:22.122]do you calculate the value of blups.
- [00:00:25.040]So we'll just walk through this code.
- [00:00:28.120]All the information that is in this code should be easily recognizable by you
- [00:00:34.123]because you have either used it in the previous examples or we have had small
- [00:00:40.127]tutorials on those functions.
- [00:00:42.400]And I am going to load the library lmer test.
- [00:00:49.520]The next step is where is the import file for data.
- [00:00:55.160]I am going to change the working directory,
- [00:00:58.614]define a variable called input file.
- [00:01:02.160]I read the input data into a frame which is called input data and now I am going
- [00:01:10.465]to add an indicator variable called new where if the value of corresponding
- [00:01:18.259]column entry is greater than 50 then the value of nu is 0 otherwise it is one.
- [00:01:27.280]I am going to add another indicator variable which is called entry C So entry
- [00:01:32.918]C allows us to group all the new entries into a single group.
- [00:01:38.600]So here we are saying that if it is a new variable because if the value of nu is
- [00:01:48.746]greater than 0 then I want A9999 otherwise I just want whatever is the ID
- [00:01:58.015]of that corresponding column entry.
- [00:02:05.440]The next three statements are very important to tell R that block is a
- [00:02:11.558]factor variable, entry is a factor variable,
- [00:02:15.436]and entry C is a factor variable.
- [00:02:18.880]Now to check the structure.
- [00:02:22.840]So we see that entry is factor, name is factor, block is factor,
- [00:02:29.683]new is a number, but entry C is a factor.
- [00:02:34.000]So I should also make new as a factor.
- [00:02:47.550]So let's make new as a factor, and now we'll do a structure again.
- [00:02:55.600]So new is also a factor with two values or two levels, zero and one.
- [00:03:02.400]Now we'll run our model.
- [00:03:04.320]We will calculate the summary and print the output on the screen that R prints
- [00:03:11.204]out the formula that it used and then a table for random effects and a table for
- [00:03:18.262]fixed effects and then as correlation of fixed effects as well.
- [00:03:25.240]The next function that you are looking at is what is called as RANF and RANF is
- [00:03:32.422]basically.
- [00:03:33.320]Let's search the documentation of RANF and it is a it extracts the modes of
- [00:03:39.700]random effects.
- [00:03:40.960]So this is a generic function to extract the conditional modes of random effects
- [00:03:45.395]from the fitted model.
- [00:03:46.960]So this will give us the blups and I am going to print that on the screen and
- [00:03:55.083]here is the output for the block.
The screen size you are trying to search captions on is too small!
You can always jump over to MediaHub and check it out there.
Log in to post comments
Embed
Copy the following code into your page
HTML
<div style="padding-top: 56.25%; overflow: hidden; position:relative; -webkit-box-flex: 1; flex-grow: 1;"> <iframe style="bottom: 0; left: 0; position: absolute; right: 0; top: 0; border: 0; height: 100%; width: 100%;" src="https://mediahub.unl.edu/media/10793?format=iframe&autoplay=0" title="Video Player: Presentation on demonstrating the model with new Entries as Random Effects" allowfullscreen ></iframe> </div>
Comments
0 Comments