Академический Документы
Профессиональный Документы
Культура Документы
Scatter plots and their fit functions The curve() function has a simple structure:
plot() is the general data plotting function. If we
have data in an object d and variables d$y and d$x, curve( function , from=minx , to=maxx ,
we can make a scatterplot of them with: add=TRUE )
library(bbmle)
60
start=list(a=0,b=0,s=2) )
20
0
k <- coef(m)
curve( k[1] + k[2]*x , from=min(cars$speed) ,
cars$dist
to=max(cars$speed) , add=TRUE )
60
40
20
0
80 100
5 10 15 20 25
cars$speed
cars$dist
60
40
(more than one x), you’ll need to fix the value of all
5 10 15 20 25 but one, when you plot. A good choice is the mean
cars$speed value for each of the variables you aren’t plotting on
the x-axis.