Title: | Simplified Statistics for PA 606 |
---|---|
Description: | Simplifies functions assess normality for bivariate and multivariate statistical techniques. Includes functions designed to replicate plots and tables that would result from similar calls in 'SPSS', including hst(), box(), qq(), tab(), cormat(), and residplot(). Also includes simplified formulae, such as mode(), scatter(), p.corr(), ow.anova(), and rm.anova(). |
Authors: | Burrel Vann Jr [aut, cre] |
Maintainer: | Burrel Vann Jr <[email protected]> |
License: | GPL-3 |
Version: | 1.3.4.14 |
Built: | 2024-12-03 06:51:05 UTC |
Source: | CRAN |
This function plots a bar chart (bar.chart) on a given data frame.
bar.chart(df, var1, lab = FALSE)
bar.chart(df, var1, lab = FALSE)
df |
data frame to read in. |
var1 |
the dependent/outcome variable, |
lab |
logical (default set to |
This function returns the bar chart for var1
in data frame df
.
data <- mtcars bar.chart(data,cyl)
data <- mtcars bar.chart(data,cyl)
This function plots a Box-and-Whisker (box) on a given data frame, and uses simplified calls within the function to parse the boxplot by up to 2 variables.
box(df, var1, by1, by2)
box(df, var1, by1, by2)
df |
data frame to read in. |
var1 |
the dependent/outcome variable, |
by1 |
the main independent/predictor variable, |
by2 |
a potential second independent/predictor variable, |
data <- mtcars box(data,mpg,cyl)
data <- mtcars box(data,mpg,cyl)
This function simplifies the call for Pearson's Chi Square test (chi.sq) on a given data frame.
chi.sq(df, var1, var2, correct = FALSE, post = FALSE)
chi.sq(df, var1, var2, correct = FALSE, post = FALSE)
df |
data frame to read in. |
var1 |
the dependent/outcome variable, |
var2 |
the main independent/predictor variable, |
correct |
logical (default set to |
post |
logical (default set to |
This function returns the summary results table for a Pearson's Chi Square test, examining the relationship between var1
from data frame df
, and var2
.
data <- mtcars chi.sq(data,vs,am)
data <- mtcars chi.sq(data,vs,am)
This function calculates the confidence interval (for a given confidence level) for a variable in a given data frame.
ci.calc(df, var1, cl)
ci.calc(df, var1, cl)
df |
data frame to read in. |
var1 |
the variable of interest for which the CI will be calculated. |
cl |
the desired confidence level (in percentages, ranging from |
This function returns the mean, lower bound, upper bound, and standard error.
data <- mtcars ci.calc(data,mpg,95)
data <- mtcars ci.calc(data,mpg,95)
This function creates a correlation (cormat) on a data frame of the variables in an equation.
cormat(df, formula)
cormat(df, formula)
df |
data frame to read in. |
formula |
the variables in the regression model, |
This function returns a correlation matrix for the variables provided in the formula.
data <- mtcars cormat(data, mpg ~ wt + am)
data <- mtcars cormat(data, mpg ~ wt + am)
This function applies dummy-coding to a variable of interest, enabling the creation of n or n-1 columns/variables based on n number of attributes for the variable.
dummy(df, var, remove = FALSE)
dummy(df, var, remove = FALSE)
df |
data frame to read in. |
var |
the variable to be dummy-coded. Is automatically converted to a character string. |
remove |
logical (default set to |
This function updates the data frame with new variables (columns) representing unique values of a selected variable, and a binary score (0/1) for the absence or presence of a column's represented value for each observation.
data <- howell_aids_long dummy(data, student)
data <- howell_aids_long dummy(data, student)
This subset of data comes from one iteration of the General Social Survey, administered in 2014. These data were collected by the National Opinion Research Center (NORC) at the University of Chicago. The observations represent individuals' responses to survey questions. Information about the data set can be found in the GSS Codebook at: https://burrelvannjr.com/docs/GSS_Codebook.pdf.
GSS2014
GSS2014
A data frame with 2538 observations and 676 variables.
id | respondent id number |
age | age of respondent |
sex | respondents sex |
race | race of respondent |
educ | highest year of school completed |
dipged | diploma, ged, or other |
paeduc | highest year school completed, father |
maeduc | highest year school completed, mother |
speduc | highest year school completed, spouse |
sei10 | r's socioeconomic index (2010) |
conrinc | respondent income in constant dollars |
coninc | family income in constant dollars |
degree | rs highest degree |
padeg | fathers highest degree |
madeg | mothers highest degree |
spdeg | spouses highest degree |
citizen | are you a citizen of america? |
born | was r born in this country |
year | gss year for this respondent |
cohort | year of birth |
spsei10 | r's spouse's socioeconomic index (2010) |
pasei10 | r's father's socioeconomic index (2010) |
masei10 | r's mother's socioeconomic index (2010) |
childs | number of children |
immcrime | immigrants increase crime rates |
abany | abortion if woman wants for any reason |
abdefect | strong chance of serious defect |
abhlth | womans health seriously endangered |
abnomore | married--wants no more children |
abpoor | low income--cant afford more children |
abrape | pregnant as result of rape |
absingle | not married |
accptoth | r accept others even when they do things wrong |
acqntsex | r had sex with acquaintance last year |
actassoc | how important to be active on soc or pol association |
actlaw | how likely r to do something if unjust law being cons |
adults | household members 18 yrs and older |
advfront | sci rsch is necessary and should be supported by federal govt |
affctlaw | how lliely congress give serious attention to rs dema |
affrmact | favor preference in hiring blacks |
aged | should aged live with their children |
aidscndm | condom can reduce aids |
aidslook | a health-look person may have aids |
amancstr | how important to have american ancestry |
ambetter | agree america is a better country |
ambornin | how important to have been born in america |
amchrstn | how important to be a christian |
amcit | how important to have american citizenship |
amcitizn | agree i would rather be a citizen of america |
amcult | it is impossible to become fully american |
amenglsh | how important to be able to speak english |
amfeel | how important to feel american |
amgovt | how important to respect america's laws etc |
amlived | how important to have lived in america for life |
amownway | america should follow its own interests |
amproud1 | how proud being american |
amshamed | agree there are things make me ashamed |
amsports | agree sports makes me proud to be an american |
amtv | tv should give preference to american films |
arthrtis | told have arthritis or rheumatism |
astrolgy | ever read a horscope or persoanl astrology report |
astrosci | astrology is scientific |
attend | how often r attends religious services |
attrally | attended a political meeting or rally |
avoidbuy | boycotted products for pol reasons |
babies | household members less than 6 yrs old |
backpain | r had back pain in the past 12 months |
balneg | sci research is strongly in favor of harmful results |
balpos | sci research is strongly in favor of benefits |
befair | how often do you think people take advantage |
belikeus | agree better if people were more like americans |
bettrlfe | science makes our lives better |
betrlang | which language r speaks more fluent |
bible | feelings about the bible |
bigbang | sci knowledge:the universe began with a huge explosion |
boyorgrl | sci knowledge:father gene decides sex of baby |
buypol | how important to choose products for pol reasons |
buyvalue | percent of company stock r bought from own money |
cantrust | poeple can be trusted or cant be too careful |
cappun | favor or oppose death penalty for murder |
careself | those in need have to take care of themselves |
carried | r carried a stranger's belongings |
chldidel | ideal number of children |
chngeoth | how often r try to persuade other to share views |
chngtme | how often r allowed change schedule |
choices | political parties dont give real policy choices |
citworld | i am a citizen of the world |
class | subjective class identification |
closeblk | how close feel to blacks |
closewht | how close feel to whites |
clsenoam | how close do you feel to north america |
clsestat | how close do you feel to your state |
clsetown | how close do you feel to your town or city |
clseusa | how close do you feel to america |
cntctgov | contacted politician or civil servant to express view |
colath | allow anti-religionist to teach |
colcom | should communist teacher be fired |
coldeg1 | the highest degree r have earned |
colhomo | allow homosexual to teach |
colmil | allow militarist to teach |
colmslm | allow anti-american muslim clergymen teaching in college |
colrac | allow racist to teach |
colsci | r has taken any college-level sci course |
colscinm | number of college-level sci courses r have taken |
compperf | size of perf based pay depend on profits |
comprend | rs understanding of questions |
compuse | r use computer |
conarmy | confidence in military |
conbus | confidence in major companies |
conclerg | confidence in organized religion |
condemnd | r free from conflicting demands |
condom | used condom last time |
condrift | sci knowledge:the continents have been moving |
coneduc | confidence in education |
confed | confid. in exec branch of fed govt |
confinan | confid in banks & financial institutions |
conjudge | confid. in united states supreme court |
conlabor | confidence in organized labor |
conlegis | confidence in congress |
conmedic | confidence in medicine |
conpress | confidence in press |
consci | confidence in scientific community |
contv | confidence in television |
corruptn | how widespread corruption is in pub service in americ |
courts | courts dealing with criminals |
cowrkhlp | coworkers can be relied on when r needs help |
cowrkint | coworkers take a personal interest in r |
crack30 | r last use crack cocaine |
crimlose | people convicted of serious crimes lose citizen rights |
cutahead | r allowed a stranger to go ahead of you in line |
decsorgs | america should follow decision of intl org |
defpensn | r has defined benefit pension plan |
dem10fut | how well will democracy work in america in ten yrs |
dem10pst | how well did democracy work in america ten yrs ago |
demtoday | how well democracy work in america |
denom | specific denomination |
denom16 | denomination in which r was raised |
depress | told have depression |
diabetes | told have diabetes |
directns | r has given directions to a stranger |
discaff | whites hurt by aff. action |
discaffm | a man won't get a job or promotion |
discaffw | a woman won't get a job or promotion |
discpol | how often r discuss politics |
divlaw | divorce laws |
divorce | ever been divorced or separated |
dwelown | does r own or rent home? |
earnrs | how many in family earned money |
earthsun | sci knowledge:the earth goes around the sun |
effctsup | supervisor effective solve work/personal conflicts |
elecfair | how fair last natl election:opprtunities of candidate |
electron | sci knowledge:electrons are smaller than atoms |
elecvote | how honest last natl election:counting of votes |
emailhr | email hours per week |
emailmin | email minutes per week |
empinput | r involved in any task force for decision-making |
emptrain | received formal training from employer |
eqwlth | should govt reduce income differences |
esop | r is member of esop |
ethnic | country of family origin |
evcrack | r ever use crack cocaine |
evidu | r ever inject drugs |
evolved | sci knowledge:human beings developed from animals |
evpaidsx | ever have sex paid for or being paid since 18 |
evstray | have sex other than spouse while married |
evwork | ever work as long as one year |
excldimm | america should exclude illegal immigrants |
expdesgn | better way to test drug btw control and non-control |
exptext | why is it better to test drug this way |
extrapay | eligible for performance based pay |
extrayr | year of the most recent perf based payments |
fair | people fair or try to take advantage |
fairearn | how fair is what r earn on the job |
famgen | number of family generations in household |
family16 | living with parents when 16 yrs old |
famvswk | how often fam life interfere job |
famwkoff | how hard to take time off |
fear | afraid to walk at night in neighborhood |
fechld | mother working doesnt hurt children |
feelevel | amount of fees paid |
feeused | fee given to get case |
fefam | better for man to work, woman tend home |
fehire | should hire and promote women |
fejobaff | for or against preferential hiring of women |
fepol | women not suited for politics |
fepresch | preschool kids suffer if mother works |
finalter | change in financial situation |
finrela | opinion of family income |
forland | foreigners should not be allowed to buy land |
form | form of split questionnaire asked |
freetrde | free trade leads to better products |
fringeok | fringe benefits are good |
frndsex | r had sex with friend last year |
fucitzn | is r planning/appling for us citizenship or not |
fund | how fundamentalist is r currently |
fund16 | how fundamentalist was r at age 16 |
getahead | opinion of how people get ahead |
givblood | r donated blood during the past 12 months |
givchrty | r has given money to a charity |
givhmlss | r has given food or money to a homeless person |
givseat | r offered seat to a stranger during past 12 months |
god | rs confidence in the existence of god |
goodlife | standard of living of r will improve |
govdook | we can trust people in govt |
granborn | how many grandparents born outside u.s. |
grass | should marijuana be made legal |
grpother | r belongs to another voluntary association |
grpparty | r belongs to a political party |
grprelig | r belongs to a church or othr religious organization |
grpsprts | r belongs to a sports, leisure, or cultural grp |
grpwork | r belongs to a trade union or professtional associati |
gunlaw | favor or oppose gun permits |
gvtrghts | (on a scale of 1 to 7, where 1 is not at all important and 7 is very important |
handmove | r perform forceful hand movements |
hapcohab | happiness of relt with partner |
hapmar | happiness of marriage |
happy | general happiness |
haveinfo | enough info to get the job done |
health | condition of health |
health1 | rs health in general |
hefinfo | number of hef informant |
height | r is how tall |
helpaway | r looked after plant or pet of others while away |
helpblk | should govt aid blacks? |
helpful | people helpful or looking out for selves |
helphwrk | helped someone with hwork during past 12 months |
helpjob | helped somebody to find a job past 12 months |
helpnot | should govt do more or less? |
helpoth | to help others |
helppoor | should govt improve standard of living? |
helpsick | should govt help pay for medical care? |
helpusa | how important to help worse off ppl in america |
helpwrld | how important to help worse off ppl in rest of world |
hhtype | household type |
hhtype1 | household type (condensed) |
hispanic | hispanic specified |
hivkiss | kiss can spread hiv |
hivtest | have you ever been tested for hiv |
hivtest1 | in what month and year was your last hiv test |
hivtest2 | where did you have your last hiv test |
hivvac | there is a vaccine that can prevent hiv |
hlpequip | enough help and equip to ge the job done |
hlthall | healthcare provided for everyone |
hlthdays | days of activity limitation past 30 days |
homosex | homosexual sex relations |
hompop | number of persons in household |
hotcore | sci knowledge: the center of earth is very hot |
hrs1 | number of hours worked last week |
hrs2 | number of hours usually work a week |
hrsrelax | hours per day r have to relax |
hsbio | r ever took a high school biology course |
hschem | r ever took a high school chemistry course |
hsmath | the highest level of math r completed in high school |
hsphys | r ever took a high school physics course |
hunt | does r or spouse hunt |
hurtatwk | number of injuries on the job past 12 months |
hvylift | r do repeated lifting |
hyperten | told have hypertension or high blood pressure |
idu30 | r inject drugs in past 30 days |
if08who | who you would have voted for |
if12who | who would r have voted for in 2012 election |
ifwrong | agree people should support their country |
immameco | immigrants good for america |
immassim | what statement about immigrants matches view |
immcult | immigrants undermine american culture |
immeduc | legal immigrants should have same education as americans |
immideas | immigrants make america more open |
immjobs | immigrants take jobs away |
immrghts | legal immigrants should have same right as american |
imports | america should limit the import |
incom16 | rs family income when 16 yrs old |
income | total family income |
income06 | total family income |
indperf | size of perf based pay depend on individual |
intecon | interested in economic issues |
inteduc | interested in local school issues |
intenvir | interested in environmental issues |
interpol | joined an internet political forum |
intfarm | interested in farm issues |
intintl | interested in international issues |
intlblks | unintelligent - intelligent |
intlincs | largee intl company damage to local business |
intlwhts | unintelligent -intelligent |
intmed | interested in medical discoveries |
intmil | interested in military policy |
intrhome | internet access in r's home |
intsci | interested in new scientific discoveries |
intspace | interested in space exploration |
inttech | interested in technologies |
jobfind | could r find equally good job |
jobfind1 | how easy for r to find a same job |
jobhour | short working hours |
jobinc | high income |
joblose | is r likely to lose job |
jobmeans | work important and feel accomplishment |
jobpromo | chances for advancement |
jobsec | no danger of being fired |
jobsecok | the job security is good |
joindem | took part in a demonstration |
kidssol | rs kids living standard compared to r |
knowschd | how far in advance know work schedule |
knowwhat | r knows what's expected on job |
laidoff | r was laid off main job last year |
lasers | sci knowledge:lasers work by focusing sound waves |
learnnew | job requires r to learn new things |
leftrght | how left or right in politics |
lentto | lent money to another person past 12 months |
lessprd | agree often less proud of america |
letdie1 | allow incurable patients to die |
letin1 | number of immigrants to america nowadays should be |
letin1a | number of immigrants nowadays should be |
libath | allow anti-religious book in library |
libcom | allow communists book in library |
libhomo | allow homosexuals book in library |
libmil | allow militarists book in library |
libmslm | allow anti-american muslim clergymen's books in library |
librac | allow racists book in library |
life | is life exciting or dull |
liveblks | neighborhood half black |
livewhts | r favors living in half white neighborhood |
loanitem | r has let someone borrow a item of some value |
localnum | number of employees: rs work site |
maind10 | mothers industry code (naics 2007) |
major1 | college major 1 |
major2 | college major 2 |
majorcol | the field of degree r earned |
manvsemp | relations bw management and employees |
maocc10 | mothers census occupation code (2010) |
marasian | close relative marry asian |
marblk | close relative marry black |
marhisp | close relative marry hispanic |
marhomo | homosexuals should have right to marry |
marital | marital status |
martype | marital type |
marwht | r favor close relative marrying white person |
matesex | was 1 of rs partners spouse or regular |
mawrkgrw | mothers employment when r was 16 |
mawrkslf | mother self-emp. or worked for somebody |
meltpot1 | better to maintain distinct cultures |
meovrwrk | men hurt family when focus on work too much |
mincult | ethnic minorities should be given gov assistance |
misswork | miss work for health past 30 days |
mntlhlth | days of poor mental health past 30 days |
mobile16 | geographic mobility since age 16 |
mode | interview done in-person or over the phone |
moredays | days per month r work extra hours |
mustwork | mandatory to work extra hours |
nafta1 | how much heard or read about nafta? |
nafta2a | america benefits from being a member of nafta? |
nataid | foreign aid |
nataidy | assistance to other countries -- ver y |
natarms | military, armaments, and defense |
natarmsy | national defense -- version y |
natchld | assistance for childcare |
natcity | solving problems of big cities |
natcityy | assistance to big cities -- version y |
natcrime | halting rising crime rate |
natcrimy | law enforcement -- verison y |
natdrug | dealing with drug addiction |
natdrugy | drug rehabilitation -- version y |
nateduc | improving nations education system |
nateducy | education -- version y |
natenrgy | developing alternative energy sources |
natenvir | improving & protecting environment |
natenviy | the environment -- version y |
natfare | welfare |
natfarey | assistance to the poor -- version y |
natheal | improving & protecting nations health |
nathealy | health -- version y |
natmass | mass transportation |
natpark | parks and recreation |
natrace | improving the conditions of blacks |
natracey | assistance to blacks -- version y |
natroad | highways and bridges |
natsci | supporting scientific research |
natsoc | social security |
natspac | space exploration program |
natspacy | space exploration -- version y |
news | how often does r read newspaper |
newsfrom | main source of information about events in the news |
nextgen | science & tech. give more opportunities to next generation |
notvote | citizens have right not to vote |
ntcitvte | long-term residents should vote |
ntwkhard | past week not work hard enough |
numemps | number of employee for the self-employed |
nummen | number of male sex partners since 18 |
numorg | number of people working in organization at all locations |
numwomen | number of female sex partners since 18 |
obey | to obey |
obeylaws | how important always to abey laws |
opdevel | opportunity to develop my abilities |
oppsegov | how important:citizen engage in acts of civil disobed |
oth16 | other protestant denominations |
other | other protestant denominations |
othersex | r had sex with some other last year |
othjew | consider self to be jewish |
othlang | can r speak language other than english |
othlang1 | what other languages does r speak |
othlang2 | what other languages does r speak |
othreasn | how important to try to undrstnd reasonings of othr o |
othshelp | people should help less fortunate others |
oversamp | weights for black oversamples |
overwork | r has too much work to do well |
owngun | have gun in home |
ownstock | r has stock in rs company |
paidsex | r had sex for pay last year |
painarms | r had pain in the arms in the past 12 months |
paind10 | fathers industry code (2010) |
paocc10 | fathers census occupation code (2010) |
parborn | were rs parents born in this country |
parcit | were your parents citizens of america? |
parsol | rs living standard compared to parents |
partfull | was r's work part-time or full-time? |
partners | how many sex partners r had in last year |
partnrs5 | how many sex partners r had in last 5 years |
partteam | r work as part of a team |
partyid | political party affiliation |
patriot1 | patriotic feelings strengthen america's place in world |
patriot2 | patriotic feelings lead to intolerance in america |
patriot3 | patriotic feelings are needed for america to remain united |
patriot4 | patriotic feelings lead to negative feelings towards immigrants |
pawrkslf | father self-emp. or worked for somebody |
paytaxes | how important never to try to evade taxes |
peocntct | how many people in contact in a typical weekday |
peoptrbl | assisting people in trouble is very important |
phase | subsampling: two-phase design. |
phone | does r have telephone |
physhlth | days of poor physical health past 30 days |
pikupsex | r had sex with casual date last year |
pillok | birth control to teenagers 14-16 |
pistol | pistol or revolver in home |
polabuse | citizen said vulgar or obscene things |
polactve | pol party encourge ppl to be active in politics in am |
polattak | citizen attacking policeman with fists |
poleff11 | don't have any say about what the government does |
poleff18 | govt do not care much what ppl like r think |
poleff19 | r have a good understanding of pol issues |
poleff20 | most ppl are better informed about politics than r is |
polescap | citizen attempting to escape custody |
polfunds | donated money or raised funds for soc or pol activity |
polgreed | most politicians are only for what get out of politics |
polhitok | ever approve of police striking citizen |
polint1 | how interested in politics |
polinter | expressed political views on internet past year |
polmurdr | citizen questioned as murder suspect |
polnews | how often use media to get political news |
polopts | how important:ppl given chance to participate in deci |
polviews | think of self as liberal or conservative |
popespks | pope is infallible on matters of faith or morals |
popular | to be well liked or popular |
pornlaw | feelings about pornography laws |
posslq | does r have marital partner |
posslqy | relationship status and cohabitation or not |
postlife | belief in life after death |
powrorgs | intl orgs take away much power from american govt |
pray | how often does r pray |
prayer | bible prayer in public schools |
premarsx | sex before marriage |
pres08 | vote obama or mccain |
pres12 | vote obama or romney |
preteen | household members 6 thru 12 yrs old |
prodctiv | work conditions allow productivity |
promtefr | promotions are handled fairly |
promteok | rs chances for promotion good |
proudart | how proud its achievements in the arts & lit. |
prouddem | how proud the way democracy works |
proudeco | how proud america's economic achievements |
proudemp | r proud to work for employer |
proudgrp | how proud its fair and equal treatment |
proudhis | how proud its history |
proudmil | how proud america's armed forces |
proudpol | how proud its political influence in the world |
proudsci | how proud its scientific and tech achievements |
proudspt | how proud its achievements in sports |
proudsss | how proud its social security system |
racdif1 | differences due to discrimination |
racdif2 | differences due to inborn disability |
racdif3 | differences due to lack of education |
racdif4 | differences due to lack of will |
raclive | any opp. race in neighborhood |
racmeet | allowed to hold pub meeting for racist |
racopen | vote on open housing law |
racwork | racial makeup of workplace |
radioact | sci knowledge:all radioactivity is man-made |
rank | rs self ranking of social position |
ratetone | r's facial coloring by interviewer |
realinc | family income in constant $ |
realrinc | rs income in constant $ |
reborn | has r ever had a 'born again' experience |
refrndms | referendum are good way to decide important pol quest |
reg16 | region of residence, age 16 |
relactiv | how often does r take part in relig activities |
relatsex | relation to last sex partner |
relig | rs religious preference |
relig16 | religion in which raised |
reliten | strength of affiliation |
relmeet | allowed to hold pub meeting for religious extremist |
relpersn | r consider self a religious person |
res16 | type of place lived in when 16 yrs old |
respect | r treated with respect at work |
respnum | number in family of r |
retchnge | r returned money after getting too much change |
revmeet | allowed to hold pub meeting for ppl who want overthro |
rghtsmin | how important:govt protect right of minorities |
richwork | if rich, continue or stop working |
rifle | rifle in home |
rincblls | income alone is enough |
rincom06 | respondents income |
rincome | respondents income |
rowngun | does gun belong to r |
safefrst | no shortcuts on worker safety |
safehlth | safety and health condition good at work |
safetywk | worker safety priority at work |
satfin | satisfaction with financial situation |
satjob | job or housework |
satjob1 | job satisfaction in general |
savesoul | tried to convince others to accept jesus |
scibnfts | benefits of sci research outweight harmful results |
scifrom | main source of information about science and technology |
scinews1 | newspaper printed or online |
scinews2 | magazine printed or online |
scinews3 | where online get info |
scistudy | r has clear understanding of scientific study |
scitext | what it means to r to study scienfically |
secondwk | r has job other than main |
sector | type of college respondent attended |
seeksci | probable source of information about scientific issues |
selffrst | people need not overly worry about others |
selfless | r feels like a selfless caring for others |
servepeo | how committed govt admnstrators are to serve people |
sexeduc | sex education in public schools |
sexfreq | frequency of sex during last year |
sexornt | sexual orientation |
sexsex | sex of sex partners in last year |
sexsex5 | sex of sex partners last five years |
shortcom | world better if america acknowledged shortcomings |
shotgun | shotgun in home |
sibs | number of brothers and sisters |
signdpet | signed a petition |
size | size of place in 1000s |
slpprblm | trouble sleeping last 12 months |
socbar | spend evening at bar |
socfrend | spend evening with friends |
socommun | spend evening with neighbor |
socrel | spend evening with relatives |
solarrev | sci knowledge:how long the earth goes around the sun |
solok | how important:citizens have adequate standard of livi |
spanking | favor spanking to discipline child |
spden | specific denomination, spouse |
spdipged | spouse diploma, ged, or other |
spevwork | spouse ever work as long as a year |
spfund | how fundamentalist is spouse currently |
sphrs1 | number of hrs spouse worked last week |
sphrs2 | no. of hrs spouse usually works a week |
spind10 | spouses industry code (naics 2007) |
spkath | allow anti-religionist to speak |
spkcom | allow communist to speak |
spkhomo | allow homosexual to speak |
spklang | how well does r speak other language |
spkmil | allow militarist to speak |
spkmslm | allow muslim clergymen preaching hatred of the us |
spkrac | allow racist to speak |
spocc10 | spouse census occupation code (2010) |
spother | other protestant denominations |
sprel | spouses religious preference |
sprtprsn | r consider self a spiritual person |
spsector | type of college spouse attended |
spvtrfair | supervisor is fair |
spwrkslf | spouse self-emp. or works for somebody |
spwrksta | spouse labor force status |
stockops | r hold any stock options of rs company |
stockval | total dollar value of rs stock |
stress | how often does r find work stressful |
stress12 | stress management program last 12 months |
strredpg | access to stress management |
suicide1 | suicide if incurable disease |
suicide2 | suicide if bankrupt |
suicide3 | suicide if dishonored family |
suicide4 | suicide if tired of living |
supcares | supervisor concerned about welfare |
suprvsjb | does r supervise others at work |
suphelp | supervisor helpful to r in getting job done |
talkedto | talked with someone depressed past 12 months |
talkspvs | comfortable talking with supervisor about personal |
tax | rs federal income tax |
teamsafe | mgt and employees work together re safety |
teens | household members 13 thru 17 yrs old |
teensex | sex before marriage -- teens 14-16 |
thnkself | to think for ones self |
toofast | science makes our way of life change too fast |
toofewwk | how often not enough staff |
trdestck | company stock publicly traded |
trdunion | workers need strong unions |
trust | can people be trusted |
trustman | r trust management at work |
trynewjb | how likely r make effort for new job next year |
tvhours | hours per day watching tv |
unemp | ever unemployed in last ten yrs |
union | does r or spouse belong to union |
unrelat | number in household not related |
uscitzn | is r us citizen |
usedup | how often during past month r felt used up |
usemedia | contacted in the media to express view |
useskill | how much past skills can you make use in present |
usetech | percentage of time use tech |
usewww | r use www other than email |
uswar | expect u.s. in war within 10 years |
uswary | expect u.s. in world war in 10 years |
valgiven | total donations past year r and immediate family |
vetyears | years in armed forces |
viruses | sci knowledge:antiviotics kill viruses as well as bacteria |
visitors | number of visitors in household |
voedcol | non-college postsecondary education (voednme1) |
voednme1 | postsecondary institution attended for credit |
voedncol | non-college postsecondary education (voednme2) |
voednme2 | postsecondary institution attended for credit |
volchrty | r done volunteer work for a charity |
volmonth | volunteer in last month |
vote08 | did r vote in 2008 election |
vote12 | did r vote in 2012 election |
voteelec | how important always to vote in elections |
watchgov | how important to keep watch on action of govt |
waypaid | how paid in main job |
wealth | total wealth of respondent |
webmob | r uses home internet through mobile device |
weekswrk | weeks r. worked last year |
weight | r weighs how much |
whencol | when received college degree |
whenhs | when received hs degree |
whoelse1 | presence of others:children under six |
whoelse2 | presence of others:older children |
whoelse3 | presence of others:spouse partner |
whoelse4 | presence of others:other relatives |
whoelse5 | presence of others:other adults |
whoelse6 | presence of others:no one |
whywkhme | usual reason r work at home |
widowed | ever been widowed |
wkageism | r feels discriminated because of age |
wkcontct | how often contacted about work when not working |
wkdecide | how often r take part in decisions |
wkfreedm | a lot of freedom to decide how to do job |
wkharoth | r threatened on the job last 12 months |
wkharsex | r sexually harassed on the job last 12 months |
wkpraise | r is likely to be praised by supervisor |
wkracism | r feels discriminated because of race |
wksexism | r feels discriminated because of gender |
wksmooth | workplace runs in smooth manner |
wksub | does r or spouse have supervisor |
wksubs | does supervisor have supervisor |
wksup | does r or spouse supervise anyone |
wksups | does subordinate supervise anyone |
wkvsfam | how often job interferes fam life |
wlthblks | rich - poor |
wlthwhts | rich - poor |
workblks | hard working - lazy |
workdiff | r does numerous things on job |
workfast | job requires r to work fast |
workfor1 | r work for whom |
workhard | to work hard |
workwhts | hard working - lazy |
wrkgovt | govt or private employee |
wrkhome | how often r works at home |
wrksched | usual work schedule |
wrkslf | r self-emp or works for somebody |
wrkstat | labor force status |
wrktime | r has enough time to get the job done |
wrktype | work arrangement at main job |
wrkwayup | blacks overcome prejudice without favors |
wrldgovt | international bodies should enforce environment |
wwwhr | www hours per week |
wwwmin | www minutes per week |
xmarsex | sex with person other than spouse |
xmovie | seen x-rated movie in last year |
xnorcsiz | expanded n.o.r.c. size code |
yearsjob | time at current job |
yearval | total dollar value of payments in that year |
Data: https://sda.berkeley.edu/sdaweb/analysis/?dataset=gss14
Codebook: https://burrelvannjr.com/docs/GSS_Codebook.pdf
This data set, from Howell, measures students' knowledge at three time points, in long form.
howell_aids_long
howell_aids_long
A data frame with 12 observations and 3 variables.
student | student id |
time | time point measured |
knowledge | student AIDS knowledge score (at various time points) |
This data set, from Howell, measures students' knowledge at three time points, in wide form.
howell_aids_wide
howell_aids_wide
A data frame with 4 observations and 4 variables.
student | student id |
t1 | student AIDS knowledge score at time 1 |
t2 | student AIDS knowledge score at time 2 |
t3 | student AIDS knowledge score at time 3 |
This function plots a histogram (hst) on a given data frame, and uses simplified calls within the function to parse the histogram by up to 2 variables.
hst(df, var1, by1, by2)
hst(df, var1, by1, by2)
df |
data frame to read in. |
var1 |
the dependent/outcome variable, |
by1 |
the main independent/predictor variable, |
by2 |
a potential second independent/predictor variable, |
This function returns the histogram for var1
in data frame df
. Can be split to return a histogram for var1
in data frame df
, broken out by var2
.
data <- mtcars hst(data,mpg,cyl)
data <- mtcars hst(data,mpg,cyl)
This function returns the mode for a given data frame.
mode(x, na.rm = FALSE)
mode(x, na.rm = FALSE)
x |
variable within data frame or a list of values. |
na.rm |
remove the NAs, default is FALSE. |
This function returns the mode for a variable within a data frame or a list of values.
data <- mtcars mode(data$mpg)
data <- mtcars mode(data$mpg)
This function simplifies the call for one-way ANOVA (ow.anova) on a given data frame. Also allows calls for Tukey's Honestly Significant Difference Post-Hoc Comparisons Test (hsd), as well as a means plot (plot).
ow.anova(df, var1, by1, plot = FALSE, hsd = FALSE)
ow.anova(df, var1, by1, plot = FALSE, hsd = FALSE)
df |
data frame to read in. |
var1 |
the dependent/outcome variable, |
by1 |
the main independent/predictor variable, |
plot |
logical (default set to |
hsd |
logical (default set to |
This function returns the summary results table for a one-way ANOVA, examining mean differences in var1
from data frame df
, across by1
groups.
data <- mtcars ow.anova(data,mpg,cyl,plot=TRUE)
data <- mtcars ow.anova(data,mpg,cyl,plot=TRUE)
This function simplifies the call for Pearson's Product-Moment Correlation Coefficient (p.corr) on a given data frame.
p.corr(df, var1, var2)
p.corr(df, var1, var2)
df |
data frame to read in. |
var1 |
the dependent/outcome variable, |
var2 |
the main independent/predictor variable, |
This function returns the summary results table for a Pearson's correlation, examining the relationship between var1
from data frame df
, and var2
.
data <- mtcars p.corr(data,mpg,wt)
data <- mtcars p.corr(data,mpg,wt)
This function plots a Q-Q/Quantile-Quantile plot (qq) on a given data frame, and uses simplified calls within the function to parse the Q-Q plot by up to 2 variables.
qq(df, var1, by1, by2)
qq(df, var1, by1, by2)
df |
data frame to read in. |
var1 |
the dependent/outcome variable, |
by1 |
the main independent/predictor variable, |
by2 |
a potential second independent/predictor variable, |
This function returns the quantile-quantile plot for var1
in data frame df
. Can be split to return a quantile-quantile plot for var1
in data frame df
, broken out by var2
.
data <- mtcars qq(data,mpg,cyl)
data <- mtcars qq(data,mpg,cyl)
This function creates a residual plot (residplot) on a data frame of the variables in an equation.
residplot(df, formula)
residplot(df, formula)
df |
data frame to read in. |
formula |
the variables in the regression model, |
data <- mtcars residplot(data, mpg ~ wt + am)
data <- mtcars residplot(data, mpg ~ wt + am)
This function applies reverse-coding to a variable of interest.
revcode(df, var, missing = c(""))
revcode(df, var, missing = c(""))
df |
data frame to read in. |
var |
the variable to be recoded. |
missing |
a list of values in the variable that are “missing” values. |
This function updates the data frame with a new variable with the recoded values.
data <- GSS2014 revcode(data, amcult)
data <- GSS2014 revcode(data, amcult)
This function simplifies the call for repeated measures ANOVA (rm.anova) on a given data frame. Also allows calls for sphericity correction (correct), as well as a sphericity test table (sph).
rm.anova( df, id, times, scores = NULL, correct = TRUE, sph = FALSE, phc = FALSE )
rm.anova( df, id, times, scores = NULL, correct = TRUE, sph = FALSE, phc = FALSE )
df |
data frame to read in. |
id |
the main grouping variable by which |
times |
dependent variable values at the time points measured. If data are in wide form (where time points are listed as separate variables for each observation), read in as a list of time point variables (e.g. |
scores |
if data are in long form (where each group has multiple observations), a |
correct |
logical (default set to |
sph |
logical (default set to |
phc |
logical (default set to |
data <- howell_aids_wide rm.anova(data, student, c("t1","t2","t3")) data2 <- howell_aids_long rm.anova(data2, student, time, scores=knowledge)
data <- howell_aids_wide rm.anova(data, student, c("t1","t2","t3")) data2 <- howell_aids_long rm.anova(data2, student, time, scores=knowledge)
This function plots a scatterplot (scatter) on a given data frame, and adds a fit-line to the data.
scatter(df, var1, var2, lab = FALSE)
scatter(df, var1, var2, lab = FALSE)
df |
data frame to read in. |
var1 |
the dependent/outcome variable, |
var2 |
the independent/predictor variable, |
lab |
logical (default set to |
data <- mtcars scatter(data,mpg,wt)
data <- mtcars scatter(data,mpg,wt)
This function returns a data frame with interactive margins and standard errors similar to those returned in the STATA margins call. The function can also return a margins plot.
stata.plm.margins(mod, plot = FALSE, error = NULL)
stata.plm.margins(mod, plot = FALSE, error = NULL)
mod |
a plm model object. |
plot |
logical (default set to |
error |
the number standard deviation units for which the margins will be calculated (default set to 2). |
This function creates a data frame of predictive margins for the dependent variable, given values of the variables in the interaction.
library(plm) data <- UCR2015 summary(mod <- plm(dui_pct ~ pct_poverty*pct_unemp + income_inequality, data=data, index=c("state","county"), model="within")) stata.plm.margins(mod)
library(plm) data <- UCR2015 summary(mod <- plm(dui_pct ~ pct_poverty*pct_unemp + income_inequality, data=data, index=c("state","county"), model="within")) stata.plm.margins(mod)
This function returns a crosstab (tab) on a given data frame, and using simplified calls within the function for two variables, to return the observed and expected frequencies.
tab(df, var1, var2)
tab(df, var1, var2)
df |
data frame to read in. |
var1 |
a first grouping variable. |
var2 |
a second grouping variable. |
This function returns the observed and expected frequencies of a bivariate relationship between var1
and var2
in data frame df
.
data <- mtcars tab(data,mpg,cyl)
data <- mtcars tab(data,mpg,cyl)
This subset of data comes from one iteration of the Uniform Crime Reporting Program, administered in 2015. These data were collected by the Federal Bureau of Investigation under the United States Department of Justice. While the original data cover every reported crime event that took place in 2015, these data are aggregated to the county level. Additionally, these data are combined with (a subset of) county-level demographic data from the 2005-2009 (5-year estimates) iteration of the American Community Survey. Information about the data set can be found in the UCR2015 Codebook at: https://burrelvannjr.com/docs/UCR2015_Codebook.pdf.
UCR2015
UCR2015
A data frame with 3108 observations and 102 variables.
id | State and County Identifier |
statefips | FIPS Code for State |
countyfips | FIPS Code for County |
state | State Name |
county | County Name |
totalpop | Total County Population |
pct_unemp | Percent of Total County Population who are Unemployed |
pct_homeowners | Percent of Total County Population who are Homeowners |
pct_college | Percent of Total County Population who are over 25 years old and hold a Bachelor's Degree |
med_fam_inc | Median Family Income (in Thousands of Dollars) |
pop_density | Population Density (Population over Land Area in County) |
pct_poverty | Percent of Total County Population who are below the Poverty Line |
pct_white | Percent of Total County Population who are White |
pct_black | Percent of Total County Population who are Black |
pct_latino | Percent of Total County Population who are Latinx/e/a/o |
income_inequality | Gini Coefficient of Income Inequality -- The distribution of income across the county population. High scores indicate greater inequality, with high-income individuals receiving much larger percentages of the total income made in the county. |
rape | Forcible rape (Count) |
robbery | Robbery (Count) |
agg_assault | Aggravated assault (Count) |
burglary | Burglary-breaking or entering (Count) |
larceny | Larceny-theft (not motor vehicles) (Count) |
mv_theft | Motor vehicle theft (Count) |
other_assault | Other assaults (Count) |
arson | Arson (Count) |
forgery | Forgery and counterfeiting (Count) |
fraud | Fraud (Count) |
embezzlement | Embezzlement (Count) |
stolen_property | Stolen property-buy, receive, poss. (Count) |
vandalism | Vandalism (Count) |
weapons | Weapons-carry, posses, etc. (Count) |
sex_offense | Sex offenses (not rape or prostitution) (Count) |
drug_abuse | Total drug abuse violations (Count) |
drug_sale | Sale/manufacture (subtotal) (Count) |
drug_possession | Possession (subtotal) (Count) |
drug_sale_coke | Sale/mfg-Opium, coke, and their derivatives (Count) |
drug_sale_mj | Sale/mfg-Marijuana (Count) |
drug_possession_coke | Possession-Opium, coke, and their derivatives (Count) |
drug_possession_mj | Possession-Marijuana (Count) |
drug_possession_narc | Possession-Truly addicting synthetic narcotics (Count) |
drug_possession_other | Possession-Other dangerous non-narc drugs (Count) |
domestic_offenses | Offenses against family and children (Count) |
dui | Driving under the influence (Count) |
liquor_violation | Liquor laws (Count) |
disorderly_conduct | Disorderly conduct (Count) |
other_nontraffic_violation | All other non-traffic offenses (Count) |
murder | Murder and non-negligent manslaughter (Count) |
drug_sale_other | Sale/mfg-Other dangerous non-narc drugs (Count) |
prostitution | Prostitution and commercialized vice (Count) |
drug_sale_narc | Sale/mfg-Truly addicting synthetic narcotics (Count) |
vagrancy | Vagrancy (Count) |
drunkenness | Drunkenness (Count) |
curfew_loitering | Curfew and loitering violations (Count) |
runaway | Runaways (Count) |
manslaughter_negligence | Manslaughter by negligence (Count) |
gambling_all | Gambling (total) (Count) |
suspicion | Suspicion (Count) |
gambling_bookmaking | Bookmaking (horse and sports) (Count) |
gambling_other | All other gambling (Count) |
gambling_lottery | Number and lottery (Count) |
rape_pct | Forcible rape (as percent of total county population) |
robbery_pct | Robbery (as percent of total county population) |
agg_assault_pct | Aggravated assault (as percent of total county population) |
burglary_pct | Burglary-breaking or entering (as percent of total county population) |
larceny_pct | Larceny-theft (not motor vehicles) (as percent of total county population) |
mv_theft_pct | Motor vehicle theft (as percent of total county population) |
other_assault_pct | Other assaults (as percent of total county population) |
arson_pct | Arson (as percent of total county population) |
forgery_pct | Forgery and counterfeiting (as percent of total county population) |
fraud_pct | Fraud (as percent of total county population) |
embezzlement_pct | Embezzlement (as percent of total county population) |
stolen_property_pct | Stolen property-buy, receive, poss. (as percent of total county population) |
vandalism_pct | Vandalism (as percent of total county population) |
weapons_pct | Weapons-carry, posses, etc. (as percent of total county population) |
sex_offense_pct | Sex offenses (not rape or prostitution) (as percent of total county population) |
drug_abuse_pct | Total drug abuse violations (as percent of total county population) |
drug_sale_pct | Sale/manufacture (subtotal) (as percent of total county population) |
drug_possession_pct | Possession (subtotal) (as percent of total county population) |
drug_sale_coke_pct | Sale/mfg-Opium, coke, and their derivatives (as percent of total county population) |
drug_sale_mj_pct | Sale/mfg-Marijuana (as percent of total county population) |
drug_possession_coke_pct | Possession-Opium, coke, and their derivatives (as percent of total county population) |
drug_possession_mj_pct | Possession-Marijuana (as percent of total county population) |
drug_possession_narc_pct | Possession-Truly addicting synthetic narcotics (as percent of total county population) |
drug_possession_other_pct | Possession-Other dangerous non-narc drugs (as percent of total county population) |
domestic_offenses_pct | Offenses against family and children (as percent of total county population) |
dui_pct | Driving under the influence (as percent of total county population) |
liquor_violation_pct | Liquor laws (as percent of total county population) |
disorderly_conduct_pct | Disorderly conduct (as percent of total county population) |
other_nontraffic_violation_pct | All other non-traffic offenses (as percent of total county population) |
murder_pct | Murder and non-negligent manslaughter (as percent of total county population) |
drug_sale_other_pct | Sale/mfg-Other dangerous non-narc drugs (as percent of total county population) |
prostitution_pct | Prostitution and commercialized vice (as percent of total county population) |
drug_sale_narc_pct | Sale/mfg-Truly addicting synthetic narcotics (as percent of total county population) |
vagrancy_pct | Vagrancy (as percent of total county population) |
drunkenness_pct | Drunkenness (as percent of total county population) |
curfew_loitering_pct | Curfew and loitering violations (as percent of total county population) |
runaway_pct | Runaways (as percent of total county population) |
manslaughter_negligence_pct | Manslaughter by negligence (as percent of total county population) |
gambling_all_pct | Gambling (total) (as percent of total county population) |
suspicion_pct | Suspicion (as percent of total county population) |
gambling_bookmaking_pct | Bookmaking (horse and sports) (as percent of total county population) |
gambling_other_pct | All other gambling (as percent of total county population) |
gambling_lottery_pct | Number and lottery (as percent of total county population) |
Data: https://www.icpsr.umich.edu/web/NACJD/studies/36794 and https://data.census.gov/mdat/#/search?ds=ACSPUMS5Y2009
Codebook: https://burrelvannjr.com/docs/UCR2015_Codebook.pdf
This subset of data comes from one iteration of the Well-Being and Basic Needs Survey, administered in 2019. These data were collected by the Urban Institute. Information about the data set can be found in the WBBN2019 Codebook at: https://burrelvannjr.com/docs/WBBN2019_Codebook.pdf.
WBBN2019
WBBN2019
A data frame with 7694 observations and 23 variables.
subsidized_housing | Is your household paying lower rent because the federal, state, or local government is paying part of the cost? |
food_last | Food did not last |
nervous | During the past 30 days, about how often did you feel: nervous? |
hopeless | During the past 30 days, about how often did you feel: hopeless? |
restless | During the past 30 days, about how often did you feel: restless or fidgety? |
no_cheer | During the past 30 days, about how often did you feel: so sad that nothing could cheer you up |
worthless | During the past 30 days, about how often did you feel: worthless? |
insured | Thinking about your health insurance coverage over the past 12 months, how many months were you insured? |
med_notafford | Thinking about your health care experiences over the past 12 months, was there any time when you needed medical care but did not get it because you couldn't afford it? |
working | Are you currently working for pay or self-employed? |
unexp_400 | How confident are you that you could come up with $400 if an unexpected expense arose within the next month? |
educ | Education level |
race_eth | Race/ethnicity |
sex_gender | Sex/Gender |
head_household | Head of Household? |
internet | Internet access |
children_in_house | Number of children age 0-18 in household |
food_insecure | Household was food insecure in past 12 months |
utility_suspend | Gas or electric company turned off service or oil company would not deliver in oil past 12 months |
utility_problems_paying | Household was not able to pay full amount of gas, oil, or electricity bills in past 12 months |
mortgage_cost | How much is the regular monthly payment on this property, including mortgage payments, second mortgage or home equity loan payments, real estate taxes, insurance, and condominium fees? |
rent_cost | What is the monthly rent for the place where you live? |
electricity_cost | In a typical month, what is the total cost of electricity, gas, and any other fuel used in the place where you live? |
Data: https://www.icpsr.umich.edu/web/ICPSR/studies/38044
Codebook: https://burrelvannjr.com/docs/WBBN2019_Codebook.pdf
This function calculates the Z score for a given value, relative to the mean and standard deviation for a variable in a given data frame.
z.calc(df, var1, raw, tails = NULL)
z.calc(df, var1, raw, tails = NULL)
df |
data frame to read in. |
var1 |
the variable of interest for which the mean and standard deviations will be calculated. |
raw |
the desired raw score to compare with the mean and standard deviation of |
tails |
to report a p-value (level of significance) for the reported Z score, user must select a desired number of tails (either |
This function returns the raw score, mean, and z-score for a given raw score.
data <- mtcars z.calc(data,mpg,12)
data <- mtcars z.calc(data,mpg,12)