Error using ' (line 214) Undefined function 'ctranspose' for input arguments of type 'table'. Use the ROWS2VARS function instead.
Show older comments
when running my code i get a odd error: Error using ' (line 214) Undefined function 'ctranspose' for input arguments of type 'table'. Use the ROWS2VARS function instead. I don't use the ctranspose function and also don't have line 214 can someone help me. My code is below, hope someone can help me
clear;
clc;
format long
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
data = readtable('FFDATA.csv')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sets Priors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
multipleSR=1.27;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Defines models
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MktRF_star = data(:,2);
SMB_star = data(:,3);
HML_star = data(:,4);
RMW_star = data(:,5);
CMA_star = data(:,6);
MktRF = data(:,7);
SMB = data(:,8);
HML = data(:,9);
RMW = data(:,10);
CMA = data(:,11);
K=10;
F = [MktRF_star SMB_star HML_star RMW_star CMA_star MktRF SMB HML RMW CMA];
Flabel = ['Mkt_'; 'HML_'; 'SMB_';'RMW_';'CMA_';'Mkt ';'HML ';'SMN ';'RMW ';'CMA '];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Creates Models
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
T=size(F,1);
T0=K+1; %Minimum number of observations needed to estimate the regression is K + 1
% Creates the models and their respective factors
Numbermodels=2^(K-1);
IdentityMatrix=eye(K-1);
model.Fbar{1} = MktRF_star;
model.SelMatrixF{1} = 1;
model.label{1} = Flabel(1,:);
model.size{1}=1;
model.sizeFtilda{1}=K-model.size{1};
Fexmkt=F(:,2:end);
model.Ftilda{1} = Fexmkt;
model.Fbarexmkt{1} = [];
Flabelexmkt=Flabel(2:end,:);
for j=2:Numbermodels
model.SelMatrixF{j} = find(dec2binvec(j-1,K-1)==1);
model.Fbarexmkt{j} = (IdentityMatrix(model.SelMatrixF{j},:)*Fexmkt')';
model.Fbar{j} = [mktrf (IdentityMatrix(model.SelMatrixF{j},:)*Fexmkt')'];
model.SelMatrixFtilda{j} = find(dec2binvec(j-1,K-1)==0);
model.Ftilda{j} = [(IdentityMatrix(model.SelMatrixFtilda{j},:)*Fexmkt')'];
model.label{j} = [Flabel(1,:); Flabelexmkt(model.SelMatrixF{j},:)];
model.size{j}=length(model.SelMatrixF{j})+1;
model.sizeFtilda{j}=K-model.size{j};
end
function out = dec2binvec(dec,n)
%DEC2BINVEC Convert decimal number to a binary vector.
% DEC2BINVEC(D) returns the binary representation of D as a binary
% vector. The least significant bit is represented by the first
% column. D must be a non-negative integer.
% DEC2BINVEC(D,N) produces a binary representation with at least
% N bits.
%
% Example:
% dec2binvec(23) returns [1 1 1 0 1]
%
% See also BINVEC2DEC, DEC2BIN.
%
% MP 11-11-98
% Copyright 1998-2003 The MathWorks, Inc.
% $Revision: 1.5.2.4 $ $Date: 2003/08/29 04:40:56 $
% Error if dec is not defined.
if nargin < 1
error('daq:dec2binvec:argcheck', 'D must be defined. Type ''daqhelp dec2binvec'' for more information.');
end
% Error if D is not a double.
if ~isa(dec, 'double')
error('daq:dec2binvec:argcheck', 'D must be a double.');
end
% Error if a negative number is passed in.
if (dec < 0)
error('daq:dec2binvec:argcheck', 'D must be a positive integer.');
end
% Convert the decimal number to a binary string.
switch nargin
case 1
out = dec2bin(dec);
case 2
out = dec2bin(dec,n);
end
% Convert the binary string, '1011', to a binvec, [1 1 0 1].
out = logical(str2num([fliplr(out);blanks(length(out))]')');
end
Accepted Answer
More Answers (0)
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!