How to create a dependent variabel using a number of different independent variables?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
TED MOSBY
2025년 6월 11일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!