Saturday, May 06, 2017

Multiple Regression in R

This discussion board post deals with multiple regression in R.  The locally weighted scatterplot smoothing method is discussed and applied to the cars dataset.  The results of the regression are evaluated.
As locally weighted scatterplot smoothing (LOWESS) is a nonparametric method as it does not utilize random selection and is subject to cluster bias (Schumacker, 2014).  LOWESS is not computationally intensive making it suitable for large datasets (Anonymous, 2017).  The resulting line may not be as precise as one returned by a more extensive method.
The dataset used in this assignment contains the speed and stopping distance for cars ("R: Speed and Stopping Distances of Cars," 2017).  It contains 50 observations on speed and distance, measured in miles per hour and feet respectively.  Figure 1 contains the scatter plot of speed to distance.  The values are fairly dispersed, and include a few outliers.  The graph also shows that as speed increases so does the related stopping distance.
Figure 2 contains a graph of the line after applying LOWESS.  The graph shows a somewhat exponential relationship between speed and distance.  This implies that higher speeds take longer to stop, beyond that of linear function.  For example, increasing speed by five miles an hour when doing ten miles an hour does not increase distance the same amount as going from twenty to twenty-five miles an hour.  Table 1 contains the R statements were utilized during this assignment.

Table 1
library(readr)
cars <- advanced="" analysis="" ata="" cars.csv="" csv="" datasets="" lan="" nedrive="" o:p="" ocuments="" olorado="" quantitative="" read_csv="" sers="" tech="" vincentarelbundock-rdatasets-7133d7c="">


View(cars)
summary(cars)
require(stats);
require(graphics)
plot(cars$speed,cars$dist,xlab="Speed",ylab="Distance")
plot(lowess(cars$speed,cars$dist),xlab="Speed",ylab="Distance")



Figure 1 Plot of Cars Data

Figure 2 LOWESS of Cars Data





References
Anonymous. (2017). Lowess Smoothing in Statistics: What is it?   Retrieved from http://www.statisticshowto.com/lowess-smoothing/

R: Speed and Stopping Distances of Cars. (2017).   Retrieved from https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/cars.html

Schumacker, R. E. (2014). Learning Statistics Using R: SAGE Publications, Inc.



No comments: