How can I weight my observations for a MANOVA analysis

1 view (last 30 days)
I have a dataset containing thousands of observations, each observation has 7 parameters. These parameters were calculated from hourly blood pressure measurements from patients of different demographics i.e. they belong to different populations. I would like to perform a MANOVA analysis using MATLAB's manova1 function. My final aim is to compare observations from many populations with each other, and use hypothesis testing to see the similarities and differences in the parameters across different populations.
However, some of the parameters were derived from 8 measurements whilst others were derived from 24 so I feel I must weight the observations accordingly. In summary, I would like to perform a MANOVA analysis with weighted observations. Is there a way to do this using manova1()? I can't see any thing in the documentation. Alternative functions or methodology suggestions are welcome as well. Thanks.

Answers (1)

Aditya
Aditya on 3 Feb 2025
Hi Emmanuel,
Performing a MANOVA (Multivariate Analysis of Variance) with weighted observations directly using MATLAB's manova1 function isn't straightforward, as it does not inherently support weighting of observations. However, you can consider alternative approaches to achieve your goal. Here are some suggestions:
  1. Custom weighted MANOVA
  2. Use of General Linear Model
  3. Resampling or Bootstrapping
Following is custom code example for custom weighted MANOVA:
% Assuming X is your data matrix and W is a vector of weights
% Group is a categorical vector indicating population group for each observation
% Calculate weighted means for each group
uniqueGroups = unique(Group);
weightedMeans = zeros(length(uniqueGroups), size(X, 2));
for i = 1:length(uniqueGroups)
groupIdx = (Group == uniqueGroups(i));
groupWeights = W(groupIdx);
groupData = X(groupIdx, :);
% Weighted mean
weightedMeans(i, :) = sum(groupData .* groupWeights, 1) / sum(groupWeights);
end
% Calculate weighted covariance matrix
weightedCov = cov(X, W);
% Perform custom MANOVA (requires manual implementation or adaptation of existing functions)
% This involves calculating test statistics using the weighted means and covariance

Community Treasure Hunt

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

Start Hunting!