R

Saturday, October 27, 2007

Linear Models

### Model Fitting
> lm.out <- lm(y~x, data= )
> summary(lm.out)
> names(lm.out)
> coef(lm.out)
> resid(lm.out)
> predict(lm.out)
> model.matrix(lm.out)

> y ~ x + fac + fac:x
> y ~ x | fac1 + fac2
> y ~ x + I(x^2) # polynomial term
> anova(lm(y~x), lm(y~x+I(x^2))) # anova table testing x^2

### Add a trend line
> plot(dist~speed, data=cars)
> abline(lm(dist~speed,data=cars))
Posted by cahn at 5:34 PM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2010 (2)
    • ►  December (1)
    • ►  May (1)
  • ►  2009 (10)
    • ►  October (2)
    • ►  August (1)
    • ►  July (1)
    • ►  April (3)
    • ►  March (3)
  • ►  2008 (2)
    • ►  December (2)
  • ▼  2007 (25)
    • ▼  October (25)
      • Mixed Models - longitudinal data
      • Mixed Models - random coefficient models
      • Mixed Models - RCBD
      • Structural Equation Model
      • Collapse table and calculate p-value by Monte Caro...
      • Mortgage
      • apply, sapply, tapply
      • Generalized Linear Mixed Models
      • Survival Data Analysis
      • Nonparametric Regression
      • sample()
      • Read and Manupulate Data
      • Vector
      • Linear Models
      • Matrix, Array and List
      • Categorical Data Analysis
      • Logistic Regression
      • Nonlinear Models
      • Comparing endpoints
      • Graphics
      • Making Functions
      • Iteration
      • Descriptive Statistics
      • Statistical & Mathematical functions
      • Introduction

About Me

My photo
cahn
View my complete profile