How to create a dependent variabel using a number of different independent variables?
5 views (last 30 days)
Show older comments
I have a data that consists of number of different independent variables (no dependent variable), whose values are observed at different time points.
I need to find a new dependent variable that is dependent on these independent variables, so that I can use that to compare different data sets containing similar data.
How can I do that? And is there some mathematical/statistical score that can be used as a dependent variable.
Thanks
0 Comments
Answers (1)
TED MOSBY
on 11 Jun 2025
Hi,
You can think of creating a dependent variable from your set of independent‐only time series as an unsupervised dimensionality-reduction problem. The workaround for that is Principal Component Analysis (PCA). The first principal component is a linear combination of your original variables that explains the maximum possible variance, and its score time series makes a natural “new dependent variable” you can compare across data‐sets:
% Suppose your data is in a TxN matrix X, where:
% T = number of time points
% N = number of “independent” variables measured at each time
% Standardize each column to zero‐mean, unit‐variance
Xz = zscore(X);
% Run PCA:
% coeff = N×N matrix whose columns are principal directions (loadings)
% score = T×N matrix whose columns are the principal‐component time‐series
% latent = N×1 vector of variances explained by each component
% explained = N×1 percent of total variance explained
[coeff, score, latent, ~, explained] = pca(Xz);
% (3) Your “new dependent variable” = the first PC’s scores
newY = score(:,1);
Refer to these links for more information on "pca" and "zscore" :
0 Comments
See Also
Categories
Find more on Linear Regression 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!