Any ANOVA or ANCOVA examples for Julia?

1,034 views
Skip to first unread message

Edward Stembler

unread,
Feb 12, 2014, 3:57:08 PM2/12/14
to julia...@googlegroups.com


Does anyone know of any ANOVA or ANCOVA examples for Julia out there?  I haven't been able to find anything via Google.

Taylor Maxwell

unread,
Feb 12, 2014, 4:42:15 PM2/12/14
to julia...@googlegroups.com
You should be able to perform an anova or ancova with the GLM package.


You can use the lm() function and your variables with factors need to be PooledDataArrays in the dataframe.

Douglas Bates

unread,
Feb 13, 2014, 4:37:25 PM2/13/14
to julia...@googlegroups.com
On Wednesday, February 12, 2014 3:42:15 PM UTC-6, Taylor Maxwell wrote:
You should be able to perform an anova or ancova with the GLM package.


You can use the lm() function and your variables with factors need to be PooledDataArrays in the dataframe.

If you are looking for an analysis of variance table the GLM.jl package does not yet provide it.  It isn't difficult to create the sequential sums of squares if that is what is desired. 

Please file an issue in the GLM package. 

Stéphane Laurent

unread,
Apr 3, 2014, 5:53:46 PM4/3/14
to julia...@googlegroups.com
Hello, 
Please, does someone have an example of a dataframe with a "factor" variable ?

Stéphane Laurent

unread,
Apr 3, 2014, 7:19:05 PM4/3/14
to julia...@googlegroups.com
Ok I get one:

julia> df = DataFrame(A = 1:4, B = ["M", "F", "F", "M"])
4x2 DataFrame:
        A   B
[1,]    1 "M"
[2,]    2 "F"
[3,]    3 "F"
[4,]    4 "M"

julia> pool!(df)

julia> ModelMatrix(ModelFrame(Formula(:A,:B), df))
ModelMatrix{Float64}(4x2 Array{Float64,2}:
 1.0  1.0
 1.0  0.0
 1.0  0.0
 1.0  1.0,[0,1])

Taylor Maxwell

unread,
Apr 3, 2014, 10:23:17 PM4/3/14
to julia...@googlegroups.com
I just added a pull request with code to the GLM package to add an anovatable and an effects function. It gets the effects from a LmMod (created from lm()) and makes a standard anova table with term, df, SS, MS, F, and p-value.
Reply all
Reply to author
Forward
0 new messages