[R] generate average frame from different data frames

Luigi Marongiu m@rong|u@|u|g| @end|ng |rom gm@||@com
Sun Oct 24 07:39:34 CEST 2021


Thank you. Sorry for the fuzziness of the question but I find it
difficult to give a proper definition of the problem. I have given a
graphical rendering on this post
https://www.researchgate.net/post/How_to_find_95_CI_of_a_matrix_of_classification_data
As you can see in the figure, there are dots where the same value is
represented all the time, and others where the values fluctuate. I
would like to generate the "mean" merge of the figures. (Perhaps also
with lines saying: this value comes out 9/10 of times, this 5/10 of
times...).
The problem is that the Z values are factors, not numbers.

On Sun, Oct 24, 2021 at 12:08 AM Jim Lemon <drjimlemon using gmail.com> wrote:
>
> Hi Luigi,
> I may be missing the point, but:
>
> matrix((z1+z2+z3)/3,ncol=10)
>
> gives you the mean rating for each item, and depending upon what
> distribution you choose, the confidence intervals could be calculated
> in much the same way.
>
> Jim
>
> On Sun, Oct 24, 2021 at 7:16 AM Luigi Marongiu <marongiu.luigi using gmail.com> wrote:
> >
> > Hello,
> > I have a series of classifications of the same data. I saved this
> > classification in a single dataframe (but it could be a list). X and Y
> > are the variable and Z is the classification by three raters. `I` is
> > the individual identifier of each entry:
> > ```
> > z1 = c(0,0,0,0,0,1,0,0,0,2,
> > 0,1,1,1,0,0,0,1,0,2,
> > 0,1,1,2,0,0,0,1,0,2,
> > 1,1,1,2,1,0,0,1,1,2,
> > 1,0,0,2,1,1,0,1,2,0)
> > z2 = c(0,0,0,0,0,1,0,0,1,1,
> > 0,1,1,2,0,0,0,1,1,2,
> > 0,0,0,1,0,0,0,1,0,0,
> > 1,2,1,2,1,0,0,1,1,2,
> > 1,0,1,2,1,1,0,1,2,0)
> > z3 = c(0,0,0,2,0,0,0,0,0,2,
> > 0,1,0,2,0,0,0,1,0,2,
> > 0,1,1,2,0,0,0,1,0,2,
> > 1,1,1,2,1,0,0,2,1,2,
> > 2,0,1,1,1,1,0,1,1,0)
> > df = data.frame(X=rep(1:5,3), Y=rep(1:5,3), Z=factor(c(z1,z2,z3)), I =1:150)
> > ```
> > Is there a way to obtain a kind of heath map for each point? Let's say
> > for the point (x=1,y-1), what was the most common (average)
> > classification? Is it possible to get the 95% CI of that mean?
> > Would Two-Dimensional Kernel Density Estimation be the right path?
> > Thank you
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.



-- 
Best regards,
Luigi



More information about the R-help mailing list