# Another example question R autograder By Neetesh Sharma (Department of CEE, University of Illinois, Urbana-Champaign, IL, USA) ## About This is just a minimalistic run through for an example R auto-graded question in Prairie Learn. The question I explain has both auto-graded and manually graded elements. The QID is **HW8_SP2020_part1_autograde_code**. ## Directory Structure ```bash HW8_SP2020_part1_autograde_code │ info.json │ part1_in.R │ part1_obs_in.R │ question.html │ └───tests │ part1.R │ points.json │ └───tests test_00.R test_01.R test_02.R test_03.R test_04.R test_05.R test_06.R test_07.R test_08.R test_09.R test_10.R test_11.R ``` ## Explaining the files `info.json` ```python { "uuid": "09b1ad17-f022-4189-b5ce-250743b8f969", "title": "Exercise 1: Drawing random numbers-1", "topic": "Basic R simulation", "tags": ["SP20","easy","Sotiria","code"], "type": "v3", "singleVariant": true, "gradingMethod": "External", "externalGradingOptions": { "enabled": true, "image": "stat430/pl", "serverFilesCourse": ["r_autograder/"], "entrypoint": "/grade/serverFilesCourse/r_autograder/run.sh", "timeout": 60 } } ``` If you are coding a new problem while using the same autograder, the things to change would be the `uuid`, `title`, `topic`, `tags`, and `timeout` under the `externalGradingOptions`. The `timeout` is the time in seconds that is allowed for each student submission to be processed. Submission is considered incorrect if it runs longer than the `timeout` duration. Try to keep it minimum (typically 5 to 10 seconds for a small problem, simulations take longer). `question.html` ```html
Set the seed equal to $61820$. Generate $5, 50, 500, 5,000, 50,000, 5,000,000$ numbers from a $\text{Binomial distribution with } (n=100, p=0.4)$ and assign them to variables named $b1, b2, b3, b4, b5, b6$ respectively. Also generate the same amount of numbers from a $\text{Poisson distribution with } (λ=40)$ and assign them to variables named $p1, p2, p3, p4, p5, p6$. Plot the outputs from each experiment in histograms, using function hist()
.
You may use par(mfrow=c(2,6))
, just before the hist()
functions, to organize your graphs in $2$ rows of $6$ plots for easier comparison. This will result in one row for the Binomial histograms and one row for the corresponding (in terms of number of random numbers generated) Poisson histograms.
What did you observe from the above experiments? Write as a comment (as R comment) in the following window.
Upload a PDF of the plot generated from your code. Using the following link. Name of the PDF file must be part1_plots.pdf. (Once you have created the plots in R, look just above the plots to see and click the Export tab, which has the option to export the plots to a .pdf file).