+ 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
    Devorador de queso
    Points: 95,889, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,937
    Thanks
    307
    Thanked 2,630 Times in 2,246 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 2 Users Say Thank You to Dason For This Useful Post:

    Amanda_UK (02-02-2013), JesperHP (07-31-2015)

+ 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