RTools doesn’t set PATH correctly, so R can’t find compiler. • Solution: Run RTools installer as administrator. Right- click and choose run as admin. Be sure to check box at end of install. • Mac OS X: • Problem: R keeps trying to use llvm-g++-4.2 instead of clang++ • Solution: Enter each line into Terminal: cd /usr/bin sudo ln -fs clang llvm-gcc-4.2 sudo ln -fs clang++ llvm-g++-4.2
variable • Would be better to ditch linear model, too • Strategy: 1. Pick an outcome distribution 2. Model its parameters using links to linear models 3. Compute posterior • Can model multivariate relationships and non- linear responses • Building blocks of multilevel models
Mostly exponential family distributions • Members arise from natural processes; Occur frequently in nature • Have maximum entropy interpretations • Select from first principles • Resist histomancy: Superstitious practice of picking likelihood functions by gazing at a histogram 1 2 3 4 5
The maxent principle: • Distribution with largest entropy is distribution most consistent with stated assumptions • Can happen the largest number of ways • For observations, way to construct likelihood • Also reproduces Bayesian updating as special case (minimum cross-entropy) • Posterior least divergence to prior while still consistent with data E. T. Jaynes (1922–1998)
probability many trials dnorm dgamma dpois dbinom dexp Z ∼ /PSNBM(µ, σ) Z ∼ #JOPNJBM(O, Q) Z ∼ 1PJTTPO(λ) Z ∼ (BNNB(λ, L) Z ∼ &YQPOFOUJBM(λ) Figure 9.5
Can use canonical or natural link • But natural links not always best (esp. for exponential, gamma) • Imagination and pragmatism • Most common • Constrain to [0,1]: logit • Constrain to +reals: log
• Goal is to model probability as a function of predictors • If n = 1, called logistic regression Binomial distribution count “successes” number of trials probability of success Z ∼ #JOPNJBM(O, Q) 0 2 4 6 8 10 0 500 1500 2500 Count Frequency lambda=0.5
n possibilities • Goal is to model probability as a function of predictors • If n = 1, called logistic regression Z ∼ #JOPNJBM(O, Q) &(Z) = OQ WBS(Z) = OQ( − Q) Mean and variance not independent
Count Frequency lambda=0.5 Binomial distribution • Counts of a specific event out of n possibilities • Goal is to model probability as a function of predictors • If n = 1, called logistic regression Z ∼ #JOPNJBM(O, Q)
Two options: (1) prosocial, (2) asocial • Two outcomes: (1) left lever, (2) right lever • Want to predict outcome as function of condition and which side option is on • Do chimps prefer left lever when partner present and prosocial on left? => interaction! #*/0.*"- 8IFO IVNBO TUVEFOUT QBSUJDJQBUF JO BO FY UIF MFWFS MJOLFE UP UXP QJFDFT PG GPPE UIF QSPT