How to translate this function into matlab?
Show older comments
Hello everyone, I am trying to translate this R function to compute the pseudo-R-squared in MATLAB. I did
rho <- function(u,tau=.5)u*(tau - (u < 0))
V <- sum(rho(f$resid, f$tau))
I did the following, but I get the error: "Array indices must be positive integers or logical values."
function rho = TickFunction(u,tau)
%Tick function to evaluate a quantile regression model performance
%u is the residuals of the fitted model
%tau is the quantile of interest
rho = u(tau - (u<0));
end
Anyone could help?
Thanks!
Answers (0)
Categories
Find more on Axis Labels 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!