Effacer les filtres
Effacer les filtres

Error using splitapply(Regress)

2 vues (au cours des 30 derniers jours)
Nabil Benhadda
Nabil Benhadda le 24 Fév 2020
Modifié(e) : Adam Danz le 24 Fév 2020
Hello, I have a given set of values that I was able to divide as groups from a table named 'Change1', however I get the following error message when trying to use the splitapply function:
Error using splitapply (line 61)
Group numbers must be a vector of positive integers, and cannot be a sparse vector.
Error in Untitled (line 8)
Regress = splitapply(func,X,Q);
I named the collumn containing the number that decides of the grouping as 'Numero', the column containing the ones to use for calculating the regressions intercepts as 'Ones'
The code is as follows:
Change1.Groups = findgroups(Change1.Numero);
X = [Change1.Groups Change1.Ones Change1.ReturnsMarket];
Q = Change1.ReturnsCleaned;
func = @(Q)regress(Q,X);
Regress = splitapply(func,X,Q);
  1 commentaire
Sindar
Sindar le 24 Fév 2020
Why are you not using:
Regress = splitapply(func,X,Change1.Groups);

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by