After running a standard linear regression, it is easy enough to run pairwise comparisons as ling as the indepvar is factorial. But I have a non-monotonic response for which a linear regression is inappropriate:
Here, dose2 is simply dose^2. Dose could be seen as both an ordinal and continuous variable.
Quadratic regression improves the fit over the linear model:
This difference is significant:
But is it possible to now run a pairwise comparison? I tried running the quadratic with both dose and dose2 as factor variables, but the output was no different to that of linear regression against i.dose due to colinearity. Should I just be satisfied with identifying the trend, without pairwise comparison between groups? (Please note, I'm interested in comparing the means of measured values, not predicted means).
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int dose double response float dose2 0 7.14 0 0 6.89 0 0 9.09 0 0 7.83 0 0 9.47 0 10 8.75 100 10 7.91 100 10 9.93 100 10 9.84 100 10 8.37 100 50 10.2 2500 50 10.7 2500 50 10.5 2500 50 8.43 2500 50 10.9 2500 100 11.1 10000 100 10.6 10000 100 10.6 10000 100 10.9 10000 100 10.9 10000 200 10.4 40000 200 11 40000 200 10 40000 200 9.23 40000 200 10.1 40000 end
Quadratic regression improves the fit over the linear model:
Code:
. regress response dose Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(1, 23) = 9.13 Model | 10.8728249 1 10.8728249 Prob > F = 0.0061 Residual | 27.3822391 23 1.19053214 R-squared = 0.2842 -------------+---------------------------------- Adj R-squared = 0.2531 Total | 38.255064 24 1.593961 Root MSE = 1.0911 ------------------------------------------------------------------------------ response | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- dose | .009028 .0029874 3.02 0.006 .0028481 .0152079 _cons | 8.981181 .3064083 29.31 0.000 8.347328 9.615035 ------------------------------------------------------------------------------ . regress response c.dose##c.dose Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 17.14 Model | 23.2990371 2 11.6495185 Prob > F = 0.0000 Residual | 14.9560269 22 .679819406 R-squared = 0.6090 -------------+---------------------------------- Adj R-squared = 0.5735 Total | 38.255064 24 1.593961 Root MSE = .82451 ------------------------------------------------------------------------------- response | Coef. Std. Err. t P>|t| [95% Conf. Interval] --------------+---------------------------------------------------------------- dose | .0433276 .0083342 5.20 0.000 .0260436 .0606116 | c.dose#c.dose | -.0001714 .0000401 -4.28 0.000 -.0002546 -.0000883 | _cons | 8.314824 .2791116 29.79 0.000 7.735982 8.893666 -------------------------------------------------------------------------------
Code:
. nestreg: regress response dose dose2 Block 1: dose Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(1, 23) = 9.13 Model | 10.8728249 1 10.8728249 Prob > F = 0.0061 Residual | 27.3822391 23 1.19053214 R-squared = 0.2842 -------------+---------------------------------- Adj R-squared = 0.2531 Total | 38.255064 24 1.593961 Root MSE = 1.0911 ------------------------------------------------------------------------------ response | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- dose | .009028 .0029874 3.02 0.006 .0028481 .0152079 _cons | 8.981181 .3064083 29.31 0.000 8.347328 9.615035 ------------------------------------------------------------------------------ Block 2: dose2 Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 17.14 Model | 23.2990371 2 11.6495185 Prob > F = 0.0000 Residual | 14.9560269 22 .679819406 R-squared = 0.6090 -------------+---------------------------------- Adj R-squared = 0.5735 Total | 38.255064 24 1.593961 Root MSE = .82451 ------------------------------------------------------------------------------ response | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- dose | .0433276 .0083342 5.20 0.000 .0260436 .0606116 dose2 | -.0001714 .0000401 -4.28 0.000 -.0002546 -.0000883 _cons | 8.314824 .2791116 29.79 0.000 7.735982 8.893666 ------------------------------------------------------------------------------ +-------------------------------------------------------------+ | | Block Residual Change | | Block | F df df Pr > F R2 in R2 | |-------+-----------------------------------------------------| | 1 | 9.13 1 23 0.0061 0.2842 | | 2 | 18.28 1 22 0.0003 0.6090 0.3248 | +-------------------------------------------------------------+
Comment