146 | | mlstudent* ARX::predictor_student ( ) const { |
| 146 | estudent<ldmat>* ARX::epredictor_student ( const vec &cond ) const { |
| 147 | bdm_assert_debug ( cond.length() == rgrlen , "ARX::epredictor cond is of size "+num2str(cond.length())+" expected dimension is "+num2str(rgrlen) ); |
| 148 | |
| 149 | mat mu ( dimy, posterior()._V().rows() - dimy ); |
| 150 | |
| 151 | vec ext_rgr; |
| 152 | if (have_constant) { |
| 153 | ext_rgr = concat(cond,vec_1(1.0)); |
| 154 | } else { |
| 155 | ext_rgr = cond; |
| 156 | } |
| 157 | |
| 158 | estudent<ldmat>* tmp = new estudent<ldmat> ( ); |
| 159 | //TODO: too hackish |
| 160 | if ( yrv._dsize() > 0 ) { |
| 161 | } |
| 162 | |
| 163 | ldmat Lam; |
| 164 | ldmat Vz; |
| 165 | |
| 166 | est.factorize( mu, Vz, Lam ); //mu = |
| 167 | //correction for student-t -- TODO check if correct!! |
| 168 | double zeta =0; |
| 169 | if (mu.cols()>0) {// nonempty egiw |
| 170 | mat p_mu = mu.T() * ext_rgr; //the result is one column |
| 171 | tmp->_mu()= p_mu.get_col ( 0 ); |
| 172 | zeta = Vz.invqform(ext_rgr); |
| 173 | } else { |
| 174 | tmp->_mu()=zeros(dimy); |
| 175 | } |
| 176 | // nu-rgrlen+2+dimy = delta+dimy |
| 177 | tmp->_delta()=est._nu()+2-rgrlen; |
| 178 | tmp->_H()=Lam; |
| 179 | tmp->_H()*=1/tmp->_delta(); |
| 180 | tmp->_H()*=(1+zeta); |
| 181 | |
| 182 | if (dimy==yrv._dsize()) |
| 183 | tmp->set_rv(yrv); |
| 184 | return tmp; |
| 185 | } |
| 186 | |
| 187 | mlstudent* ARX::predictor ( ) const { |