[SOLVED] 程序代写 ##########################################

30 $

File Name: 程序代写_##########################################.zip
File Size: 518.1 KB

SKU: 7275267061 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


##########################################
## Homework 2
##########################################

Copyright By PowCoder代写加微信 assignmentchef

##########################################
## Question 1. Identify Course Combinations
##########################################
rm(list=ls())

# Load and clean data.
course.df <- read.csv(“./Data/Coursetopics.csv”)course.mat <- as.matrix(course.df)head(course.mat, 10)library(arules)# Recast incidence matrix into transcations list. course.trans <- as(course.mat, “??”)# Generate rules with the highest lift.options(digits = 2, scipen = 1)rules <- ??inspect(head(sort(rules, by = “??”), 5))############################################ Question 2##########################################rm(list=ls())#load the databank.df <- read.csv(“./Data/UniversalBankFull.csv”)#consider only the required variablesbank.df <- bank.df[ , c(13, 14, 10)]bank.df$Online <- as.factor(bank.df$Online)bank.df$CreditCard <- as.factor(bank.df$CreditCard)bank.df$Personal.Loan <- as.factor(bank.df$Personal.Loan)str(bank.df)#partition the data into history (60%) and future (40%) sets#set the seed for the random number generator for reproducing the partition.set.seed(12345)ntotal <- length(bank.df$Personal.Loan)#Sample row numbers randomly.nhistory.index <- sort(sample(ntotal, round(ntotal * 0.6)))history.df <- bank.df[nhistory.index, ]future.df <- bank.df[-nhistory.index, ]#check if variables in the dataset are correctly identified for their typesstr(bank.df)str(history.df)# Find P(Personal.Loan = 1|CreditCard=1, Online=1)library(??)loan.nb <- naiveBayes(??, data = history.df)## predict probabilitiesloan.pred.prob <- predict(loan.nb, newdata = future.df, type = “raw”)loan.combined.df <- data.frame(actual = future.df$Personal.Loan, loan.pred.prob)str(loan.combined.df)head(loan.combined.df[??, ])# Find P(CreditCard=0|Personal.Loan=1)############################################ Question 3##########################################rm(list=ls())set.seed(100)r40000 <- ??norm(40000)??(r40000, breaks= 200, probability=T, xlab=”value”, ylab=”density”)############################################ Question 4##########################################rm(list=ls())benefit.df <- read.csv(‘./Data/benefits.csv’) # read datahead(benefit.df)str(benefit.df)??(benefit.df, conf.level = 0.95)PME <- 0.02conf.level <- ??alpha <- ??z = qnorm(1 – alpha/2)n = z^2*p*(1-p)/PME^2程序代写 CS代考加微信: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 程序代写 ##########################################
30 $