In below example of GLM, I want to get the Pr(>|t|) value 3.4e-7. How can I get it?
Also, how this p-value be calculated? By F test or by Chisq test? I can choose the test type in R but I can not choose in Julia.
julia> using GLM, RDatasets julia> form = dataset("datasets","Formaldehyde") 6x2 DataFrame |-------|------|--------| | Row # | Carb | OptDen | | 1 | 0.1 | 0.086 | | 2 | 0.3 | 0.269 | | 3 | 0.5 | 0.446 | | 4 | 0.6 | 0.538 | | 5 | 0.7 | 0.626 | | 6 | 0.9 | 0.782 | julia> lm1 = fit(LinearModel, OptDen ~ Carb, form) Formula: OptDen ~ Carb Coefficients: Estimate Std.Error t value Pr(>|t|) (Intercept) 0.00508571 0.00783368 0.649211 0.5516 Carb 0.876286 0.0135345 64.7444 3.4e-7
The thing with julia is that most of the language is written in julia, so getting answers means just reading more julia code. So in GLM/src/lm.jl there is a function coeftable(..) that generates the above table. Taking the calculation from there, you get:[ccdf(FDist(1,df_residual(lm1.model)),abs2(fval)) for fval in coef(lm1)./stderr(lm1)]which gives the Pr(>|t|) column:0.5515953.40919e-7And as for how it is calculated - the formula shows it uses the F distribution.