- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How to create a plot of quadratic regression with fitted values against X in base R?

The quadratic regression model can be plotted by using the plot function but we would need to find the fitted values using the model and this can be done with the help of fitted function. For example, if we have a quadratic model M and the data has an independent variable x then the model against x can be created by using plot(x,fitted(M)).

## Example

x1<-rpois(10,5) y1<-rpois(10,2) Model_1<-lm(y1~x1+I(x1^2)) plot(x1,fitted(Model_1))

## Output

## Example

x2<-rnorm(10) y2<-rnorm(10,20,2.27) Model_2<-lm(y2~x2+I(x2^2)) plot(x2,fitted(Model_2))

## Output

- Related Questions & Answers
- How to create a plot with dashed regression line in base R?
- How to create a plot in base R with dates sequence on X-axis?
- How to create a plot with tick marks between X-axis labels in base R?
- How to display x-bar in base R plot?
- How to display X-axis labels with dash in base R plot?
- How to create a plot in base R with tick marks of larger size?
- How to create a plot in base R without margins?
- How to create a perpendicular arrow in base R plot?
- How to create a cumulative sum plot in base R?
- How to create vertical line for X variable at median in base R plot
- How to change the position of X-axis in base R plot?
- How to create a plot with reversed Y-axis labels in base R?
- How to create empty bar plot in base R?
- How to create a colored box for base R plot?
- How to create quantile regression plot with larger width of lines using ggplot2 in R?

Advertisements