Hi, there Since glm cannot handle factors very well. I try to use bigglm like this: logit_model <- bigglm(responser~var1+var2+var3, data, chunksize=1000, family=binomial(), weights=~trial, sandwich=FALSE) fitted <- predict(logit_model, data) only var2 is factor, var1 and var3 are numeric. I expect fitted should be a vector of value falls in (0,1) However, I get something like this: str(fitted) num [1:260617, 1] -0.0564 -0.0564 -0.1817 -0.1842 -0.1852 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:260617] "1" "2" "3" "4" ... ..$ : NULL Anyone can help on this case? Thank you in advance. Best, --Yue
On Fri, Jun 1, 2012 at 1:17 AM, Yue Guan <pipehappy at gmail.com> wrote:> Hi, there > > Since glm cannot handle factors very well. I try to use bigglm like this: > > logit_model <- bigglm(responser~var1+var2+var3, data, chunksize=1000, > family=binomial(), weights=~trial, sandwich=FALSE) > > fitted <- predict(logit_model, data) > > only var2 is factor, var1 and var3 are numeric. > > I expect fitted should be a vector of value falls in (0,1) > > However, I get something like this: > str(fitted) > ?num [1:260617, 1] -0.0564 -0.0564 -0.1817 -0.1842 -0.1852 ... > ?- attr(*, "dimnames")=List of 2 > ?..$ : chr [1:260617] "1" "2" "3" "4" ... > ?..$ : NULL >As the help says, the default is predictions of the linear predictor. To get predictions of the probability, use type="response" -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland
Thank you very much. I do overlook something..... On Thu, May 31, 2012 at 5:20 PM, Thomas Lumley <tlumley at uw.edu> wrote:> On Fri, Jun 1, 2012 at 1:17 AM, Yue Guan <pipehappy at gmail.com> wrote: >> Hi, there >> >> Since glm cannot handle factors very well. I try to use bigglm like this: >> >> logit_model <- bigglm(responser~var1+var2+var3, data, chunksize=1000, >> family=binomial(), weights=~trial, sandwich=FALSE) >> >> fitted <- predict(logit_model, data) >> >> only var2 is factor, var1 and var3 are numeric. >> >> I expect fitted should be a vector of value falls in (0,1) >> >> However, I get something like this: >> str(fitted) >> ?num [1:260617, 1] -0.0564 -0.0564 -0.1817 -0.1842 -0.1852 ... >> ?- attr(*, "dimnames")=List of 2 >> ?..$ : chr [1:260617] "1" "2" "3" "4" ... >> ?..$ : NULL >> > > As the help says, the default is predictions of the linear predictor. > To get predictions of the probability, use type="response" > > ? -thomas > > -- > Thomas Lumley > Professor of Biostatistics > University of Auckland