My reproducible data is as follows:
x <- c(7232L, 6274L, 8163L, 7421L, 6362L, 7206L, 7600L, 7421L, 9381L,
8173L, 7473L, 6318L, 5360L, 4732L, 7249L, 6435L, 5556L, 6256L,
6543L, 6113L, 8288L, 7438L, 6272L)
y <- c(1.649, -0.27, 0.149, 0.504, -0.634, 1.067, -1.243, 0.539, -2.399,
0.281, 0.217, 0.371, -0.937, -2.238, -0.71, 0.295, -0.289, -0.271,
0.944, 0.724, -0.149, 0.204, 1.932)
Plotting this:
plot(y,x)
gives a simple scatter plot:
How do I add a curve of best fit to the above scatter plot? I came across abit of stuff on using the loess
function, but that didn't seem to work.
I'm new to R and I've been searching for this for a couple hours nows. Any help would be GREATLY appreciated.
Thanks