[R] bigglm connected to a database

Greg Snow 538280 at gmail.com
Tue Mar 3 22:47:44 CET 2015


It may be simpler to specify the order in the contrasts rather than trying
to order the data.  See the C function (notice capitol C).  I have never
tried this with the bigglm function, so I don't know if it will work the
same way or not.  But if it works, then that may be a simpler approach.

On Tue, Mar 3, 2015 at 1:02 PM, Glenn Schultz <glennmschultz at me.com> wrote:

> I can get bigglm working with the following code.
>
> ModelFit <- bigglm(SMM ~
>                     I(1-.88 * exp(-.192 * LoanAge))+
>                     ns(Incentive, df = 5)+
>                     Purpose +
>                     Occupancy +
>                     TPO +
>                     Servicer,
>                     data = sqlQuery(Train.Data, ModelData),
>                     family = binomial(link = "logit"),
>                     chuncksize = 10000,
>                     maxit = 100)
>
> However, I would like to order the factors so I wrote the following code
> to make data.  However, it is not working.  I have read through the manual
> as well as some examples provided and I am not having much success with the
> revised code below.  I think I need to make data and provide ordering of
> the factors in the make data but so far this scheme has not worked.  I
> think I am missing somethin any insights are appreciated.
>
> Best Regards,
> Glenn
>
> make.data <- function(connection, query, chunksize,...){
>
>     function(reset = FALSE) {
>       if (reset) {
>         if (got > 0) {
>             dbClearResult(result)
>             result <<- dbSendQuery(Train.Data, ModelData)
>             got <<- 0
>         }
>         return(TRUE)
>     }
>     rval <- fetch(result, n = chunksize)
>     got <<- got + nrow(rval)
>     if (nrow(rval) == 0)
>         return(NULL)
>     return(rval)
> }
> }
>
> data <- make.data(connection = Train.Data, query = ModelData, chunksize =
> 10000)
>
> ModelFit <- bigglm(SMM ~
>                     I(1-.88 * exp(-.192 * LoanAge))+
>                     ns(Incentive, df = 5)+
>                     Purpose +
>                     Occupancy +
>                     TPO +
>                     Servicer,
>                     data = data,
>                     family = binomial(link = "logit"),
>                     maxit = 100)
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com

	[[alternative HTML version deleted]]



More information about the R-help mailing list