ds.glm {dsModellingClient} | R Documentation |

A function fit generalized linear models

ds.glm(formula = NULL, data = NULL, family = NULL, offset = NULL, weights = NULL, checks = FALSE, maxit = 15, CI = 0.95, viewIter = FALSE, datasources = NULL)

`formula` |
a character, a formula which describes the model to be fitted |

`data` |
a character, the name of an optional data frame containing the variables in
in the |

`family` |
a description of the error distribution function to use in the model |

`offset` |
a character, null or a numeric vector that can be used to specify an a priori known component to be included in the linear predictor during fitting. |

`weights` |
a character, the name of an optional vector of 'prior weights' to be used in the fitting process. Should be NULL or a numeric vector. |

`checks` |
a boolean, if TRUE (default) checks that takes 1-3min are carried out to verify that the variables in the model are defined (exist) on the server site and that they have the correct characteristics required to fit a GLM. The default value is FALSE because checks lengthen the runtime and are mainly meant to be # used as help to look for causes of eventual errors. |

`maxit` |
the number of iterations of IWLS used instructions to each computer requesting non-disclosing summary statistics. The summaries are then combined to estimate the parameters of the model; these parameters are the same as those obtained if the data were 'physically' pooled. |

`CI` |
a numeric, the confidence interval. |

`viewIter` |
a boolean, tells whether the results of the intermediate iterations should be printed on screen or not. Default is FALSE (i.e. only final results are shown). |

`datasources` |
a list of opal object(s) obtained after login to opal servers;
these objects also hold the data assigned to R, as a |

`startBetas` |
starting values for the parameters in the linear predictor |

It enables a parallelized analysis of individual-level data sitting on distinct servers by sending

coefficients a named vector of coefficients

residuals the 'working' residuals, that is the residuals in the final iteration of the IWLS fit.

fitted.values the fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.

rank the numeric rank of the fitted linear model.

family the `family`

object used.

linear.predictors the linear fit on link scale.

Burton,P;Gaye,A;Laflamme,P

ds.lexis for survival analysis using piecewise exponential regression

ds.gee for generalized estimating equation models

{ # load the file that contains the login details data(glmLoginData) # login and assign all the variables to R opals <- datashield.login(logins=glmLoginData, assign=TRUE) # Example 1: run a GLM without interaction (e.g. diabetes prediction using BMI and HDL levels and GENDER) mod <- ds.glm(formula='D$DIS_DIAB~D$GENDER+D$PM_BMI_CONTINUOUS+D$LAB_HDL', family='binomial') mod # Example 2: run the above GLM model without an intercept # (produces separate baseline estimates for Male and Female) mod <- ds.glm(formula='D$DIS_DIAB~0+D$GENDER+D$PM_BMI_CONTINUOUS+D$LAB_HDL', family='binomial') mod # Example 3: run the above GLM with interaction between GENDER and PM_BMI_CONTINUOUS mod <- ds.glm(formula='D$DIS_DIAB~D$GENDER*D$PM_BMI_CONTINUOUS+D$LAB_HDL', family='binomial') mod # Example 4: Fit a standard Gaussian linear model with an interaction mod <- ds.glm(formula='D$PM_BMI_CONTINUOUS~D$DIS_DIAB*D$GENDER+D$LAB_HDL', family='gaussian') mod # Example 5: now run a GLM where the error follows a poisson distribution # P.S: A poisson model requires a numeric vector as outcome so in this example we first convert # the categorical BMI, which is of type 'factor', into a numeric vector ds.asNumeric('D$PM_BMI_CATEGORICAL','BMI.123') mod <- ds.glm(formula='BMI.123~D$PM_BMI_CONTINUOUS+D$LAB_HDL+D$GENDER', family='poisson') mod # clear the Datashield R sessions and logout datashield.logout(opals) }

[Package *dsModellingClient* version 4.1.0 ]