+ Reply to Thread
Results 1 to 2 of 2

Thread: Partial regression plots in R

  1. #1
    Points: 975, Level: 16
    Level completed: 75%, Points required for next Level: 25

    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Partial regression plots in R



    Hey guys,

    I'm slowly converting myself from an SPSS user to an R user. I'm running a pretty basic multiple regression model and want to produce partial regression plots to view the relationship between each predictor and the response, when the other predictors are controlled for. In SPSS this is very simple, however I'm struggling to find a way to do it in R.

    Any help would be fantastic.

    Kind Regards
    Pinkfreud

  2. #2
    RotParaTon
    Points: 46,194, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Discussion EnderPosting AwardFrequent PosterCommunity AwardMaster Tagger
    Dason's Avatar
    Location
    Ames, IA
    Posts
    9,072
    Thanks
    211
    Thanked 1,606 Times in 1,376 Posts

    Re: Partial regression plots in R


    Partial regression plots are also called added variable plots. The 'car' library has some nice functions to do these for you.
    Code: 
    > # Make some test data
    > x1 <- 1:30
    > x2 <- rnorm(30)
    > y <- x1 + x2 + rnorm(30)
    > library(car)
    > dat <- data.frame(y = y, x1 = x1, x2 = x2)
    >
    > # Fit the model
    > o <- lm(y ~ x1 + x2, data = dat)
    > # Get the added variable plots
    > avPlots(o)

  3. The Following User Says Thank You to Dason For This Useful Post:

    Amanda_UK (02-02-2013)

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats