Effect of age on the rate of change of TMHDS scores
Next, we want to ask whether TMHDS of old patients decrease faster. Based on the correlation coefficients and in conjunction with the plot, please explain the effect of age on rate change of TMHDS.
% Calculate the rate of change of TMHDS for each patient vs age. use the slope of the polyfit.
for i=1:size(score, 1)
rates = zeros(size (score, 1), 1);
rates(i) = trend (?)
trend = polyfit(age(?,?)), score(?,?))
end
% Does this correlate with age? plot the scatter plot and the trendline
figure
scatter plot of age vs. the rates
trendandplot(mean(age, 2), rates, 'scatter')
Use the corrcoef() to answer the question: Does this correlate with age? why? compare p values to 0.05 and 0.01
[R,P]=corrcoef (??)
Which is more important?
What we often want to know when there are two independent variables is: Which is more important: age or drug use? There are many ways to do this but the simplest is to group the patients. Within this set of "drug-using" patients, there are some that n
positive for drug use. These patients can be used to determine the effect of age alone. This can then be compared to age-matched patients who tested positive for varying levels of drug use.
% Develop a figure that answers the question: Which has a larger effect,
aging or drug use?
construct seven drug groups (0,1,2,3,4,5,6) based on the sum of all drug use for each patient. plot Linear regression of the mean age vs. mean scores
add the trend line
calculate the correlation coefficient for each group
answer the question "which drug group has the highest correlation coefficient between age and score" and why?.
for i=0:6
I= sum(drug, 2)==1;
subplot(1,7,7)
scatter(mean (age(?,?) dim), mean (score(?,?), dim))
trend=polyfit((age(?,?) dim), mean (score(?,?), dim))
trend(1), trend (2)
plot()