Plotting Modeled Data as my Regression Curve in R/RStudio

104 views Asked by At

I have two numerical data sets; one experimental, and one modeled. I have plotted the data set as a scatter plot in R. The experimental data are:

x=c(1.11,2.84,3.97,6.40,7.60,7.43,5.75,3.60,3.59) y=c(0.973,0.818,0.74,0.44,0.2688,0.282,0.50,0.613,0.656)

This is a pretty straight forward scatter plot. I also have some modeled data I acquired using an equation. This data needs to be superimposed on this plot. The modeled data is as follows:

x = c(1,2,3,4,5,6,7,8,9,10,11,12)
y = c(.994,.954,.860,.721,.570,.434,.362,.244,.185,.142,.110,.087)

How do I take these data, make a regression curve with them, and use them to generate some simple statistics comparing the modeled data to the experimental data?

Thanks!

1

There are 1 answers

3
Mateusz1981 On BEST ANSWER

First plot line

x = c(1,2,3,4,5,6,7,8,9,10,11,12)
y = c(.994,.954,.860,.721,.570,.434,.362,.244,.185,.142,.110,.087)
plot(x, y, type = "l")

Then points

x=c(1.11,2.84,3.97,6.40,7.60,7.43,5.75,3.60,3.59) 
y=c(0.973,0.818,0.74,0.44,0.2688,0.282,0.50,0.613,0.656)
points(x, y, col = "red")