Optimization and model fitting Flashcards Preview

R > Optimization and model fitting > Flashcards

Flashcards in Optimization and model fitting Deck (17)
Loading flashcards...
1

optim(par, fn, method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN")

general-purpose optimization; par is initial values, fn is function to optimize (normally minimize)

2

nlm(f,p)

minimize function f using a Newton-type algorithm with starting values p

3

lm(formula)

it linear models; formula is typically of the form response termA + termB + ...; use I(x*y) + I(xˆ2) for terms made of nonlinear components

4

glm(formula,family=)

it generalized linear models, specified by giv- ing a symbolic description of the linear predictor and a description of the error distribution; family is a description of the error distribution and link function to be used in the model; see ?family

5

nls(formula)

nonlinear least-squares estimates of the nonlinear model parameters

6

approx(x,y=)

linearly interpolate given data points; x can be an xy plot- ting structure

7

spline(x,y=)

cubic spline interpolation

8

loess(formula)

it a polynomial surface using local fitting
Many of the formula-based modeling functions have several common argu- ments: data= the data frame for the formula variables, subset= a subset of variables used in the fit, na.action= action for missing values: "na.fail", "na.omit", or a function. The following generics often apply to model fitting functions:

9

predict(fit,...)

predictions from fit based on input data

10

df.residual(fit)

returns the number of residual degrees of freedom

11

coef(fit)

returns the estimated coefficients (sometimes with their
standard-errors)

12

residuals(fit)

returns the residuals

13

deviance(fit)

returns the deviance

14

fitted(fit)

returns the fitted values

15

logLik(fit)

computes the logarithm of the likelihood and the number of
parameters

16

AIC(fit)

computes the Akaike information criterion or AIC

17