Message Boards Message Boards

Import data from Excel and run the Anderson Darling test on it

GROUPS:

I wanna import an excel .xlsx sheet into Mathematica and perform the AndersonDarling test on it. Unluckily I'm in a hurry and unluckily I'm a very early beginner wtih Mathematica, so I decided to ask for help in this platform. I got this error message but I do not have any idea how I can solve that issue.

    AndersonDarlingTest::rctnln: The argument {{{151.6,151.9,149.8,148.8},{151.9,150.9,148.8,147.9},
{150.5,150.9,148.2,147.9},{149.9,148.8,150.7,151.},{152.6,152.2,153.4,149.9},<<41>>,
{151.,152.27,153.87,150.93},{152.65,152.21,151.67,150.21},{153.6,151.19,152.56,154.01},
{150.92,154.21,149.75,151.33},<<49>>}} at position 1 should be a rectangular array of real
 numbers with length greater than the dimension of the array.

I kindly ask for some help and explanation, what I did wrong.

THANKS and BR Hans

POSTED BY: johann.spies
Answer
4 months ago

I can only take a guess at your issues. I have no expertise with the AndersonDarlingTest function in WL. The error is pointing generally to some issues with the data you are importing from an Excel (xslx) spreadsheet. So I used what data was available from your problem particularly the error message output you pasted. (ref/AndersonDarlingTest)

data = {{151.6, 151.9, 149.8, 148.8}, {151.9, 150.9, 148.8, 
   147.9}, {150.5, 150.9, 148.2, 147.9}, {149.9, 148.8, 150.7, 
   151.}, {152.6, 152.2, 153.4, 149.9}, {151., 152.27, 153.87, 
   150.93}, {152.65, 152.21, 151.67, 150.21}, {153.6, 151.19, 152.56, 
   154.01}, {150.92, 154.21, 149.75, 151.33}}

Took out the snips (41,49) and made certain that the data is rectangular

Dimensions[data]

Gives rectangular value {9,4}.

AndersonDarlingTest[data]

Gives 0.999731 So I would guess that the issues is as stated from the message that somewhere in your data there is data or missing data that renders the data set your dealing with as non-rectangular or not all real numbers.. Unless your data needs to remain a secret (proprietary data, patient information or personal data) it would be nice of you to provide a sample sheet. Maybe someone from this community can help.

Thanks

POSTED BY: Hans Michel
Answer
4 months ago

Excel by default imports a list of rectangular sheets. You could try Import[file, {"Data", 1}] to only import the first sheet, then the data should be rectangular.

POSTED BY: Sean Cheren
Answer
4 months ago

Group Abstract Group Abstract