Interpretation of hydroplot in R (package: "hydroTSM") - r

I want to analyze mean daily runoff data by means of a hydroplot.
I was able to write the code for the hydroplot.
plot(MeteoZ,main="Runoff (m³/s) for Bad Aibling, Glonn station",xlab="Time")
However, I am not very sure how to interpret it. I have 3 main questions:
Since my data was daily, how are the monthly/yearly time series made? Is that averaged per month/year? What does the y-axis represent?
Same question for the boxplots.
What is the value of the y-axis in the hydroplot? Proportion?

Related

R function for determining oscillations

Given the plot of the time-series data, I was wondering if there is a robust function/mathematical formula I can use in R to determine which plots are oscillating. For example each individual graph corresponds to a single cell's intensity value over a certain time period. I would want a method to give a score or some value that would be able to differentiate between plots that are not oscillating (#513 and 559) compared to the plots that are oscillating (508,512,557,558). All the plots have the same scaling.

interpret plot of multivariate time series clustering results from dtwclust

I'm using DTWCLUST package in r for multivariate time series clustering. Here's my code.
data("uciCT")
mvc <- tsclust(CharTrajMV, k = 4L, distance = "gak", seed = 390L)
plot(mvc)
The CharTrajMV data set has 100 observations with 3 variables. As I understand, clusters are determined based on 3 variables as opposed to univariate time series clustering.
Each cluster graph shows several similarly patterned time series (observations) belonging to that cluster. How is this graph drawn? There are 3 time series variables used for clustering, how does one pattern graph come out? I mean the input is 3-dimentional(variables) dataset, but the output is 1-dimentional.
Moreover, I can get the 3 variables's centroid for each cluster (using mvc#centroids)
plot(mvc, labels = list(nudge_x = -10, nudge_y = 1), type="centroids")
this code shows only one centroid for each cluster. Can I get 3 variables' centroid graphs for each cluster with plot option? or is this right approach?
This is covered in the documentation. Plotting so many different series in separate panes would get very congested, so, for multivariate plots, the variables are appended one after the other, and you get vertical dotted lines to see the place where that happened, maybe injecting some missing values in some places to account for differences in length. This does mean the x axis isn't so meaningful anymore, but it's only meant to be a quick visualization aid.

pixelwise rescaling of a time series using cumulative distribution function matching

I'm using R and I have a raster stack of surface soil moisture measurements from a radiometer on fixed on an observation tower. These data are daily values going back 10 years.
I also have another raster stack of satellite microwave measurements of soil moisture over a larger area going back 25 years. Both sensors have similar frequencies.
On a per-pixel basis, I would like to use a linear cumulative distribution function matching that rescales the satellite data against the tower data so that it would result in a longer time series of rescale satellite data.
This point is to correct for systematic differences between the soil moisture values and extend the time series. This is similar to what was done in the figure below where they matched the AMSR-E (blue plot) and ASCAT (red plot) data to Noah data (black plot).
Does anyone know how to implement this in R? Or at the very least help me get started? I've scoured the Internet and this website without success.

Interpolate data from the given time series and plot the scatter plot with equation in R

I have a time series of more than 2500 points. I also have observed data set but it is not continuous. I want to use the observed data set and find out the modeled data from the time series data. After the modeled data has been found out for the same time I want to plot the correlation plot and display the equation and coefficient of correlation on the plot.
The sample time series can be found on the following link
https://www.dropbox.com/s/uxg0g1h7vbhxp3z/33010G10.csv
The observed data is as follows:
260.323 25.170
267.316 25.520
274.313 24.950
281.333 25.140
288.326 24.130
295.319 19.540
302.330 10.280
309.323 17.340
317.326 18.300
323.323 11.280
329.355 12.450
337.333 9.050
351.323 14.620
364.389 16.350
372.368 19.400
379.382 10.980
393.382 14.260
414.377 11.640
421.382 10.660
428.378 3.950
435.382 18.950
442.378 18.180
449.378 20.570
456.368 18.400
463.375 11.770
470.382 18.130
477.372 18.370
484.368 21.310
491.375 24.200
498.378 24.070
505.382 18.600
512.389 24.670
526.392 28.310
533.406 28.310
540.399 28.700
547.375 28.400
554.389 27.050
Please let me know how can I efficiently arrange the dataset so that I could repeat this for several other locations. Thank you so much.
There is a textbox function in package 'plotrix'. For plotting a regression line this should suffice
plot(dat$Date,dat$Minimum)
abline(coef(lm(Minimum~Date, data=dat)))
You will need to describe what you mean by "arrange the dataset so that I could repeat this for several other locations."

Lorentz curve plot

I need to get a plot of a Lorentz curve of a cumulative variable as a function of the number of observations. I want both axes to be displayed on a percentage basis (e.g. say observations are the number of buyers and the y variable is the amount they bought, buyers are already ranked in descending order, I want to get the plot that says "The top 10% buyers purchased 90% of the total bought"). My dataset is a couple million observations.
What is the best way to do this? Sub-questions:
If I need to add two variables for the quantiles of total observations and total $ bought (so as to use them to plot), what is the object that returns the row number? I tried:
user_quantile <- row(df)/nrow(df)
but I get a matrix of identical columns (user_quantile.1, user_quantile.2) of which I only need one column.
Is there instead any way to skip adding percentages as variables and only have them for axes values?
The plot has way to many points than I need to get the line. What is the best approach to minimize the computational effort and get a nice graph?
Thanks.
You may want to acquaint yourself with the excellent RSeek search engine for R content. One quick query for Lorentz curve (and Lorenz curve) lead to these packages:
ineq: Measuring inequality, concentration, and poverty
reldist: Relative Distribution Methods
GeoXp: Interactive exploratory spatial data analysis
lawstat: An R package for biostatistics, public policy and law
all of which seem to supply a Lorenz curve function.
In order to get the plot done you need first to arrange the raw data.
1) You can use the cut2() function from the Hmisc package to cut the data in quantiles. Check the documentation, it's not hard. It's similar to the cut() from the base package.
2) After using the cut2() function with the income data, you need to compute the frequency of each decile. Use table() for that. Then calculate percentages of income for each decile.
3) Now you should have a very small table with the following columns:
Decile, cumulative % of total income.
Add another column with the 45 degree line. Just add a constant cumulative % of income.
finaltable$cumulative_equality_line = seq(0.1, 1, by = 0.1)
4) You can use base graphics or ggplot2 for plotting. I guess you can do it with the info of step 3 or perhaps check out specific plotting questions.
I'll have to do it soon, but i already have the final table. I'll post the code for plotting once i do it.
Good luck!

Resources