FIND DATA: By Journal | Sites   ANALYZE DATA: Help with R | SPSS | Stata | Excel   WHAT'S NEW? US Politics | IR | Law & Courts🎵
   FIND DATA: By Journal | Sites   WHAT'S NEW? US Politics | IR | Law & Courts🎵
WHAT'S NEW? US Politics | IR | Law & Courts🎵

Run R Code Example Online

# Descriptive Statistics for Interval-Level Variable
#############################################################
library("poliscidata")
#############################################################

# The values of interval-level variables are numbers that really mean something.
# The age variable in the GSS dataset is a good example of a interval-level variable.
# The gss$age variable records the age in years of respondents.  Makes sense, right?
# We have the most tools for describing interval-level variables.
cat("Summary Statistics:\n")
describe(gss$age, weights=gss$wtss)

# Describing interval variables is something of an art.  
# Our goal should be to show the appropriate level of detail.  
wtd.hist(gss$age, weight=gss$wtss, main="This level of detail (5 year groups) is better.", col="gray80")

cat("Frequency Distribution Table::\n")
freq(gss$age, gss$wtss, main="Whoa. We probably do not need to plot each age separately!")