Say I have a variable age grouped into three or four levels 0-25 years e.t.c and I want to get the mean and standard deviation age of each group. How do I go about that?
Great question! To do that you can use what Stata calls "factor notation." This means that you tell Stata that a given variable is categorical. To do that, use the prefix "i." before a variable. Say that your variable is called "age." You would enter "i.age" in the command and it will then create a separate line in the table for each category. This video walks gives an example starting at around the 6:00 mark.
@@jasonburns2579 Great. At that point in the clip, we get proportions in decimal places. Could I use that for mean in representing Table 1 of summary statistics say for a numerical variable coded with levels like age or BMI?
@@RosatiSamuel For that you would want to create a crosstabluation or two-way table. The idea with that is you declare your categorical variable as the row variable and then specify which descriptive statistics you want in each row. A simple way to do that would be to use the command "tabstat BMI, by(age)" You can customize it more using the table and tabulate commands. I have a video on crosstabs you may find helpful in this scenario.
Hi and great question! When specifying a variable as an indicator (using "i."), in the backgroun Stata then treats each value of the variable as binary where 1 means that an observation is in that group and 0 means that it is not. That is then used to calculate proportions (in the mean column) and standard deviations. Hope this helps!
@@mbout3456 Ah ok. Here the standard deviations can be interpreted as a standard deviation for a proportion. The text here is unfortunately a but clunky but there are some good sources with more detail on this topic that can be found online
You can download a copy of the data from my website at www.jasonburnsphd.com/new-jersey-school-performance-data but you will need your own copy of Stata
how do you get a percentage
you can use the command "tab1 [varlist]" to generate a frequency distribution table
Say I have a variable age grouped into three or four levels 0-25 years e.t.c and I want to get the mean and standard deviation age of each group. How do I go about that?
Great question! To do that you can use what Stata calls "factor notation." This means that you tell Stata that a given variable is categorical. To do that, use the prefix "i." before a variable. Say that your variable is called "age." You would enter "i.age" in the command and it will then create a separate line in the table for each category. This video walks gives an example starting at around the 6:00 mark.
@@jasonburns2579 Great. At that point in the clip, we get proportions in decimal places. Could I use that for mean in representing Table 1 of summary statistics say for a numerical variable coded with levels like age or BMI?
@@RosatiSamuel For that you would want to create a crosstabluation or two-way table. The idea with that is you declare your categorical variable as the row variable and then specify which descriptive statistics you want in each row. A simple way to do that would be to use the command "tabstat BMI, by(age)" You can customize it more using the table and tabulate commands. I have a video on crosstabs you may find helpful in this scenario.
@@jasonburns2579 Thanks alot.
Hello Jason, Thank you for the video. What does the standard deviation mean in your last table for the categorical vatiables? Thanks again.
Hi and great question! When specifying a variable as an indicator (using "i."), in the backgroun Stata then treats each value of the variable as binary where 1 means that an observation is in that group and 0 means that it is not. That is then used to calculate proportions (in the mean column) and standard deviations. Hope this helps!
@@jasonburns2579 thanks Jason, however I still don’t know how to interpret the standard deviation stats in this case.
@@mbout3456 Ah ok. Here the standard deviations can be interpreted as a standard deviation for a proportion. The text here is unfortunately a but clunky but there are some good sources with more detail on this topic that can be found online
I am student please reales as free the data of stata
You can download a copy of the data from my website at www.jasonburnsphd.com/new-jersey-school-performance-data but you will need your own copy of Stata