Ejemplo n.º 1
0
void MBC_MCMC_store_iteration(unsigned int pos, ERGMM_MCMC_Model *model, ERGMM_MCMC_Par *par,
			      ERGMM_MCMC_MCMCSettings *setting, ERGMM_MCMC_ROutput *outlists){
  // Log-likelihood a.k.a. lpZ.
  outlists->lpZ[pos] = par->lpZ; 
  outlists->lpLV[pos] = par->lpLV; 
  
  // Cluster-related.
  // Cluster assignments.
  Rpack_ivectors((int *)par->Z_K,model->verts,outlists->Z_K+pos,setting->sample_size+MBC_OUTLISTS_RESERVE);
  
  // Cluster means.
  Rpack_dmatrixs(par->Z_mean,model->clusters,model->latent,outlists->Z_mean+pos,setting->sample_size+MBC_OUTLISTS_RESERVE);
  
  // Intracluster variances.
  Rpack_dvectors(par->Z_var,model->clusters,outlists->Z_var+pos,setting->sample_size+MBC_OUTLISTS_RESERVE);
  
  // Cluster probabilities.
  Rpack_dvectors(par->Z_pK,model->clusters,outlists->Z_pK+pos,setting->sample_size+MBC_OUTLISTS_RESERVE);
  
}
Ejemplo n.º 2
0
void ERGMM_MCMC_store_iteration(unsigned int pos, ERGMM_MCMC_Model *model, ERGMM_MCMC_Par *par,
		     ERGMM_MCMC_MCMCSettings *setting, ERGMM_MCMC_ROutput *outlists){
  // Log-likelihood and other probabilities:
  outlists->llk[pos] = par->llk; 
  if(outlists->lpZ)
    outlists->lpZ[pos] = par->lpZ;
  if(outlists->lpcoef)
    outlists->lpcoef[pos] = par->lpcoef;
  if(outlists->lpRE)
    outlists->lpRE[pos] = par->lpRE;
  if(outlists->lpLV)
    outlists->lpLV[pos] = par->lpLV;
  if(outlists->lpREV)
    outlists->lpREV[pos] = par->lpREV;
  if(outlists->lpdispersion)
    outlists->lpdispersion[pos] = par->lpdispersion;

  // Covariate coefficients.
  Rpack_dvectors(par->coef,model->coef,outlists->coef+pos,setting->sample_size+ERGMM_OUTLISTS_RESERVE);


  if(model->latent){
    // Latent positions.
    Rpack_dmatrixs(par->Z,model->verts,model->latent,outlists->Z+pos,setting->sample_size+ERGMM_OUTLISTS_RESERVE);

      
    // Cluster-related.
    if(model->clusters>0){      
      // Cluster assignments.
      Rpack_ivectors((int *)par->Z_K,model->verts,outlists->Z_K+pos,setting->sample_size+ERGMM_OUTLISTS_RESERVE);
	  
      // Cluster means.
      Rpack_dmatrixs(par->Z_mean,model->clusters,model->latent,outlists->Z_mean+pos,setting->sample_size+ERGMM_OUTLISTS_RESERVE);
	  
      // Intracluster variances.
      Rpack_dvectors(par->Z_var,model->clusters,outlists->Z_var+pos,setting->sample_size+ERGMM_OUTLISTS_RESERVE);

      // Cluster probabilities.
      Rpack_dvectors(par->Z_pK,model->clusters,outlists->Z_pK+pos,setting->sample_size+ERGMM_OUTLISTS_RESERVE);

    }
    else
      outlists->Z_var[pos]=par->Z_var[0];
  }

  // Sender effects.
  if(par->sender){
    Rpack_dvectors(par->sender,model->verts,outlists->sender+pos,setting->sample_size+ERGMM_OUTLISTS_RESERVE);
    outlists->sender_var[pos] = par->sender_var;
  }

  // Receiver effects.
  if(par->receiver && !model->sociality){
    Rpack_dvectors(par->receiver,model->verts,outlists->receiver+pos,setting->sample_size+ERGMM_OUTLISTS_RESERVE);
    outlists->receiver_var[pos] = par->receiver_var;
  }      

  // Dispersion.
  if(model->dispersion){
    outlists->dispersion[pos] = par->dispersion;
  }      
      
}