[R] need help for predictive analytics part

Swapnil Khobragade Swapnil.Khobragade at lntinfotech.com
Mon Oct 20 11:00:14 CEST 2014


Hello sir,

 Actually, I 'm novice to R programming and currently working on prediction part for CPU usage log file (attached with mail).
My task is to predict next hour CPU usage by taking "Time" as response and  %user    %nice   %system   %iowait    %steal     %idle, either all or one as predictor(s).
Please help me out.

I have attached CPU usage log file with mail.
Please find attachment.


Thank You in advance.

################################################  This code is not working #################################

cpu <- read.table(file = "D:/Swapnil/Data/cpu.txt", header = FALSE, col.names = c("Time","CPU","user","Nice","System","Iowait","Steal","Idle") ) #cpu

user <- rep(cpu$user)
Time <- c(cpu$Time)
Time

Time <- c(cpu$Time)
user <- rep(cpu$user)
user

plot(cpu$user, xaxt="n", ylab="USER", xlab="") axis(1, labels=paste(cpu$user), at=1:11)

cor(user, Time)

fit <- lm(Time ~ user)
fit

attributes(fit)

fit$coefficients

residuals(fit)
summary(fit)

plot(fit)


        #prdiction part

Time2hr <- data.frame(user=2.00)
user2hr <-predict(fit, newdata=Time2hr)

user2hr <-predict(fit, newdata=Time2hr)
style <- c(rep(1,11))
plot(c(Time, user2hr), xaxt="n", ylab="TIME", xlab="", pch=style, col=style) axis(1, at=1:11,labels=c(paste(cpu$user,sep="Q"), "2011Q1", "2011Q2", "2011Q3",

#########################################################################


Regards,
Swapnil Khobragade
Larsen & Toubro Infotech Ltd.
Bldg. No.5&6, 1st Floor,
Airoli, Navi Mumbai - 400708.
e-mail ID: swapnil.khobragade at lntinfotech.com
Tel: @@@@@@@(Direct) | +91 9503043368 (M)

The contents of this e-mail and any attachment(s) may contain confidential or privileged information for the intended recipient(s). Unintended recipients are prohibited from taking action on the basis of information in this e-mail and  using or disseminating the information,  and must notify the sender and delete it from their system. L&T Infotech will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in this e-mail"


More information about the R-help mailing list