This is an RMarkdown notebook created with RStudio to test Homework 4 of BIOSTAT625.
install.packages('C:/Users/evely/Desktop/lmcpp.tar.gz',repos=NULL) install.packages("microbenchmark")
library(lmcpp) library("microbenchmark")
help(lmcpp) help(summary.lmcpp)
data(cars)
fit1 = lmcpp(dist ~ speed, data = cars, prt = TRUE) summ1 = summary.lmcpp(fit1, correlation = TRUE, prt = TRUE)
data(mtcars)
fit2 = lmcpp(mpg ~ cyl + hp, data = mtcars, prt = TRUE) summ2 = summary.lmcpp(fit2, correlation = TRUE, prt = TRUE)
fit.lm1 = lm(dist ~ speed, data = cars) fit.lm2 = lm(mpg ~ cyl + hp, data = mtcars) fit.summ1 = summary(fit.lm1, correlation = TRUE) fit.summ2 = summary(fit.lm2, correlation = TRUE) for ( i in c("coefficients","df.residual","fitted.values","residuals") ) { print( all.equal(fit1[[i]], fit.lm1[[i]]) ) print( all.equal(fit2[[i]], fit.lm2[[i]]) ) } for ( j in c("adj.r.squared", "coefficients", "correlation", "cov.unscaled", "fstatistic", "r.squared", "residuals", "sigma") ) { print( all.equal(summ1[[j]],fit.summ1[[j]])) print( all.equal(summ2[[j]],fit.summ2[[j]])) }
microbenchmark(lmcpp(dist ~ speed, data = cars),lm(dist ~ speed, data = cars)) microbenchmark(lmcpp(mpg ~ cyl + hp, data = mtcars),lm(mpg ~ cyl + hp, data = mtcars))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.