0
$\begingroup$

I have an assignment where I need to write a function between two variables:

Write a function that takes a directory of data files and a threshold for complete cases and calculates the correlation between sulfate and nitrate for monitor locations where the number of completely observed cases (on all variables) is greater than the threshold. The function should return a vector of correlations for the monitors that meet the threshold requirement.

The part I am confused about is "threshold". I don't understand how "threshold" relates to finding the correlation between the two variables. Can someone help me understand or point me to where I can find more information?

Thank you.

$\endgroup$
3
$\begingroup$

This seems to refer to a conditional filter whereby the correlation is calculated only for datasets which have fewer than a certain number (threshold) of missing values (ie if there are fewer than x complete observations, the monitor is omitted). Makes sense for very large datasets to make sure you don't get correlations if there are unreasonably few observations.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for your answer. As a follow up question, would the threshold equal to 'N' (sample size) in the equation for covariance? If so, then how would I choose which values to put in my sample size? Thanks! $\endgroup$ – user1547174 Nov 13 '14 at 5:27
  • $\begingroup$ I think this problem calls for a threshold as an argument in your function so that you could specify it when you call the function. Unless it is the min of complete cases in all datasets, not really sure from the way it is stated. $\endgroup$ – katya Nov 13 '14 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.