0
$\begingroup$

I have two variables one dependent(Y) and another is independent(X). Y is continuous and X one is categorical. Values of both variables are recorded for every minute, for example 10:00 - X=5, Y=89; 10:01 - X=5, Y=90, 10:02 - X=1, Y=21, 10:03 - X=1, Y=22 (time series). I wanted to explore the variation of Y based on X over a period of one day (1440 minutes).

Would like to know the suitable visualization for this scenario.

Sample data set

Time  - Category - Response
10:00 -     5    -    89
10:01 -     5    -    90
10:02 -     1    -    21
10:03 -     1    -    22
10:04 -     1    -    19
10:05 -     4    -    51
10:06 -     4    -    48
$\endgroup$
  • $\begingroup$ Time is often, indeed usually, discrete, in years, months. days, whatever. In your case it's minutes and the only real question is how your (unstated) software handles time in minutes. Otherwise the different categories at different times could be represented by different coloured bars or different symbols. That might be a mess, in which separate graphs for separate categories might help. $\endgroup$ – Nick Cox Sep 26 '14 at 7:38
  • $\begingroup$ ... in which case ... $\endgroup$ – Nick Cox Sep 26 '14 at 8:18
  • $\begingroup$ Sample data taken is of one day i.e., 1440 data points. Differentiating categories with colors looks impressive. But how? currently using xts function to plot Response across the day Ex: crt <- flx[,c("dt","Respone", "Category")] crxts <- xts(crt[,-1], order.by=crt[,1]) plot.xts(crxts, major.ticks="days", major.format="%b/%d %H:%M", screens=factor(1,1), auto.legend=TRUE, legend.loc="topright", main = "Distribution OUTPUT") $\endgroup$ – Nageswara Rao Sep 26 '14 at 9:07
  • $\begingroup$ It's good practice to state your software. If the question is now about precisely what code to use, it's off-topic here. See the Help Center for advice on that. $\endgroup$ – Nick Cox Sep 26 '14 at 9:13
  • $\begingroup$ Sorry!!! I am using R $\endgroup$ – Nageswara Rao Sep 26 '14 at 9:31
2
$\begingroup$

You can use lattice package in R, and its function xyplot(). You can see this this thread or this external link for examples.

In your case, i guess it could be something like:

 xyplot(Response ~ Time | Category, ...)
$\endgroup$
1
$\begingroup$

Its not entirely clear what you want to do. If you want to study the variation in the continuous variable in relation to the categories of the categorical variable you would use a side-by-side boxplot, new boxplot for each category.

If time is important, then I would recommend making time series plots, facetted by category.

If actual unit of time may not be important then computing addition units, hour, day, and using this as the time variable may be useful. Or aternatively facet the side-by-side boxplots by hour or day.

$\endgroup$

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.