[Lego Report] Mean accuracy per model

Go down

[Lego Report] Mean accuracy per model

Post by Santiak on Fri Apr 01, 2016 8:30 am

Assign all values of a model to a new dataframe:

> M16 <- AllData[AllData$Model=="16",]
-- This puts all subsets of Model 16 into a single dataframe

Do a summary of the accuracy for that dataset:
> summary(M16$Accuracy)

Ding, you get the mean accuracy for that model number (in this case, 16)

Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
0.0000 0.0000 0.0000 0.1042 0.0000 1.0000 11

I.e., a mean of 0.1042.

Santiak
Admin

Posts : 23
Join date : 2016-02-24

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by Santiak on Fri Apr 01, 2016 8:39 am

Super easy fun-time way of doing it:

> aggregate(AllData$Accuracy, by=list(AllData$Model),FUN=mean)

Which gives you the mean for all models in a list, you can assign these to a new subset, if you like. For different functions, you can also use "summary", if you need information like distribution.

  Group.1          x
1        1         NA
2        2         NA
3        3         NA
4        4         NA
5        5         NA
6        6         NA
7        7         NA
8        8 0.45833333
9        9 0.37500000
10      10 0.18750000
11      11 0.40625000
12      12 0.18750000
13      13         NA
14      14 0.11458333
15      15 0.17708333
16      16 0.10416667
17      17 0.33333333
18      18 0.39583333
19      19 0.19791667
20      20 0.38541667
21      21 0.47916667
22      22 0.46875000
23      23 0.17708333
24      24 0.46875000
25      25 0.82291667
26      26 0.34375000
27      27 0.61458333
28      28 0.06250000
29      29 0.07291667
30      30 0.54166667
31      31 0.07291667
32      32 0.27083333
33      33 0.05208333
34      34 0.21875000
35      35 0.27083333
36      36 0.37500000
37      37 0.50000000
38      38 0.86458333
39      39 0.63541667
40      40 0.62500000
41      41 0.31250000
42      42 0.41666667
43      43 0.47916667
44      44 0.29166667
45      45 0.27083333
46      46 0.70833333
47      47 0.13541667
48      48 0.77083333
49      49 0.46875000
50      50 0.93750000
51      51 0.58333333
52      52 0.86458333
53      53 0.54166667
54      54 0.40625000
55      55 0.32291667
56      56 0.25000000
57      57 0.75000000
58      58         NA

Santiak
Admin

Posts : 23
Join date : 2016-02-24

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by tobi-wan kenobi on Fri Apr 01, 2016 8:45 am

Really? You just solved our main problem for the past two weeks with one line of code? Thank you man, I think that this is actually what we need in order to keep working with the data? Can you tell how you can export that into a new data fram in order to run the statistical texts on it? maybe even conserving information on the condition, so we can see the correlation with condition?

tobi-wan kenobi

Posts : 7
Join date : 2016-03-10

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by Santiak on Fri Apr 01, 2016 8:52 am

To export it you just assign it to a new variable:
MeanAll <- aggregate...

That stores Group number and mean value of accuracy into a new dataframe.

You can add in other subsets by adding them to the "by=list(...)" part:

MeanAll <- aggregate(AllData$Accuracy, by=list(AllData$Model, AllData$Condition, AllData$Concept),FUN=mean)

Santiak
Admin

Posts : 23
Join date : 2016-02-24

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by tobi-wan kenobi on Fri Apr 01, 2016 8:56 am

bahhhhhH JUNGE! (det er 'dreng' paa tysk) but it rather means "aaaaaaalter" (old boy) meaning in turn... thanks! how can you... wh... *looses tension in his shoulders and lets head fall down* just : thank you thats exactly what I wanted to have and i couldnt find it googleing because i didn't know how to formulate that but i think it is perfeclty what we need.

tobi-wan kenobi

Posts : 7
Join date : 2016-03-10

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by Santiak on Fri Apr 01, 2016 8:57 am

Hehe, glad to be of help. ^^

Santiak
Admin

Posts : 23
Join date : 2016-02-24

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by Santiak on Fri Apr 01, 2016 9:28 am

Oh, and if you want to keep it neat, follow up with:


> names(MeanAll) <- c("Model", "Condition", "Concept")

To give the columns the correct nomenclature, instead of "Group.1,2,3"

Santiak
Admin

Posts : 23
Join date : 2016-02-24

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by catalina13 on Sat Apr 02, 2016 3:39 pm

Guys, how did you managed to answer the second hypothesis? Have you used linear model, and if yes, how did you do it, because I have no idea what codes to use, or have you used T-test?

catalina13

Posts : 2
Join date : 2016-03-08

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by Santiak on Sat Apr 02, 2016 11:22 pm

I take it you mean Hypothesis 2 (Accuracy as a function of Empathy) and not 1.2 (or 1a) (Clarity as a function of Condition). Smile

I did a count graph with a regression line as well as a t-test:

ggplot(Dataframe, aes(y=DependentVariable, x=IndependentVariable)) + geom_count() + geom_smooth(method=lm)
summary(lm(DependentVariable~IndependentVariable, Dataframe))

If I assumed incorrectly, and you did mean Clarity as a function of Condition (1.2/1a):

I did the above first and foremost (m <- ... and n <- ...).
Then I created a boxplot to visually inspect the distribution:

boxplot(IndependentVariable~DependentVariable, Dataframe)

Did a numerical inspection of the two new dataframes I created above:
summary(m$Clarity)
summary(n$Clarity)
And looked at the difference in the Mean.

And finally did a glm:
summary(glm(data=Dataframe, IndependentVariable~DependentVariable))

(Note that for some reason glm was acting up when I tried doing it without the "data=" part, so try to include that if you're having trouble with glm) Smile

Santiak
Admin

Posts : 23
Join date : 2016-02-24

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by catalina13 on Sun Apr 03, 2016 5:20 pm

Thank you so much! Very Happy

catalina13

Posts : 2
Join date : 2016-03-08

View user profile

Back to top Go down

Re: [Lego Report] Mean accuracy per model

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum