I am trying to
1) classify a bunch of [0,1] ratios into two groups Group 0: Ratio = 0, Group 1: Ratio != 0.
2) predict the actual response with multiple predictors in R.
My question would then be:
Q1: Can I use the scaled predicted probability as the predicted response?
Q2: Should I classify the group before the regression before running the regression to solve the warning message? Would the data structure/predicted be affected?
I thought of achieving Goal 1 and Goal 2 separately but I can't seem to find a way to fit a unbalanced [0,1] non-censored data with good prediction.
Basically my response is something like this
y<-c(rep(0,100),0.3,0.4,0.8,1.0) x<-cbind(rnorm(104,20,2),as.factor(c(rep(0,90),rep(1,5),rep(0,8),rep(1,1))) ,as.factor(sample(c(1:3),104,TRUE,prob = c(0.6,0.3,0.1)))) data<-data.frame(cbind(y,x))
and y is strictly between 0 to 1.
I then fit it with a logistic regression and get the predicted probability:
fit<-glm(y~.,data=data, family = "binomial") fit.prob<-predict(fit,type="response")
I used the probability to make classification model (Goal 1)
class<-y;class[y==0]="0";class[y!=0]="1" cutoff<-0.06 fit.pred=rep(0,length(fit.prob)); fit.pred[fit.prob >=cutoff]=1 table(fit.pred,class)
However, I also want to predict y from new data set, this is probably wrong, but here's what I did
se<-fit.prob<-predict(fit,type="response",se=T)$se.fit scaled.fit<-fit.prob/max(fit.prob) scale.fit.UL<-scaled.fit+1.96*se scale.fit.LL<-scaled.fit-1.96*se
and I used this to be the prediction interval for y. Is there any other way to do it other than this?