Daniel Gil Sep 2018
SeqDB
Parameters:
des: Optimal design (matrix)
cand.set: All possible treatments (matrix)
n.alts: Number of alternatives for each set (numeric)
par.draws: Draws from the posterior (matrix)
prior.covar: Prior covariance matrix (Multinormal) (matrix)
weights: Weights from importance sampling algorithm (numeric)
Defined Variables
n.sets: number of sets
cte.des: save the constants used in each set
des.f: transform des to a dataframe with dplyr
alt.cte: subset of variables that contains ".cte" from the optimal design
Initializing variables
i.cov: Inverse of prior covariance matrix
d.start: Calculate the D-error for each alternative
db.start: Calculates the mean D-error
full.comb: Calculates all possible combinations without repetition
n.par: Number of parameters
Derr
Parameters:
par: parameter values (posterior draws)
des: Optimal design (matrix)
n.alts: Number of alternatives for each set (numeric)
Defined Variables
info.des: Calculates fisher information matrix
detinfo: Calculates the determinant of the fisher information matrix
Output
Returns the D-error (numeric)
InfoDes
Parameters:
par: parameter values (posterior draws). Since it is used in an apply function, the function is evaluated for each row of the posterior (vector)
des: Optimal design (matrix)
n.alts: Number of alternatives for each set (numeric)
Defined variables
group: Vector to indicate the choice set (ex: 1 1 2 2 3 3 4 4)
u: Result of the multiplication of the design matrix with the posterior values (X'Beta). Then a sum of each row(alternative) is done p: Estimated probability for each alternative *info.des: *Information matrix
Output
Returns the Information matrix (matrix)
DBerrS
Parameters:
full.comb: Calculates all possible combinations without repetition (Matrix)
cand.set: All possible treatments (matrix)
par.draws: Draws from the posterior (matrix)
des: Optimal design (matrix)
n.alts: Number of alternatives for each set (numeric)
cte.des: save the constants used in each set (matrix or vector) not sure yet
i.cov: Inverse of prior covariance matrix (Matrix)
n.par: Number of parameters (integer)
weights: Weights from importance sampling algorithm (numeric vector)
Defined Variables
set: # matrix with only the alternatives chosen from the list of all possible treatments/alternatives (Matrix)
d.errors: Calculate the d.error for each draw of the posterior
Parameters:
par.draws: Draws from the posterior (matrix)
set: # matrix with only the alternatives chosen from the list of all possible treatments/alternatives (Matrix)
des: Optimal design (matrix)
n.alts: Number of alternatives for each set (numeric)
i.cov: Inverse of prior covariance matrix (Matrix)
n.par: Number of parameters (integer)
Defined Variables
des.f: Append of optimal design with new alternatives
info.d: Information matrix for each row
d.error Calculate sequential d-error
Functions defined
Originals
SeqDB:
Derr:
DerrS:
DBerrS:
InfoDes:
Modified
InfoDes_cpp: Is the implementation of InfoDes in Rcpp
Derr2: Is the same function as the original, the only difference is that call InfoDes_cpp instead of InfoDes
*DerrS2:*Is the same function as the original, the only difference is that call InfoDes_cpp instead of InfoDes
*DBerrS2:*Is the same function as the original, the only difference is that call InfoDes_cpp instead of InfoDes
SeqDB2: Is the same function as the original, the only difference is that call InfoDes_cpp instead of InfoDes