Skip to content

Commit

Permalink
initialize dispersion
Browse files Browse the repository at this point in the history
  • Loading branch information
merliseclyde committed Dec 1, 2023
1 parent 75c789c commit 988b965
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ double poisson_dispersion(double *resid, double *weights, int n, int rank) {
/* Gamma */

double gamma_loglik(double *Y, double*mu, double *wts, double devb, int n) {
int i;
int i=0;
double ll = 0.0;
double disp, ntemp = 0.0;
double disp= 0.0, ntemp = 0.0;



for (i = 0; i < n; i++) {
ntemp += wts[i];
}
Expand All @@ -144,7 +144,7 @@ double gamma_loglik(double *Y, double*mu, double *wts, double devb, int n) {

void gamma_variance(double *mu, double *var, int n) {

int i;
int i=0;

for (i = 0; i<n; i++) {
var[i] = pow (mu[i],2.0);
Expand All @@ -154,8 +154,8 @@ void gamma_variance(double *mu, double *var, int n) {

void gamma_dev_resids(double *ry, double *rmu, double *rwt, double *rans, int n)
{
int i;
double mui, yi, wti;
int i=0;
double mui=1.0, yi=0.0, wti=0.0;

for (i = 0; i < n; i++) {
mui = rmu[i];
Expand Down
2 changes: 1 addition & 1 deletion src/glm_fit.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ SEXP glm_bas(SEXP RX, SEXP RY, glmstptr *glmfamily, SEXP Roffset, SEXP Rweights,
*variance=REAL(Rvariance);

double one = 1.0, tol, devold, devnew;
double disp;
double disp= 1.0;

int i, j, l, rank=1, *pivot=INTEGER(Rpivot), conv=0;

Expand Down

0 comments on commit 988b965

Please sign in to comment.