Write a regression model in R that gets data from a public API.
LogBreastCancer.r
BCData <- read.table(url("https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data"), sep = ",")
names(BCData)<- c('Id', 'ClumpThickness', 'CellSize','CellShape',
'MarginalAdhesion','SECellSize', 'BareNuclei',
'BlandChromatin','NormalNucleoli', 'Mitoses','Class')
str(BCData)
BCData<-BCData[!(BCData$BareNuclei=="?"),]
BCData$BareNuclei<-as.integer(BCData$BareNuclei)
str(BCData)
summary(BCData)
table(BCData$Class)
boxplot(BCData[,2:10])
par(mfrow=c(3, 3))
hist(BCData$ClumpThickness)
hist(BCData$CellSize)
hist(BCData$CellShape)
hist(BCData$MarginalAdhesion)
hist(BCData$SECellSize)
hist(BCData$BareNuclei)
hist(BCData$BlandChromatin)
hist(BCData$NormalNucleoli)
hist(BCData$Mitoses)
par(mfrow=c(1, 1))
BCData$Class<-replace(BCData$Class,BCData$Class==2,0)
BCData$Class<-replace(BCData$Class,BCData$Class==4,1)
table(BCData$Class)
LoGModel <- glm(Class ~.-Id,family=binomial(link='logit'),data=BCData)
summary(LoGModel)
anova(LoGModel, test="Chisq")
LGModelPred <- round(predict(LoGModel, type="response"))
table(LGModelPred)
table(BCData$Class,LGModelPred)
library(caret)
confusionMatrix(LGModelPred,BCData$Class,positive="1")
library(pROC)
RocObj<-roc(BCData$Class,LGModelPred)
par(mfrow=c(1, 1))
plot.roc(RocObj)
plot(RocObj, print.auc=TRUE, auc.polygon=TRUE, grid=c(0.1, 0.2),
grid.col=c("green", "red"), max.auc.polygon=TRUE,
auc.polygon.col="blue", print.thres=TRUE)
Write a regression model in SCI Kit of learn using python that gets data from a public API.
Write a javascript program that downloads data from an API and displays it on a graph. Use a government API. I recommend using jsfiddle or other online editor.
Quality of all is measured in API gravity degrees--the higher the degrees API, the higher the quality. The table shown below is produced by an expert in the field who believes that there is a relationshp between quity and price per barrel. SO A partial Minitab output follows: Descriptive Statistics Variable Men 34.60 Covariances Deges Regression Analysis Predicto Degrees 5 -0.1314 R-59-92,469 R-Squadil - 9179 Analysis of Variance Source Regression Residual Error Write the fitted regression equation
2.-Interpret the following regression model Call: lm(formula = Sale.Price ~ Lot.Size + Square.Feet + Num.Baths + API.2011 + dis_coast + I(dis_fwy * dis_down * dis_coast) + Pool, data = Training) Residuals: Min 1Q Median 3Q Max -920838 -84637 -19943 68311 745239 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -7.375e+05 7.138e+04 -10.332 < 2e-16 *** Lot.Size -5.217e-01 1.139e-01 -4.581 5.34e-06 *** Square.Feet 1.124e+02 1.086e+01 10.349 < 2e-16 *** Num.Baths 3.063e+04 9.635e+03 3.179 0.00153 ** API.2011 1.246e+03 8.650e+01 14.405 < 2e-16...
This is a question about writting R code for a linear regression
model.
8. . (13 marks) Given four points (1,0.8), (4,4.2), (5,4.7) and (7,7.8), write down your R code to Build the linear regression model. (a) (4 marks) Predict the results on the new data with a sequence of 51 numbers equally spaced (b) values starting from 0 to 8 (4 marks) Generate the plot in Figure 3, where the curved lines are the upper (upr) and lower (c)...
Linear regression analysis of the data revealed the following: Model Summary Model R R Square Adjusted R Square Std. Error of the Estimate 1 .695a .483 .478 13.02473 a. Predictors: (Constant), exercise, gender, subject's age, depressed state of mind ANOVAa Model Sum of Squares df Mean Square F Sig. 1 Regression 65230.870 4 16307.718 96.129 .000b Residual 69893.149 412 169.644 Total 135124.019 416 a. Dependent Variable: Life Purpose and Satisfaction b. Predictors: (Constant), exercise, gender, subject's age, depressed state of...
Removing an existing predictor variable from a regression model: A. Can never increase R-squared B. Can never decrease R-squared C. Has never any effect on R-squared D. Changes R-squared by either increasing or decreasing it
Decide (with short explanations) whether the following
statements are true or false.
r) The error term in logistic regression has a binomial distribution s) The standard linear regression model (under the assumption of normality) is not appropriate for modeling binomial response data t Backward and forward stepwise regression will generally provide different sets of selected variables when p, the number of predicting variables, is large. u) BIC penalizes for complexity of the model more than AIC
r) The error term...
(a) The following is taken from the output generated by an Excel analysis of expenditure data using multiple regression: Regression Statistics Multiple R 0.9280 0.8611 0.8365 Adjusted R2 Standard Error.1488 Observations21 ANOVA Source Regression Residual Total df MS Significance of F 1.66E-07 3 308.68 35.117 102.893 2.930 17 20 358.49 49.81 Coefficient Standard Error 6.2000 0.7260 0.7260 0.9500 t Stat 3.7097 0.2755 -2.0523 0.5158 23.00 0.20 Intercept X2 X3 0.49 (i) Find the limits of the 95 percent confidence interval...
1.) What is the difference between a simple regression model and a multiple regression model? a.) There isn’t one. The two terms are equivalent b.) A simple regression model has a single predictor whereas a multiple regression model has potentially many c.) A simple regression model can handle only limited amounts of data whereas a multiple regression model can handle large data sets d.) A simple regression is appropriate for a dichotomous outcome variable, whereas a multiple regression model should...