ENCODE_PCSV_PARAM Encodes all parameters of a PCSV model into a single vector [theta, decode] = ENCODE_PCSV_PARAM(mu, A, lambda_0, kappa, theta, sigma, rho) encodes the parameters mu, A, lambda_0, kappa, theta, sigma, rho of a WASC model into a single parameter vector theta. The returned function decode can be used together with decode_pcsv_param to recover the parameters from theta. A PCSV model may contain NON-quadratic orthogonal matrices as parameter and hence the returned function decode has and individual state. That means that two returned decode function from two calls to encode_pcsv_param are different and cannot be interchanged. If and only if the numbers of eigenvectors is equal to the number of assets (n==p), the returned function decode has no individual state. See also DECODE_PCSV_PARAM, ENCODE_PARAMETERS, ENCODE_WASC_PARAM. created by Benedikt Rudolph DATE: 16-Aug-2012
0001 function [theta, decode] = encode_pcsv_param(mu, A, lambda_0, kappa ... 0002 , theta, sigma, rho) 0003 %ENCODE_PCSV_PARAM Encodes all parameters of a PCSV model into a single vector 0004 % 0005 % [theta, decode] = ENCODE_PCSV_PARAM(mu, A, lambda_0, kappa, theta, sigma, 0006 % rho) encodes the parameters mu, A, lambda_0, kappa, theta, sigma, rho of 0007 % a WASC model into a single parameter vector theta. The returned function 0008 % decode can be used together with decode_pcsv_param to recover the 0009 % parameters from theta. A PCSV model may contain NON-quadratic orthogonal 0010 % matrices as parameter and hence the returned function decode has and 0011 % individual state. That means that two returned decode function from two 0012 % calls to encode_pcsv_param are different and cannot be interchanged. 0013 % If and only if the numbers of eigenvectors is equal to the number of 0014 % assets (n==p), the returned function decode has no individual state. 0015 % 0016 % See also DECODE_PCSV_PARAM, ENCODE_PARAMETERS, ENCODE_WASC_PARAM. 0017 % 0018 % created by Benedikt Rudolph 0019 % DATE: 16-Aug-2012 0020 0021 [n, p] = size(A); 0022 0023 param(1).name = 'mu'; 0024 %param(end).constraint = 'None'; 0025 param(end).constraint = 'equal'; 0026 param(end).value = reshape(mu, n, 1); 0027 0028 param(end+1).name = 'A'; 0029 %param(end).constraint = 'orthogonal_non_quadratic'; 0030 %% use more flexible constraint trafo for quadratic orthogonal matrices 0031 %if n==p && det(A)>0 0032 %param(end).constraint = 'orthogonal_quadratic'; 0033 %end 0034 param(end).constraint = 'equal'; 0035 param(end).value = A; 0036 0037 param(end+1).name = 'lambda_0'; 0038 param(end).constraint = 'equal'; 0039 param(end).value = reshape(lambda_0, 1, p); 0040 0041 param(end+1).name = 'kappa'; 0042 param(end).constraint = 'none'; 0043 param(end).value = reshape(kappa, 1, p); 0044 0045 param(end+1).name = 'theta'; 0046 param(end).constraint = 'none'; 0047 param(end).value = reshape(theta, 1, p); 0048 0049 param(end+1).name = 'sigma'; 0050 param(end).constraint = 'none'; 0051 %param(end).constraint = 'equal'; 0052 param(end).value = reshape(sigma, 1, p); 0053 0054 param(end+1).name = 'rho'; 0055 param(end).constraint = 'none'; 0056 param(end).value = reshape(rho, 1, p); 0057 0058 [theta, decode] = encode_parameters(param); 0059 end