+ Reply to Thread
Results 1 to 2 of 2

Thread: plot lines through regression model

  1. #1
    Points: 1,666, Level: 23
    Level completed: 66%, Points required for next Level: 34

    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    plot lines through regression model



    Hi guys,

    This is probably a very simple question but I can't figure it out myself...

    I have made a regression model and I found a way to plot this model but I can't figure out how to draw lines through these points that are based on the model I made.

    the Regression model looks like this:
    model<-glm(y~NDVI*Variety, binomial) (Variety is a factor with 3 levels).

    I plotted the points with this code:
    pAnimal<-split(Animal, Variety)
    pNDVI<-split(NDVI, Variety)
    plot(NDVI, Animal, type="n", ylab="proportion animal")
    points(pNDVI[[1]], pAnimal[[1]], pch=16)
    points(pNDVI[[2]], pAnimal[[2]], pch=16)
    points(pNDVI[[3]], pAnimal[[3]], pch=16)

    So I want lines that are based on the regression model drawn through the points I plotted.

    Can anyone help me out?

    Cheers,
    Brenda

  2. #2
    Points: 1,617, Level: 23
    Level completed: 17%, Points required for next Level: 83

    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    extract the fit


    fit<- fitted (model)

    and then plot them with points() or lines()

    I am not sure what are you plotting though as y is not plotted at all from what I see.
    I think you should be plotting y vs your regressors.

+ Reply to Thread

Similar Threads

  1. Replies: 0
    Last Post: 12-18-2010, 01:26 AM
  2. Ordinal Regression: Test of Parallel Lines
    By Lotte in forum Regression Analysis
    Replies: 3
    Last Post: 08-27-2010, 09:47 PM
  3. Replies: 13
    Last Post: 06-04-2010, 09:50 AM
  4. Replies: 0
    Last Post: 10-07-2009, 08:09 PM
  5. Plotting 3 Lines on the same Plot
    By techintern4000 in forum SAS
    Replies: 0
    Last Post: 07-08-2009, 01:39 PM

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