Question: I need help fixing this code, please see attachedIn [ 3 3 ] : default _ model _ data - data [ c ( '

I need help fixing this code, please see attachedIn [33]: default_model_data-data[c('age', 'talach', 'cp', 'trestbps')]
pred - predict(mode12, newdata=default_model_data, type='response')
# If the predicted probability of default is 0.50 then predict target default (default='1'), otherwise predict no target
# default (default='0')
depvar_pred = as.factor(ifelse(pred 0.5,'1',''))
# This creates the confusion matrix
conf.matrix - table(data$heart_data, depvar_pred)[c('',1''),c('',?'1')]
rownames(conf.matrix)- paste("Actual", rownames(conf.matrix), sep =": default=")
colnames(conf.matrix)- paste("Prediction", colnames(conf.matrix), sep =": default=")
# Print nicely formatted confusion matrix
print ("Confusion Matrix")
format (conf.matrix, justify="centre", digit=2)
Error in data[c("age", "talach", "cp", "trestbps")]: object of type 'closure' is not subsettable
Traceback:
 I need help fixing this code, please see attachedIn [33]: default_model_data-data[c('age',

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!