Quantcast
Channel: How to create a graph showing the predictive model, data and residuals in R - Stack Overflow
Browsing index pages (3 articles)
↧

Image may be NSFW.
Clik here to view.

How to create a graph showing the predictive model, data and residuals in R

Given two variables, x and y, I run a dynlm regression on the variables and would like to plot the fitted model against one of the variables and the residual on the bottom showing how the actual data...

View Article


Image may be NSFW.
Clik here to view.

Answer by drammock for How to create a graph showing the predictive model,...

what you're looking for is resid(model). Try this: library(dynlm) x <- 10+rnorm(100) y <- 10+rnorm(100) model <- dynlm(x ~ y) plot(x, type="l", col="red", ylim=c(min(c(x,y,resid(model))),...

View Article


Image may be NSFW.
Clik here to view.

Answer by Ricardo Oliveros-Ramos for How to create a graph showing the...

This should do the trick: library(dynlm) set.seed(771104) x <- 5 + seq(1, 10, len=100) + rnorm(100) y <- x + rnorm(100) model <- dynlm(x ~ y) par(oma=c(1,1,1,2)) plotModel(x, model) # works...

View Article
Browsing index pages (3 articles)


Latest Images