Learn R Programming

asbio (version 1.9-2)

anm.ls.reg: Animated plot of the least squares function.

Description

Depicts the process of least squares estimation of simple linear regression parameters by plotting the least squares function with respect to estimate possibilities for the intercept or slope.

Usage

anm.ls.reg(X, Y, parameter="slope", nmax=50, interval = 0.1, col = "red",...)

anm.ls.reg.tck()

Value

An animated plot of the plot possible regression lines is created along with an animated plot of the residual sum of squares. The function anm.ls.reg.tck provides a GUI to run the function.

Arguments

X

A numeric vector containing explanatory data.

Y

A numeric vector containing response data.

parameter

Parameter to be estimated. Either "slope" or "intercept".

nmax

The number of parameter estimates to be depicted. The true LS estimate will always be in the center of this sequence.

interval

Speed of animation (in frames per second). A smaller interval decreases speed. May not work in all systems; see Sys.sleep.

col

Line color.

...

Additional arguments to plot

Author

Ken Aho

See Also

loglik.plot, anm.ls

Examples

Run this code
if (FALSE) {
X<-c(11.2,10.8,9.0,12.4,12.1,10.3,10.4,10.6,9.3,11.8)
Y<-log(X)
anm.ls.reg(X, Y, parameter = "slope")}

Run the code above in your browser using DataLab