" Exercise 14.2 Statistical Methods in Biology: Design and Analysis of Experiments and Regression by S.J. Welham, S.A. Gezan, S.J. Clark & A. Mead (2014) Chapman & Hall/CRC Press, Boca Raton, Florida. ISBN: 978-1-4398-0878-8 Data from Bliss, C.I. (1970) Statistics in Biology: Statistical Methods for Research in the Natural Sciences, Volume 2. McGraw-Hill, New York. 639 pp.(Exercise 18.8) Version 1, 01/01/2016 " " Set working directory - change to location of your data file " \SET [WORKINGDIRECTORY='d:/stats4biol/data/'] " Read data from working directory " FILEREAD [NAME='FOLIAR.DAT'; IMETHOD=read] FGROUPS=no " Construct biologically meaningful explanatory variates " " Standardize K and Ca variables to sample weight of 20g " CALCULATE [PRINT=summary] Kconc,Caconc=K,Ca/(SampleWt/20) " 1. MLR model for increases in height " " Plot data " DSCATTER DATA=Kconc,Caconc,IncHt " Print correlations " FCORRELATION DATA=Kconc,Caconc,IncHt " Fit full MLR model with Caconc first " MODEL Y=IncHt FIT [PRINT=#,accumulated; FPROBABILITY=yes; TPROBABILITY=yes] Caconc,Kconc " Residual plots based on standardized deviance residuals " RKEEP RESIDUALS=res; FITTEDVALUES=fval DRESIDUALS [RESIDUALS=res; FITTEDVALUES=fval] METHOD=fittedvalues,normal,histogram,absresidual " Check model in other order " FIT [PRINT=#,accumulated; FPROBABILITY=yes; TPROBABILITY=yes] Kconc,Caconc " Fit predictive (SLR) model " FIT [PRINT=#; FPROBABILITY=yes; TPROBABILITY=yes] Caconc " Residual plots based on standardized deviance residuals " RKEEP RESIDUALS=res; FITTEDVALUES=fval DRESIDUALS [RESIDUALS=res; FITTEDVALUES=fval] METHOD=fittedvalues,normal,histogram,absresidual " Plot predictive model " RGRAPH [CIPLOT=yes] " Prediction " PREDICT [PREDICTION=pred; SE=SEpred] CLASSIFY=Caconc; LEVELS=20 " Save residual df " RKEEP DF=ResDF " Obtain critical value from t-distribution " CALCULATE tcrit=EDT(0.975;ResDF) " Calculate 95% CI for prediction " CALCULATE lower=pred-tcrit*SEpred CALCULATE upper=pred+tcrit*SEpred PRINT STRUCTURE=lower,pred,upper " 2. MLR model for basal area " " Plot data " DSCATTER DATA=Kconc,Caconc,IncBA " Print correlations " FCORRELATION DATA=Kconc,Caconc,IncBA " Fit full MLR model " MODEL Y=IncBA FIT [PRINT=#,accumulated; FPROBABILITY=yes; TPROBABILITY=yes;\ SELECTION=adjustedr2,r2,aic,bic] Kconc,Caconc " Residual plots based on standardized deviance residuals " RKEEP RESIDUALS=res; FITTEDVALUES=fval DRESIDUALS [RESIDUALS=res; FITTEDVALUES=fval] METHOD=fittedvalues,normal,histogram,absresidual " Fit in other order " FIT [PRINT=#,accumulated; FPROBABILITY=yes; TPROBABILITY=yes;\ SELECTION=adjustedr2,r2,aic,bic] Caconc,Kconc " Fit predictive (SLR) model " FIT [PRINT=#; FPROBABILITY=yes; TPROBABILITY=yes] Kconc " Residual plots based on standardized deviance residuals " RKEEP RESIDUALS=res; FITTEDVALUES=fval DRESIDUALS [RESIDUALS=res; FITTEDVALUES=fval] METHOD=fittedvalues,normal,histogram,absresidual " Plot predictive model " RGRAPH [CIPLOT=yes] " Prediction " PREDICT [PREDICTION=pred; SE=SEpred] CLASSIFY=Kconc; LEVELS=100 " Save residual df " RKEEP DF=ResDF " Obtain critical value from t-distribution " CALCULATE tcrit=EDT(0.975;ResDF) " Calculate 95% CI for prediction (using ResDF and tcrit saved earlier) " CALCULATE lower=pred-tcrit*SEpred CALCULATE upper=pred+tcrit*SEpred PRINT STRUCTURE=lower,pred,upper " End of File "