This Curve Shape Testing Routine was designed to assist in designing code within it that decides which curve shape is represented by a particular time series. To do so, the program generates a bunch of time series from a mathematical model. It goes around in a loop varying the equation coefficients and calculating more time series. This gave lots of different time series for the Shape TEsting part of the routine to test, and observing the results helped in tweaking the code. This first large section defines a function 'session' that sets up the equations and substitutes coefficients that are chosen later in the iterative portion of the program. Each time 'session' is invoked later, it produces a time series and calculates things about it that might be useful, including the category of the curve shape (The function definition starts here) > # function for calculating coupled equations > session <- function(a,b,c,d,e,f,g,h,p,cnt){ + xlim1 <- c(0,100) + ylim1 <- c(-4,4) + ylim2 <- c(-4,4) + ylim3 <- c(0,10) (the above sets the limits for the graphical outputs) + v<-rnorm(100,0,1); + w<-rnorm(100,0,0.5); (the above defines a random function for client and therapist) + i<-1:100; + x<-1:100; + z<-1:100; + m<-1:100; + y<-1:100; (the above sets parameter ranges; this is for a 100-data-point series) + np<-0 + nn<-0 (the above are counters for finding how many points are +ve or -ve) + y[1]<- a; + if (y[1]>0.0)np<-1 + if (y[1]<0.0)nn<-1 + z[1]<- f; + m[1] <- 0; (above, the first point has to be designated and counters set accordingly) + for(i in 2:100){ + y[i]=y[1]-b*sin(i/32)-c*sin(i/4)-d*(z[i-1])+e*v[i]; + if (y[i] < 0.0) m[i] <- y[i]^2 else m[i]=0; + if (y[i] > 0.0)np<-np+1 + if (y[i] < 0.0)nn<-nn+1 + z[i]=z[1]+g*sin(i/32)+h*m[i]+p*w[i]; + }; (the above calculates the client (y) and therapist (z) recursively; the equations are coupled, and vary depending on results, e.g. the therapist works harder when the client goes negative, using the m[i] term of the equation) + # print(z) + par(mfrow=c(4,1)); + q <- c(a,b,c,d,e,f,g,h,p) + # return minimum and maximum of time series y(t) + r <- range (y, na.rm=FALSE) + # is y-value between -4 to +4 + if (r[1]<(-4)){concl <- "bad session range"} else + if (r[2]>4){concl <- "bad session range"} else + {concl <- "good session range"} (the above sets up the graphics page, a vector of coefficients for output, minimum and maximum of the range for the client values, and tags the session if the model produces a session that goes out of the -4/+4 range) + + # is overall y PNP, PLP, PLN, etc. ? + let1<-"X" + let2<-"X" + let3<-"X" + let4<-"X" (the above initializes four descriptions of the time series curve shape: let1 is a first letter describing the beginning of the series; this can be P - positive, or Z - zero, or N - negative let2 is a middle letter describing how the time series behaves inbetween the end points; this can be P - positive N - negative L - lower H - higher R - rising F - falling S - straight; which applies will depend on what let1 was. For example, if the time series rises after its initial position it might be either PH (positive then higher before falling) or PR (positive then rising to a higher end) or ZP (zero then positive before falling) or ZR (zero then rising to a higher end) or NP (negative then positive before falling) or NH (negative then going higher to less negative before falling) or NR (negative then rising to a higher end) Likewise, if the time series falls after its initial positions the options are PZ (start positive, fall to zero before rising again) PL (start positve, go lower to less positive before rising again) PF (start positve, fall towards a lower end point) ZN (start zero, fall to negative before rising again) ZF (start zero, fall towards a lower end point) NL (start negative, goes lower to more negative before rising) NF (start negative, fall to more negative end point) Neither rising nor falling gives PS (start positive, never change substantially) NS (start negative, never change substantially) let3 is a third letter describing how the time series ends; its options depend on the starting point let1: if let1 is P (positive), let3 could be: mP (ends more positive than it started) P (ends just around as positive as it started) lP (ends less positive than it started) Z (ends near zero) N (ends negative) if let1 is Z (zero), let3 could be: P (ends positive) Z (ends near zero) N (ends negative) if let1 is N (negative), let3 could be: P (ends positive) Z (ends around zero) lN (ends less negative than it started) N (ends just around as negative as it started) mN (ends more negative than it started) + if(y[1]>=(0.5)){let1<-"P"} else + if(y[1]<=(-0.5)){let1<-"N"} else {let1<-"Z"} (the above labels the starting state of the time series as P, N, or Z; it establishes zero as between +/- 0.5; this can be altered) + if(y[100]>=(0.5)){let3<-"P"} else + if(y[100]<=(-0.5)){let3<-"N"} else {let3<-"Z"} (the above labels the end state of the time series first as P, N, or Z; again the zero criteria can be altered if you wish) + if(all((let1=="P"),(let3=="P"),((y[1]-y[100])>0.5))){let3<-"lP"} + if(all((let1=="P"),(let3=="P"),((y[100]-y[1])>0.5))){let3<-"mP"} (the above changes a P end to lp (less positive) or mp (more positive); if there is more than 0.5 difference; this .05 can be changed) + if(all((let1=="N"),(let3=="N"),((y[1]-y[100])>0.5))){let3<-"mN"} + if(all((let1=="N"),(let3=="N"),((y[100]-y[1])>0.5))){let3<-"lN"} (the above changes a N end to mn (more negative) or ln (less negative); if there is more than 0.5 difference; this .05 can be changed) + if (np>nn){let4<-"p>n"} + if (nn>np){let4<-"n>p"} + if (nn==np){let4<-"p=n"} (the above compares the numbers of negative and positive points and uses let4 to label the series with p>n, n>p, or p=n) + if((r[2]-y[1])<(y[1]-r[1])){let2<-"L"} + if((r[2]-y[1])>(y[1]-r[1])){let2<-"H"} (in the above, r[2] is maximum reading for client, r[1] is minimum; if the maximum peak is less dominant than the minimum peak, it uses the minimum to characterize the middle of the series as L (lower); if the maximum peak is more dominant than the minimum peak, it uses the maximum to characterize the middle of the series as H (higher)) + if(all((let2=="L"),(y[1]>0),(r[1]<0))){let2<-"N"} (in the above, if the middle is L (lower), but the beginning is P (positive) and the minimum is negative, it renames the middle as N) + if(all((let2=="H"),(y[1]<0),(r[2]>0))){let2<-"P"} (in the above, if the middle is H (higher), but the beginning is N (negative) and the minimum is positive, it renames the middle as P) + if(all((let1=="Z"),(let2=="H"))){let2<-"P"} (in the above, is the middle is H (higher) but the beginning is Z (zero), it renames the middle as P) + if(all((let1=="Z"),(let2=="L"))){let2<-"N"} (in the above, is the middle is L (lower) but the beginning is Z (zero), it renames the middle as N) + if(all(identical(r[1],y[1]),identical(r[2],y[100]))){let2<-"R"} (in the above, if the beginning is the minimum and the end is the maximum, it renames the middle to R (rising) rather than H (higher)) + if(all(identical(r[2],y[1]),identical(r[1],y[100]))){let2<-"F"} (in the above, if the beginning is the maximum and the end is the minimum, it renames the middle to F (Falling) rather than L (lower)) + if(identical(r[2],r[1])){let2<-"S"} (in the above, if max and min are the same, there was no change and the middle is S (straight)) + main1<-paste("#",cnt+1," Generated TS - Client SD Affect - ",let1,let2,let3,", ",let4) (this line just concatenates the conclusions into one big title, which might look like: "#25 Generated TS - Client SD Affect - PNP, n>p" + + # if(r[1]>=y[100]){conc2 <- "bad session PNP"} else + # if(y[100]<0){conc2 <- "bad session PNP"} else + # {conc2 <- "good session pnp"} (the above lines are just comments recalling a more simplified earlier version of the program) + + if(concl=="bad session range"){saveit <- "no"} else + # if(conc2=="bad session PNP"){saveit <- "no"} else + {saveit <- "yes"; cnt<-cnt+1} (above lines (except middle comment line which is obsolete) designate whether the time series is saved; if so, it advances the time series counter cnt) + if (saveit=="yes"){ + # print(saveit) + plot (x,v, type="l", col="darkred", xlab="time", ylab="random - client", cex.lab=1.2, xlim=xlim1, ylim=ylim1, main="Generated Time Series - Client Random Factor", col.main= "darkblue", cex.main=3); + plot (x,w, type="l", col="darkred", xlab="time", ylab="random - therapist", cex.lab=1.2, xlim=xlim1, ylim=ylim1, main="Generated Time Series - Therapist Random Factor", col.main= "darkblue", cex.main=3); + plot (x,y, type="l", col="darkred", xlab="time", ylab="client measure", cex.lab=1.2, xlim=xlim1, ylim=ylim2, main=main1, col.main= "darkblue", cex.main=3); + plot (x,z, type="l", col="darkred", xlab="time", ylab="therapist measure", cex.lab=1.2, xlim=xlim1, ylim=ylim3, main="Generated Time Series - Therapist Attention to Client", col.main= "darkblue", cex.main=3); + print(cnt) + print(q) + print(y[1]) + print(y[100]) + print(r) + print(concl) + print(let1) + print(let2) + print(let3) + # print(conc2) + } + return(cnt) + } (the above specifies that saved time series should be printed on the R graphic output screen, and other paramaters printed on the console output. In the routine following, the graphical output is diverted into a *,pdf file, otherwise each time series supersedes the last on the screen graphic output and you only see the last one; I never figured out how to get it to show multiple pages of graphic output on the screen graphic output) > #routine for varying the parameters and determining good sessions > cnt <- 0 > # a <- 2 > # b <- 2 > # c <- 1.5 > d <- 0.3 > e <- 0.8 > f <- 3 > g <- 2.5 > h <- 0.1 > p <- 2 > setwd("F:/York University/York University Courses/Fall-Winter 2011-12/4th Yr Thesis/Thesis - Dr. John Eastwood/R/Programs/Development of PNP Evaluation Routine/pdf outputs") > pdf(file="PNP-Eval-5.pdf",width= 12, height= 12, family = "Helvetica", title = "MBF Data",bg="white") > for (a in -4:4){ + for (b in -5:5){ + for (c1 in 0:5){ + # for (d1 in 0:5){ + c <- c1/2 + # d <- d1/10 + cnt<-session(a,b,c,d,e,f,g,h,p,cnt) + } + } + } (The above section takes the computer around in a loop, setting equation coefficients, calculating the time series and evaluating the time series for its curve shape characteristics (by calling the function "session"); the parameter ranges can be modified and the extent of variation and iteration can be changed. This particular collection was varying only parameters a, b, and c) The data output below shows for each time series generated by the iterating function, the following: cnt (the number given to the time series) a,b,c,d,e,f,g,h,p, which are the coefficients used in that equation, for future reference y[1] - the beginning value of the time series y[100] - the end value of the time series r - the range (minimum and maximum values) of the time series concl - confirming that the time series retained was in the 'good session range' of -4 to +4 let1 - curve characteristic at beginning let2 - curve characteristic in the middle let3 - curve characteristic at end) [1] 1 [1] -2.0 -5.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] -2 [1] -1.470344 [1] -3.704725 3.145782 [1] "good session range" [1] "N" [1] "P" [1] "lN" [1] 2 [1] -2.0 -5.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] -2 [1] -3.700225 [1] -3.858661 3.394473 [1] "good session range" [1] "N" [1] "P" [1] "mN" [1] 3 [1] -2.0 -4.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] -2 [1] -2.461337 [1] -3.591205 3.348635 [1] "good session range" [1] "N" [1] "P" [1] "N" [1] 4 [1] -1.0 -5.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -1.768151 [1] -2.472065 3.586594 [1] "good session range" [1] "N" [1] "P" [1] "mN" [1] 5 [1] -1.0 -4.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -3.87337 [1] -3.873370 3.048615 [1] "good session range" [1] "N" [1] "P" [1] "mN" [1] 6 [1] -1.0 -4.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -2.028612 [1] -3.130673 2.884866 [1] "good session range" [1] "N" [1] "P" [1] "mN" [1] 7 [1] -1.0 -4.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -1.246097 [1] -3.867456 3.404095 [1] "good session range" [1] "N" [1] "P" [1] "N" [1] 8 [1] -1.0 -4.0 2.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -0.8195473 [1] -3.716317 3.774437 [1] "good session range" [1] "N" [1] "P" [1] "N" [1] 9 [1] -1.0 -3.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] 0.04072125 [1] -2.973038 1.738132 [1] "good session range" [1] "N" [1] "P" [1] "Z" [1] 10 [1] -1.0 -3.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -1.829911 [1] -2.770974 2.097853 [1] "good session range" [1] "N" [1] "P" [1] "mN" [1] 11 [1] -1.0 -3.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -1.009159 [1] -3.649653 2.746661 [1] "good session range" [1] "N" [1] "P" [1] "N" [1] 12 [1] -1.0 -2.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -2.110229 [1] -3.4925567 0.7866555 [1] "good session range" [1] "N" [1] "L" [1] "mN" [1] 13 [1] -1.0 -2.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] -1 [1] -3.431637 [1] -3.431637 2.174704 [1] "good session range" [1] "N" [1] "P" [1] "mN" [1] 14 [1] 0.0 -3.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] -0.990778 [1] -1.789340 3.364004 [1] "good session range" [1] "Z" [1] "P" [1] "N" [1] 15 [1] 0.0 -3.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] 0.03637398 [1] -2.339084 3.438024 [1] "good session range" [1] "Z" [1] "P" [1] "Z" [1] 16 [1] 0.0 -3.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] -1.52993 [1] -3.416959 3.544158 [1] "good session range" [1] "Z" [1] "P" [1] "N" [1] 17 [1] 0.0 -2.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] -1.95781 [1] -2.023462 1.701420 [1] "good session range" [1] "Z" [1] "N" [1] "N" [1] 18 [1] 0.0 -2.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] -1.297607 [1] -3.046487 3.064755 [1] "good session range" [1] "Z" [1] "P" [1] "N" [1] 19 [1] 0.0 -2.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] -0.9762451 [1] -3.869248 2.192615 [1] "good session range" [1] "Z" [1] "N" [1] "N" [1] 20 [1] 0.0 -2.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] -0.8514208 [1] -3.049752 2.945706 [1] "good session range" [1] "Z" [1] "N" [1] "N" [1] 21 [1] 0.0 -1.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] -1.574682 [1] -2.4731461 0.8878649 [1] "good session range" [1] "Z" [1] "N" [1] "N" [1] 22 [1] 0.0 -1.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] -0.4130446 [1] -3.1516918 0.9680467 [1] "good session range" [1] "Z" [1] "N" [1] "Z" [1] 23 [1] 0.0 -1.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] 0.4424255 [1] -2.981153 1.224920 [1] "good session range" [1] "Z" [1] "N" [1] "Z" [1] 24 [1] 0.0 -1.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] 0.2124438 [1] -3.446113 2.164731 [1] "good session range" [1] "Z" [1] "N" [1] "Z" [1] 25 [1] 0.0 -1.0 2.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] 0.1605535 [1] -3.907287 2.353958 [1] "good session range" [1] "Z" [1] "N" [1] "Z" [1] 26 [1] 0.0 0.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 0 [1] 0.0276948 [1] -3.9002310 0.4877465 [1] "good session range" [1] "Z" [1] "N" [1] "Z" [1] 27 [1] 1.0 -2.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] -0.1127917 [1] -1.090935 2.855060 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 28 [1] 1.0 -2.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.8302739 [1] -1.222600 3.936972 [1] "good session range" [1] "P" [1] "H" [1] "P" [1] 29 [1] 1.0 -2.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] -0.2426154 [1] -3.273365 3.791573 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 30 [1] 1.0 -1.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.4142754 [1] -1.616972 2.761942 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 31 [1] 1.0 -1.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.8873818 [1] -1.662580 2.522465 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 32 [1] 1.0 -1.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.4035628 [1] -2.160448 2.496523 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 33 [1] 1.0 -1.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] -0.1577257 [1] -2.595723 2.549830 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 34 [1] 1.0 0.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.1727251 [1] -2.910222 1.795642 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 35 [1] 1.0 0.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.4481224 [1] -2.564423 2.091738 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 36 [1] 1.0 0.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.4251769 [1] -3.410600 1.743241 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 37 [1] 1.0 1.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.3903731 [1] -3.680131 1.345420 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 38 [1] 1.0 1.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 1 [1] 0.1809219 [1] -3.500432 2.194076 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 39 [1] 2.0 -1.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 1.675592 [1] -1.145604 3.873958 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 40 [1] 2.0 -1.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 0.8989166 [1] -1.079531 3.471279 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 41 [1] 2.0 0.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 1.034103 [1] -1.954681 3.144709 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 42 [1] 2.0 0.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 1.668974 [1] -1.601887 3.223125 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 43 [1] 2.0 0.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 1.788082 [1] -2.333402 3.014041 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 44 [1] 2.0 0.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 1.223177 [1] -2.359379 3.535249 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 45 [1] 2.0 1.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 1.335744 [1] -2.451567 2.275721 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 46 [1] 2.0 1.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 0.1429083 [1] -2.962057 3.637776 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 47 [1] 2.0 1.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 2.351431 [1] -2.938208 2.708080 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 48 [1] 2.0 1.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 0.3190158 [1] -3.833067 3.218937 [1] "good session range" [1] "P" [1] "N" [1] "Z" [1] 49 [1] 2.0 2.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 1.031965 [1] -3.303636 2.479811 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 50 [1] 2.0 2.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] 2.337449 [1] -3.617166 2.337449 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 51 [1] 2.0 2.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 2 [1] -1.085172 [1] -3.661982 2.952831 [1] "good session range" [1] "P" [1] "N" [1] "N" [1] 52 [1] 3.0 0.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 3.068193 [1] -1.003855 3.855742 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 53 [1] 3.0 0.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 2.082037 [1] -0.1189785 3.8062833 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 54 [1] 3.0 0.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 3.145224 [1] -0.2566963 3.6887018 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 55 [1] 3.0 1.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 3.068464 [1] -1.345051 3.068464 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 56 [1] 3.0 1.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 1.886785 [1] -1.614477 3.815119 [1] "good session range" [1] "P" [1] "N" [1] "lP" ' [1] 57 [1] 3.0 2.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 3.197222 [1] -1.989586 3.255923 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 58 [1] 3.0 2.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 2.826725 [1] -2.169074 3.300320 [1] "good session range" [1] "P" [1] "N" [1] "P" [1] 59 [1] 3.0 2.0 1.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 2.394505 [1] -3.793030 3.316118 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 60 [1] 3.0 3.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 1.941454 [1] -3.081294 3.000000 [1] "good session range" [1] "P" [1] "N" [1] "lP" ' [1] 61 [1] 3.0 3.0 1.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 3 [1] 1.241803 [1] -2.894 3.000 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 62 [1] 4.0 2.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 4 [1] 2.454107 [1] -1.330554 4.000000 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 63 [1] 4.0 4.0 0.5 0.3 0.8 3.0 2.5 0.1 2.0 [1] 4 [1] 2.831316 [1] -2.955293 4.000000 [1] "good session range" [1] "P" [1] "N" [1] "lP" [1] 64 [1] 4.0 5.0 0.0 0.3 0.8 3.0 2.5 0.1 2.0 [1] 4 [1] 3.10647 [1] -3.922585 4.000000 [1] "good session range" [1] "P" [1] "N" [1] "lP" > # } > dev.off() (the above closes the *.pdf file so that you can look at it) null device 1 > > > (the graphic output to match this console data output is contained in the *.pdf file designated in the graphic output section above. The line is reproduced below: > setwd("F:/York University/York University Courses/Fall-Winter 2011-12/4th Yr Thesis/Thesis - Dr. John Eastwood/R/Programs/Development of PNP Evaluation Routine/pdf outputs") > pdf(file="PNP-Eval-5.pdf",width= 12, height= 12, family = "Helvetica", title = "MBF Data",bg="white") (the first ine above sets the working directory for the graphical output. This needs to specify a subdirectory on your own computer. The second line names the *.pdf file for output and sets a few of its parameters. Unless you write some code to change the file name, this has to be changed manually each time you run it, or it will overwrite the last file output. Alternately, leave the output file as constant and rename the output file in your computer immediately after it is produced.) (the graphic output file shows the number of the time series in the title of the third graph, so that it can be compared to the data in the console output shown above. With a little work the output could be made more useful and elegant. The four graphs shown on the *.pdf output are the simulated client random component, the simulated therapist random component, the simulated client self-directed affect, and the simulated therapist performance.)