I have two time series of the form

{time, value}

I have linear fits of each set individually, and I am interested in the statistical differences between the slopes, with the intercept of no interest, so I would like to do an ANCOVA type thing, following what is outlined here http://www.wolfram.com/products/mathematica/newin7/content/StatisticalModelAnalysis/ComputeAndVisualizeResultsForAnANCOVAModel.html

I can join into a larger set with a third column to distinguish the type

{type, time, value}

I end up using LinearModelFit as follows:

result = LinearModelFit[data, {type, time}, {type, time}, 
NominalVariables -> type];

which all runs fine, but clearly this process only analyzes differences in the intercept (i.e., the best fit parameters have the same slope but different intercept), which I guess makes sense given how regression and ANOVA are related - my question is how would I re-do this so as to get the stats on the slopes instead?

Ideally I'd like to extend this to a two-factor equivalent, where there are two type factors, each with two sub-factors, and see if the slopes vary depending on which way you slice up the data.


closed as off-topic by J. M. will be back soon Mar 23 '18 at 14:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – J. M. will be back soon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Problem solved: forgot to include interaction term, so LMF should read LinearModelFit[data, {type, time,time*type}, {type, time} Derp! $\endgroup$ – zylatis Mar 24 '15 at 13:29