# [gradsusr] Referencing a Student Distribution Table inside Grads for Calculating confidence level from varying Effective N and varying T Value.

Wed Jun 11 03:21:24 EDT 2014

```Hi,

I have a question here. How do I reference a Students Distribution Table
inside GraDS? I will explain my situation here. Using GraDS scripting, I
was able to calculate slope, and intercept from linear regression
calculation. Using the slope and intercept I was able to construct a fitted
model and find the standard error of the slope. From which I calculate
residuals (simply the data minus fitted model), finding actop and acbottom,
then residual auto correlation (actop divide by acbottom). Depending on the
value of the residual autocorrelation, I calculate Effective N to be either
the original n or based on calculation using the residual auto correlation.
After which I find the standard error based on effective n. Then finally t
value from dividing the standard error of the slope with the standard error
based on effective n. What I need to do next is to get the corresponding
confidence level by using the calculated t value and effective n to a
calculation.

1. Calculate 30 JJA seasons of a variable (produce time1 until time30)
2. Calculate the slope and intercept using linear regression (produce slope
and intercept)
3. Calculate the fitted model using the intercept and and slope (produce
fitted1 to fitted30)
4. Calculate the standard error of the slope(SEOTS) (produced SEOTS)
5. Calculate the residuals, time-fitted (produce residual1 to residual30)
6. Calculate the residual mean.
7. Calculate actop
8. Calculate acbottom
9. Calculate the residual auto correlation
10. based on value of residual auto correlation, calculate effective n
11. Effective n is either 30 (in this example) or through calculation.
12. Calculate the standard error based on effective n
13. Calculate Tvalue which is slope divided by standard error based on
effective n

This is where I'm stuck. I want to reference a students distribution table
to get the confidence level for the slope (which is actually trend of
linear regression). And the confidence level varies between each grid point
as the t value and effective n varies between each grid point.

In Scilab 5.5.0, I would use:
[p,q]=cdft('pq',abs(TValue),round(EffectiveN+0.5))
ConfidenceLevel=(1-(q*2))*100
which will give the confidence value from double tailed t test. This is
just an example. Is there any student distribution function inside GraDS
which I'm not aware of?