Effacer les filtres
Effacer les filtres

Linear Regression with Only Dependent Variables

3 vues (au cours des 30 derniers jours)
Rachael Bell
Rachael Bell le 3 Juil 2023
Hi,
So I have 2 matrices that are both nx7. Each column is associated with a tone that is played in both matrices. I want to compare the first columns from both matrices in a scatter plot and do (I think) a linear regression to see how they are correlated. Based on my understanding of the fitlm function, I need a matrix of observations and a column vector of predictors, and I don't have that, I have 2 column vectors instead. My question is how do I properly run the linear regression, if that is what I am supposed to be running. Thank you!

Réponse acceptée

Jeff Miller
Jeff Miller le 3 Juil 2023
It sounds like you can get what you want from simply
[rho, pval] = corr(matrixA(:,1),matrixB(:,1))
fitlm is for situations with a variable of primary interest that is to be predicted and other variable(s) that are used as predictors. Your variables sound more symmetric/equivalent than that.

Plus de réponses (1)

Torsten
Torsten le 3 Juil 2023
Modifié(e) : Torsten le 3 Juil 2023
The model with parameters a, b and c to be determined should be
column_matrix_1 * a/sqrt(a^2+b^2) + column_matrix_2 * b/sqrt(a^2+b^2) + c == 0
You can use "lsqnonlin" to fit the coefficients.

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by