How to do a paired test when some cases have no pair? I have a question regarding paired and unpaired tests. I know the difference between both tests. I am using R for Wilcoxon test. My test is a paired test, however the X and Y do not have the same length and R is giving an error. I do not want/think I should use unpaired test.
For example,
I have a subject that makes some cookies every hour. I use some special kind of treatment to increase the stamina. Before the treatment he can only work 4 hours (after day he gets tired) and produces some cookies. After the treatment he produces more cookies per hour and work 7 hours without getting tired. 
X contains the number or cookies for each hour before the treatment and Y contains the number of cookies after the treatment. X contains 4 values and Y contains 7 values. Now if I want to use paired test, R gives error. 
What should I do? Is there any solution or explanation for such kind of situations? Can I add just NA NA?
"This is just an example please do not point out mistake in the example, it is just to give you an example."
Thank you.
EDIT
Here is basic R script that I use
someData <- read.csv(file="cookie_data.csv",head=TRUE,sep=",")
wilcox.test(someData$X, someData$Y, paired=TRUE)

Sample Data:
X,Y
2,3
3,2
3,3
2,2
,3
,7
,2

When I use this script, R does not give any error. However, when I print someData$X, it prints 4 values and after that it start writing NA NA NA. I noticed R automatically filled blank values with NA. This script gives me p-value but I do not know if it is correct.
 A: If you're just analyzing the one subject it's not a paired test.  There's nothing to pair across.  You also need to be careful in how you describe it because you can only make inferences about the performance of the individual subject and not subjects in general.
If you're analyzing multiple subjects then you need to actually have paired data, which means aggregating across subjects to comparable paired measures, such as how many cookies/day or mean cookies/hr.  You're not allowed to have more than one measure per predictor/level in a paired test for each subject.  You have two levels, stamina0 and stamina+.  Therefore, you can only have two measures / subject.
Alternatively, you could use mixed effects modelling that will allow you to use the number of cookies and hours and generate a much more precise model of what is going on.
A: If you have 7 days with data, with data after treatment on all 7, but data before treatment on only 4, I don't think there's a simple non-parametric test that you can use, except to omit the days that lack before-treatment data.  
You could use a parametric test (an analogue of the paired t-test), but it would require a mixed model (such as with the lme4 package for R).
