Numerical and graphical summaries fro one variable with R and Stata PDF

Title Numerical and graphical summaries fro one variable with R and Stata
Course Data Analysis
Institution Universitat Pompeu Fabra
Pages 5
File Size 84.9 KB
File Type PDF
Total Downloads 75
Total Views 311

Summary

Numerical and graphical summaries fro one variable with R and Stata...


Description

Description of one variable !

Numerical summaries of one numerical variable with R! 1. Read data: File -> Import Data -> from Excel! 2. Read data correctly: > head(nof)! 3. First set if numerical summaries: > summary(insur)! 4. Five summary num(min, 1q, median, 3q, max): > fivenum(nof$v) 5. More complete set of numerical summaries: > library(“psych”) -> > describe(nof$v)

Numerical summaries of one numerical variable with Stata! 1. Read data: Import -> Excel spreadsheet ¡MARK IMPORT FIRST ROW AS VARIABLE NAME!! 2. Read data correctly: browse! 3. First set of summaries: summarize! 4. More complete set of numerical summaries: summarize, detail

POSITIVE SKEWNESS is SKEWED TO HE RIGHT! KURTOSIS CLOSE TO 0 = DISTRIBUTION SIMILAR TO THE NORMAL ! IF IT’S SMALLER THAN 3 = PLATIKURTIC! IF IT’S GREATER THAN 3 = LEPTOKURTIC!

Graphical summaries of one numerical value with Stata! HISTOGRAM:! 1. Menu Graphics -> Histogram! Or ! 2. hist nameofvariable, bin(number of intervals we want)!

STEMPLOT: stem nameofvariable The "*" to the right of the stems shows you where the leaf should go to obtain the actual value in the data set. For instance the first stem "1*", and the first leaf "6", tells you that you have "16" in the data set.!

You can split the stems in 5 with the "width(2)" option and in 2 with the "width(2)" option (Notice that it goes the other way round, the number in the width option says how many leaves go in each stem.) For instance splitting this same stemplot in 5:! stem!Days,!width(2) This is not a useful stemplot, there is too much spread in the leaves to be able to interpret it. The symbols to the right of the stem mean the following:!

Stems"that"contain"zeros""and"ones"""are"indicated"by""*"! """""""""""""""""""twos"""""""threes"""""""""""""""""""t"""! """""""""""""""""""fours""""""fives""""""""""""""""""""f"""! """""""""""""""""""sixes""""""sevens"""""""""""""""""""s"""! """""""""""""""""""eights"""""nines""""""""""""""""""""."!

To split the stemplot in two stems, the command is:! stem!Days,!width(5) and you get:! ""1."|"66777789! ""2*"|"2! ""2."|"88! ""3*"|"11! ""3."|"! ""4*"|"! ""4."|"58! ""5*"|"01! ""5."|"66! ""6*"|"034! ""6."|"9! ""7*"|"3! ""7."|"! ""8*"|"! ""8."|"! ""9*"|"012!

Now the symbols mean:! Stems"that"contain"the"digits"0-4"are"indicated"by""*""and"those"that! contain"5-9"are"indicated"by"".""!

If you don't like the default rounding of the data proposed by Stata, you can also change the rounding with the "round" option. For instance if you wanted to make the leaf unit equal to 0.1:! stem!Days,!round(0.1)

BOXPLOT: 1. Graphics -> Boxplot! Or! 2. graph box nameofvariable!

Numerical and graphical summaries of categorical variable with R! 1. Read data: File -> Import Data -> From excel ! ABSOLUTE FREQUENCIES: > table(nof$v) RELATIVE FREQUENCIES (proportions): > prop.table(table(nof$v)) PERCENTAGES: > 100*prop.table(table(nof$v))

PIECHART: ! > nof.freq pie(nof.freq)!

BAR DIAGRAM: ! > nof.freq barplot(nof.freq)!

Barplot with relative frequencies instead of absolute: ! > nof.freq barplot(nof.freq)!

Numerical and graphical summaries of categorical variable with Stata 1. Import data: File -> Import -> Excel spreadsheet ¡mark read first row as the name of v!! FREQUENCY TABLE: menu Statistics -> summary tales and tests -> Frequency tables -> One-way table ! Or ! tabulate nameofvariable! PIE CHART: graph pie, over(nameofvariable)! BAR DIAGRAM: graph bar, over(nameofvariable) !...


Similar Free PDFs