www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xreggpr/cicalc.m
function [ci_hi,ci_lo,y]= cicalc(m,Xs,alpha,Trans) %CICALC - calculate the confidence interval for a model on a set of data % % [ci_hi,ci_lo,yhat]= cicalc(m,Xs,Ys,Trans) % % X and Y must be in natural units. % Copyright 2015 The MathWorks, Inc. Xcode= code(m,Xs); if iscell(Xcode) % cell array input len= cellfun(@numel,Xcode); N= len(len~=1); if isempty(N) N = 1; elseif all(N==N(1)) N = N(1); else error(message('mbc:xregmodel:InvalidSize1')) end nf = length(Xcode); X= zeros(N,nf); if N>0 for i=1:nf X(:,i)=Xcode{i}(:); end end else X = Xcode; end [y,~,yint] = predict(m.StatsGPR,X,'Alpha',1-alpha); ci_hi = yint(:,2); ci_lo = yint(:,1); if ~Trans ci_hi = yinv(m,ci_hi); ci_lo = yinv(m,ci_lo); y = yinv(m,y); end