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

,as.factor(sample(c(1:3),104,TRUE,prob = c(0.6,0.3,0.1))))


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")  

I used the probability to make classification model (Goal 1)


fit.pred=rep(0,length(fit.prob)); fit.pred[fit.prob >=cutoff]=1

However, I also want to predict y from new data set, this is probably wrong, but here's what I did


and I used this to be the prediction interval for y. Is there any other way to do it other than this?

  • $\begingroup$ What exactly are the y-values? They certainly aren't Bernoulli (yes/no) data. You call them "ratios"; what are they ratios of? In the example, they seem to occur only at fixed values, is that true of the real / full data? $\endgroup$ – gung Dec 2 '15 at 21:08
  • $\begingroup$ they are x/(x+y) kind of ratio, so it is continuous on [0,1]. But most of the values for x is 0, resulting a lot of zeros in the ratios. My main goal is to classify those x = 0 group and to predict that x/(x+y) number given a testing data. $\endgroup$ – Matthew Lau Dec 2 '15 at 21:11
  • $\begingroup$ What are the original x & y? Will they only ever occur at a few fixed values? $\endgroup$ – gung Dec 2 '15 at 21:16
  • 1
    $\begingroup$ Thanks, you should have included all of this at the outset. The question is largely uninterpretable w/o that info. "Pay" is a person's monthly net pay, and "balance" is the outstanding balance on the person's loan, is that right? So, when the ratio is 1, that is b/c they actually have no outstanding loan balance at all, & when it's 0, that is b/c they are (say) unemployed, correct? $\endgroup$ – gung Dec 2 '15 at 21:56
  • 1
    $\begingroup$ You wouldn't be using linear regression; you'd use something like Gamma or a count regression model. Also, the idea of having pay & loan on both sides of the equation makes no sense. What is the dataset? Do you have a set of historical records w/ people, various covariates, & how much was ultimately recouped? How are you taking time into account, is it the amount recouped w/i a given interval? (I assume you can get more & more money from someone as time goes by.) Is there any censoring in the data? $\endgroup$ – gung Dec 2 '15 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.