|
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 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
On Fri, Jun 1, 2012 at 1:17 AM, Yue Guan <[hidden email]> 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 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
Thank you very much. I do overlook something.....
On Thu, May 31, 2012 at 5:20 PM, Thomas Lumley <[hidden email]> wrote: > On Fri, Jun 1, 2012 at 1:17 AM, Yue Guan <[hidden email]> 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 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
| Powered by Nabble | Edit this page |
