# Creating a data set of sample means

Hi - I have a Desmos file that I really like that takes random samples of size 100 from a larger data set and then shows the histogram and mean of the sample. I can vary the sample and show how the histograms vary which is great - however, what I would really like to be able to do is store the values of the sample means in a new data set so I could demonstrate the central limit theorem.
Does anyone know how I could achieve this? I think it might need to be in a classroom activity so I can use CL but I really don’t know?
This is my graphing file: aqa-lds-sampling-from-CO2-data - any help would be great!
Thanks!

Something like this?

AB will let you do multiple graphs on the same screen now, so you could plot the histograms on separate graphs as well.

That is really brilliant - thank you!! That does exactly what I was imagining in terms of capturing the mean values which is something I didn’t realise you could do!

Is there a way to automate the button click for the capture? I would expect to need to take at least 30 samples (so that is a lot of clicking!) - it would be amazing to be able to set the value for the number of samples as see the histogram develop as the samples were taken.

The data capturing happens on a button press. I don’t think there’s a method that allows capturing to happen outside of that.

You might be able to do an animation, where you use more and more of a list tied to that data.

(Took a poke at it, and ran into difficulties because you can’t have lists of lists, which is what I would need to get a list of means)

I made a function to create a pseudo array. Would that help?

https://www.desmos.com/calculator/pekwfwbpsy

I don’t think so - what you want here is something that would simulate:

M=C.random(100,[1…30]).mean

so that M would be a list of 30 randomly sampled means.

You could then use
histogram(M[1…t],5)
to show an animation using t to build the samples.

The error message is weird, but I’m pretty sure that it’s because it acts like a list of lists before you call the mean function on your subsamples.

Thanks for trying! I will make sure to click quickly and maybe take a few screen shots of examples of repeated samples.

@Daniel_Grubbs thank you - but I really am looking for the kind of thing @FRIEDRICH_KNAUSS has mentioned. I am sure I could write a macro in excel and then copy the data in - would just have been nice to do it all in Desmos.

It seems like the sort of thing you could have them do as a discovery activity. It’s why this is called Activity Builder. Let them click, and ask notice/wonder questions, then use snapshots to create a feedback slide show that you can put in a video.

I was going to suggest taking advantage of the one on one sessions that they provided, but it seems that’s gone away.

1 Like

Thanks - that is a great idea! I’ll keep an eye out in case the support sessions return.

A little late to the party, but I just became aware of this…

So you could take your larger list, randomly sort it then create a new list from the first 100 (I know there’s a way to do this, just not off the top of my head).

Thank you! That looks like a great solution.

Oops didn’t look closely enough. You don’t need to randomize and then take first 100. You can just use the sort.

N is a new list that takes 100 random elements from list L:
`N = sort(L, random(100))`

1 Like

Actually, after testing with a shorter list, that only randomizes the first 100 elements of L, so you’d want to use:

`N= sort( shuffle(L), random(100) )`