![]() The price is stored in the ‘price’ variable, while the ‘foreign’ variable is a binary indicator of whether a car is local (0) or not (1). ![]() Let’s use the t-test command to determine whether the prices for foreign and domestic cars are same or not. We can know that r(p50)stores the median value or r(skewness)stores the skewness value. The scalars that hold these values can be obtained through the same command as before: return list R-Class Scalars and the Summary DetailĪnother way to look at how R-Class scalars are used is through the summary detail command which entails adding an option to the summarizecommand: summarize mpg, detailĪdding this option returns us a more detailed summary table that includes statistics like different percentiles, skewness, kurtosis, and the four smallest and largest values. It is best to refer to the descriptive list in the help section in this case. In this case, r(N) and r (sum_w) have the same value of 74 even though they represent different statistics. This approach is however prone to errors since it is possible that more than one summary statistic holds the same value. We can see that the value of 12 here corresponds to r(min)so it is clear that this scalar holds the minimum value of the variable summarized. r(sum_w) shows us the sum of weights.Ī more manual approach is to compare the values returned by the summary table with the values in the scalar list (list produced using return list command). ![]() There will be comprehensive list of all the R-class scalars produced by the summarize command, and a description of what they represent. To obtain these details, simply open the help page for the summarize command using the command help summarizeand scroll to the bottom. For example, it may not be immediately obvious what the scalar r(sum_w)intends to display. ![]() But some stats in this list are not entirely self-explanatory about what they are, nor are they displayed in the summary table. use the return listcommand and get a list of all the scalars that store a statistic. So, how do we know what scalar name corresponds to which statistic? One way to do it is what we described above, i.e. This calculates the range of the variable that was summarized without us having to input the numbers on our own. We can also perform calculations using these scalars: display r(max) - r(min) In this case, this new variable will have the value of 41 for all observations. If, for example, we want to create a variable called ‘maxvar’ that should contain the value stored in the ‘r(max)’ scalar, we can do the following: gen maxvar = r(max) More than displaying these values, these scalars are used more often in conducting other operations and analysis. This displays the maximum value (41) of the ‘mpg’ variable that was summarized. We can display these scalars, or execute certain commands using them. ‘r(N)’ stores the number of observations that the summarizecommand returned. This command returns the list of scalars and the corresponding statistics that are stored in them. They can be checked by using the following command: return list The statistics that the summarizecommand returns (and some more) are stored in predefined scalars by Stata.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |