- Cheatsheets, The R Guide, R Reference Card
- Help functions: help()/?, apropos(), find(): apropos() finds all objects. find() the locations of found objects, methods(), example(), demo(), vignette(), args()
- Housekeeping functions: getwd(), setwd(), rm(list=ls()) removes all objects in the R environment, source("myRscript.r") runs the R codes in "myRscript.r" file, fix() modifies the original object, and edit() is used edit an object and returns to a new object, download.file() downloads a file from the Internet, attach()/detach() objects, search() shows the current search paths and sequence, install.packages(), update.packages(), remove.packages(), getOption("defaultPackages") which can be changed by setting the option in startup code (e.g. in ~/.Rprofile), .libPaths()
- Numeric/character functions: length(), seq(), rep(), cut(), pretty(), cat(), substr(), grep(), sub(), strsplit(), paste(), toupper(), tolower()
- Data functions: read.table(), head(), tail(), str(), class(), length(), dim(), nrow(), ncol(), names(), levels(), length(), c(), cbind(), rbind(), append(), rep(), rev(), sort(), unique()
- Type functions: "is." for checking or "as." for conversion + numeric(), character(), vector(), matrix(), data.frame(), factor(), logical(), integer(). For example: is.numeric(), as.numeric()
- Mathematical functions: abs(), sqrt(), log(), log(x, base=n), log10(), exp(), prod(), factorial(), choose(), ceiling(), floor(), solve(), trunc(), round(), signif(), cos(), sin(), tan(), acos()
- Statistical functions: mean(), median(), sd(), var(), mad(), quantile(), range(), sum(), diff(), min(), max(), scale(), fivenum(), cumsum(), cumprod(), cummax(), cumin(), cor(), colSums(), rowSums(), colMeans(), rowMeans()
- Probability functions: the form is [d][p][q][r]distribution(). d, p, q, r are for (d)ensity, cumulated (p)robability/distribution function, (q)uantile function, and (r)andom generation, respectively. the Distribution types can be: (norm)al, (beta), (binom)ial, (chisq)uared, (exp)onential, (logis)tic, (multinom)ial, (n)egative (binom)ial, (pois)son, (f), (gamma), (t), (unif)orm, etc. for example: dnorm(), pnorm(), qnorm(), rnorm()
- Statistical modeling functions
- Model functions: lm(), glm(), nls(), nls2(), lme() / nlme()
- Symbol formulas (y ~ A + B + C ): ":" is for interaction term, "*" is for complete interaction, "^" is for crossing to a specified degree "." is a placeholder for all other variables except the dependent variable, "-" removes a variable from the equation, "-1" suppresses the intercept, "I()" has elements within the parentheses interpreted arithmetically
- Post-estimation functions: coef(), confint(), resid(), fitted(), summary(), predict(), deviance(), print(),plot(), formula(), anova(obj1, obj2), AIC(), vcov()
- Contrast functions: contr.helmert(), contr.poly(), contr.sum(), contr.treatment(), contr.SAS()
- RStudio is an integrated development environment (IDE) for R. RStudio combines an intuitive user interface with powerful coding tools to help you get the most out of R. Shortcuts (you can modify them: Tools -> Modify Keyboard Shortcuts...)
- Alt + Shift + K: Show a Quick Reference
- Alt + -: Insert assignment operator "<- font="">->
- Ctrl + Shift + M: Insert pipe operator "%>%" (I changed it as Ctrl + Shift + P)
- Ctrl + Alt + I: Insert chunk (R Notebook/Markdown)
- Ctrl + 1: Move cursor to source Editor window
- Ctrl + 2: Move cursor to Command window
- Ctrl + 3: Move cursor to Help window
- Ctrl + 4: Move cursor to History window
- Ctrl + 5: Move cursor to File window
- Ctrl + 6: Move cursor to Plots window
- ...
Disclaimer: This blog site is intended solely for sharing of information. Comments are warmly welcome, but I make no warranties regarding the quality, content, completeness, suitability, adequacy, sequence, or accuracy of the information.
Friday, March 24, 2017
R functions and keyboard shortcuts
R functions/commands and keyboard shortcuts
Monday, March 13, 2017
choice of analytical language
Choice of analytical language
I have used mainly three statistical languages, Stata, R, and SAS, for many years for different purposes. The weights of usage of those three languages are shift from SAS-Stata-R to SAS-R-Stata, then, to Stata-R-SAS. Sometimes I am asked to recommend a better analytic language, which is always a hard and complicated question to me. I came across an blog written by Curtis Miller, which is very thoughtful and helpful to make this kind of choice. Here is his blog: "On Programming Languages; Why My Dad Went From Programming to Driving a Bus". Hopefully his story can help you to make your own decision.
I have used mainly three statistical languages, Stata, R, and SAS, for many years for different purposes. The weights of usage of those three languages are shift from SAS-Stata-R to SAS-R-Stata, then, to Stata-R-SAS. Sometimes I am asked to recommend a better analytic language, which is always a hard and complicated question to me. I came across an blog written by Curtis Miller, which is very thoughtful and helpful to make this kind of choice. Here is his blog: "On Programming Languages; Why My Dad Went From Programming to Driving a Bus". Hopefully his story can help you to make your own decision.
Wednesday, March 08, 2017
Stata News: in the spotlight
Stata News: in the spotlight etc.
- 2021
- Stata's growing interoperability: The case of PyStata & Jupyter Notebook
- Naqvi: Stata and GitHub Integration
- Customizable tables in Stata 17
- Creating dynamic HTML documents with Stata output
- 2020
- Enhancements to survival analysis suite
- Using Python within Stata
- Community corner: Graph Workflow
- Using margins to interpret choice model results
- Bayesian inference using multiple Markov chains
- 2019
- Customized forest plots for displaying meta-analysis results
- Importing data from SPSS and SAS
- Fun with frames
- Lasso
- Interpreting models for log-transformed outcomes (unbiased prediction: E(Y|X) = eXBeσ2/2 )
- User's corner: ftools and gtools
- 2018
- Scheming your way to your favorite graph style
- User's corner: Machine learning
- Nonparametric regression—Estimation, inference, and effects
- User's corner: A little help with Mata from the SSCC
- Dynamic stochastic general equilibrium models for policy analysis
- User's corner: ietoolkit for everyday tasks
- Interval-censored survival data—model fitting and beyond
- User's corner: Network analysis made easy
- 2017
- In the spotlight: Nonlinear multilevel mixed-effects models
- Cheatsheet: User's Corner: Quick references for your favorite commands
- What's new in Stata 15 (released on 2017-06-06, 15.1 released on 2017-12-20)
- Visualizing continuous-by-continuous interactions with margins and twoway contour
- 2016
- Storing long strings and entire files in Stata datasets
- Estimating, graphing, and interpreting interactions using margins
- eteffects and the challenges of making causal inferences
- Bayesian IRT–4PL model
- 2015
- Easy-to-interpret, flexible survival-time treatment effects, and Postestimation Selector
- Treatment effects, and irt
- Bayesian “random-effects” models, and What's New in Stata 14
- Finding and using results, constants, functions ... anything (Data > Other utilities > Hand calculator), and forecast for dynamic panel data and counterfactuals
- 2014
- 2013
- New univariate time-series features added in 13.1, and Adding your own methods to analyze power and sample size
- mlexp, and meglm, What's New in Stata 13
- 2012
- marginsplot and Fractals
- mgarch, and Receiver operating characteristic curves
- import excel and export excel
- 2011
- state-space models: Easier than they look
- SEM for economists (and others who think they don’t care), What's New in Stata 12
- The data editor
- 2010
- Competing-risks regression
- Margins of predicted outcomes
- Factor variables, and What's New in Stata 11.1
- Multiple imputation
- 2009: What's New in Stata 11.0
- 2008: Stata 10.1 Update
- 2007: What's New in Stata 10
- 2005: What's New in Stata 9
- 2002: What's New in Stata 8
- 2000: What's New in Stata 7
- 1985-1999: History of Stata
Friday, March 03, 2017
Syndemics: health in context
Syndemics: health in context
A syndemic, coined by Merrill Singer in mid-1990s, is a conceptual framework for understanding diseases or health conditions that arise in populations and that are exacerbated by the social, economic, environmental, and political milieu in which a population is immersed. The today's issue of Lancet published a series related the syndemic... full text ...
A syndemic, coined by Merrill Singer in mid-1990s, is a conceptual framework for understanding diseases or health conditions that arise in populations and that are exacerbated by the social, economic, environmental, and political milieu in which a population is immersed. The today's issue of Lancet published a series related the syndemic... full text ...
Subscribe to:
Posts (Atom)