{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\f0\fs24 \cf0 \
README file for swwr.R\
\
There are 3 functions in swwr.R: swwr, sldwin and harmonize\
\
The function \'91swwr\'92 implements sliding windows and weighted polynomial regression, the function \'91sldwin\'92 is the sliding windows program called by swwr, and the function \'91harmonize\'92 harmonizes two datasets using swwr.\
\
##############################################################################\
\
Description of \'91swwr\'92:\
\
swwr(x, y, winlength, stepsize, polyN)\
\
- Implements sliding windows and weighted polynomial regression\
- x and y are numeric vectors specifying the (x,y) coordinates of the data\
- winlength is the length of the window (must be a positive number)\
- stepsize is the interval size between window midpoints (must be positive)\
- polyN is the degree of the polynomial used for weighted regression (must be a positive integer)\
\
Example with randomly generated values between 0-70 on the x-axis, normally distributed values on the y-axis with mean 0 and standard deviation 5, window length = 10, interval between window midpoints = 1, and with a 3nd degree polynomial regression:\
\
x = runif(100, 0, 70)\
y = rnorm(100, 0, 5)\
S = swwr(x, y, 10, 5, 3)\
\
Output:\
S$data_x = the input \'93x\'94\
S$data_y = the input \'93y\'94\
S$window_midpoints = midpoints of windows\
S$window_means = mean within each window (estimated through fitting a normal distribution)\
S$window_standard_deviations = estimated standard deviation within each window\
S$mean_coefficients = coefficients of polynomial regression for \'93mean\'94 function\
S$standard_deviation_coefficients = coefficients for \'93standard deviation\'94 function\
S$mean_at_x = estimated mean at location x\
S$standard_deviation_at_x = estimated standard deviation at x\
S$standard_deviation_scalars = scalar on standard deviation at x for data point (x,y)\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 ##############################################################################\
\
Description of \'91sldwin\'92:\
\
sldwin(x, y, winlength, stepsize)\
\
- Implements sliding windows\
- x and y are numeric vectors specifying the (x,y) coordinates of the data\
- winlength is the length of the window (must be a positive number)\
- stepsize is the interval size between window midpoints (must be positive)\
\
Example (similar to example for swwr but only for sliding windows):\
x = runif(100, 0, 70)\
y = rnorm(100, 0, 5)\
S = sldwin(x, y, 10, 5)\
\
Output \
S$window_data = list of data within each window\
S$window_midpoints = midpoints of windows\
S$means = mean within each window (estimated through fitting a normal distribution)\
S$standard_deviations = estimated standard deviation within each window\
S$count_per_window = number of data points per window\
\
##############################################################################\
\
Description of \'91harmonize\'92:\
\
harmonize(x1, y1, x2, y2, winlength, stepsize, polyN)\
\
- Harmonizes datasets with data points defined by (x1, y1) and (x2, y2)\
- x1 and y1 are numeric vectors specifying the (x1, y1) coordinates of the data\
- x2 and y2 are numeric vectors specifying the (x2, y2) coordinates of the data\
- winlength is the length of the window (must be a positive number)\
- stepsize is the interval size between window midpoints (must be positive)\
- polyN is the degree of the polynomial used for weighted regression (must be a positive integer)\
\
Example for 2 datasets, each similar to the example for swwr:\
x1 = runif(100, 0, 70)\
y1 = rnorm(100, 0, 5)\
x2 = runif(200, 15, 100)\
y2 = rnorm(200, 15, 100)\
H = harmonize(x1, y1, x2, y2, 10, 1, 3)\
\
Output\
H$x1 = the input \'93x1\'94\
H$y1 = the input \'93y1\'94\
H$x2 = the input \'93x2\'94\
H$y2 = the input \'93y2\'94\
H$y1_to_y2 = harmonized y1 vector onto scale y2 is on.\
H$y1_to_y2_rnd = harmonized y1 vector onto scale y2 is on and rounded to nearest y2 value\
}