New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Ms. Bart Lind


Ms. Bart Lind
GPA 3.86


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Quantitative Ecology And Resource Management

This 7 page Class Notes was uploaded by Ms. Bart Lind on Wednesday September 9, 2015. The Class Notes belongs to QERM 514 at University of Washington taught by Staff in Fall. Since its upload, it has received 13 views. For similar materials see /class/192195/qerm-514-university-of-washington in Quantitative Ecology And Resource Management at University of Washington.




Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/09/15
SPLUS Notes SPLUS is a software package provides a programming environment for data analysis User39s can visually explore and thoroughly analyze data SPLUS provides builtin functions for creating many useful graphical displays There are also builtin functions for statistical summaries as well as for classical and modern modeling techniques This allows one to perform advanced exploratory and confirmatory data analyses Additional References These notes are intended as an introductory reference to get you started with SPLUS There are a number of other references that provide details on using and programming in SPLUS These include Manuals SPLUS Software manuals are distributed with the product The main manuals include a User39s Guide a Programmer39s Guide and A Guide to Statistical Analysis Books 1 The New 8 language by Richard Becker John Chambers and Allan Wilks part of the Wadsworth amp BrooksCole Computer Science Series for more information about S Copies are available at the University Bookstore and can sometimes be found in the Sun Room where Hemlock is 2 Modern Applied Statistics with SPLUS 2 edition by Venables and Ripley This is part of the Springer Verlag Statistics and Computing Series 3 The Basics ofS and SPLUS by Krause This is part of the SpringerVerlag Statistics and Computing Series web sites S news The following is the snews description of objectives and appropriate use Snews is the discussion group on the S and Splus systems for statistics graphics and programming Appropriate topics must be related to SSplus including programming and usage questions and suggestions problem reports and announcements of new software contributed and commercial books and articles and conferences and educational events Short job announcements are also acceptable Long advertisements and commercial messages that are not specifically relevant to SSplus are not acceptable To subscribe send an email to snews re uests wubioswust1edu With subscribe snews ltyour email addressgt as the first line of the message For posting to the list send email to snewswubioswustledu In general most functions can be performed both through the windows interface and the command line find some functions to be more convenient using the pulldown menus while others are more easily performed using the command line Below I try to give options for both Working database Each SPlus session begins with a default list of attached databases which you can view using SearchPath from the left pane ofthe Object Browser or use search command gt search These databases contain the core SPlus functions and sample data The first database listed is the working directory for the current session to which an objects created will be written These objects are always saved in that database from one session to the next unless you remove them You can use the Object Browser to view all of the objects in the database which works like a Windows explorer interface You can also view the list using the objects command gt objects You can also perform some database management functions with the command line attach attaches another database or object to the current session search list detach detaches another database or object from the current session assign saves an object to a specific database get used to get an object from a specific database rm removes one or more objects from a database VVVVV To exit SPlus just go to File Exit To get help you can either search the help menu or if you know the function name you can type gt plot The args command will list the arguments of a function without opening the help file gt args plot SPLUS Objects SPLUS operates on data objects An object is created as the result of evaluating an SPLUS expression Each object has an associated data type SPLUS has a wide variety of data types Numerical data is most often stored as vectors a scalar variable is a vector variable of dimension one matrices or data frames Other types include factors and lists factors are used to represent categorical data lists are the most general data type for storing arbitrary collections of data Assignment scalar a lt 5 assigns the value 5 to object a vector a lt c5 6 112 assigns the vector 56112 to object a a lt c05 assigns the vector 01 2345 to object a Data Frames Data frames are used to store a data matrix much like an Excel spreadsheet Data columns must be ofthe same length although they may be of different types To create a data frame just go to File New data set and a new window will appear You can hand enter the data or copy and paste columns from an Excel Spreadsheet You can assign column names by double clicking the empty grey cell under the column number To change the type of data in a column select the column then right click and select Change Data Type You can also select the column and go to Data change data type Data frames are what are most used for creating plots and model objects either from the command line or using the pulldown menus You can also create data frames from the command line Xllt c 10158 12 0 X2lt c 8 16 13 16 15 X3lt c 7 1320 1925 Clltc AMHI quotAMquot quotPMquot quotAMquot quotPDI Specieslt c JUHY quotCARMEquot quotSTVUquot quotPADOquot quotCAPI Birdslt data frame cntlXl cnt2X2 cnt3X3 periodCl row namesSpecies VVVVVV The Birds data frame object is now created and can be accessed from the command line or by doubleclicking it on the Object Explorer If you create a new data frame using pulldown menus SPlus automatically gives them a name like SDF l You can rename the object in the Object Explorer by selecting the object right clicking then selecting Properties matrix a lt matrixdata nrow ncol byrowFALSE dimnames where data is a vector which contains the data values for the matrix in normal array order ie the first subscript varies most rapidly nrow is the first subscript number of rows nco is the second subscript number of columns byrow is a flag if TRUE the data values are assumed to be the first row then the second row etc If FALSE the values are assumed to be the first column then the second column etc dimnames is an optional list of length 2 giving a dimnames attribute for the matrix NOTE byrow should be TRUE ifthe data values were read from a file arranged by rows If one of nrow or nco is omitted the dimensions ofthe matrix are determined by the other argument and the length of data See Reading External Data Files39 below array a lt arraydata c5043 creates a 50 x 4 x 3 array of data where data is as described above in the matrix description Creating MatricesArrays from vectors if a b and c are 1 x n vectors then d lt cbindabc d is the n x 3 matrix whose columns are a b c e lt rbindabc e is the 3 x n matrix whose rows are a b c Viewing Objects The contents of any object can be observed by simply typing the name ofthe object at the prompt gt8 n012s45 the 1 denotes the next element as being the first element ofthe displayed data This labeling ofthe first element of each display row is beneficial when viewing long vectors of data A listing of all objects in the current working directory can be obtained by typing gtobjects Manipulating Data Operators Arithmetic quot exponentiation integerdivision remainder or modulo examples gt34quot12 116 gt106 1 1 gt106 114 Comparison gt lt gt lt not equal These return T or F Logical amp and or not Subscripting Vectors can be manipulated as whole objects gta lt c56112 gta10 15060112 or component wise via subscript notation gta23 2 23 is read as components 2 through 3 1 80 132 gta3 3 3 means all components but the third 1 15 18 Mathematical Functions Include sqrt abs absolute value sin cos tan asin acos atan sinh cosh tanh etc all in radians exp log og10 gamma gammax1 is x etc Matrix Functions matrix multiplication tM transpose appyX margin fun applies the function fun to the rows or columns of array X dictated in margin etc Graphics Devices To receive graphical output on your terminal you must first tell SPLUS what sort of graphics device you plan to use If you are working under Open Windows on a Sun workstation enter quotmotifquot If you want the plots sent to a Postscript file to be printed out on the laser printer then type quotpostscriptquot at the SPLUS prompt This will send all plots during this session to the file psoutxxxxps which can subsequently be printed from Unix At some point you might want to explore quottreisdevicequot Basic Functions Let XY be vectors of data values plotXYtypequotpquot plots the components of the vector X against the corresponding components of the vector Y and denotes each coordinate pair by points the default type The other type options include quotIquot for lines quotbquot for both ablineab plots the line defined by the intercept a and the slope b If a and b are yet unknown abline lmYX will add the least square fit line to the current plot linesXYtypequotlquot overlays the 39line39 defined by the coordinates of points XY onto the current graph pointsXYtypequotpquot overlays the coordinate points XY onto the current graph matplotXY typequotlquot lty1 5 X Y vectors or matrices of data for plotting The first column of X is plotted against the first column of Y the second column ofX against the second column of Y etc If one matrix has fewer columns plotting will cycle backthrough the columns again Type dictates the type of plot points lines etc as discussed above lty is an optional vector of line types The first element is the line type for the first line etc Line types will be used cyclically until all plots are drawn matpointsXYtypequotpquotpch As above plots the points defined by X and Y described in matplot onto the current plot pchquotcquot sets the plotting character to be c for example matlinesXYtypequotlquotlty As above plots the lines39 defined by the points derived from X and Y onto the current graph lty defines the vector of line types to use for each plot Other arguments that may be passed to the plot command The following arguments can be included with plotting functions which create whole new graphs such as plot matplot hist etc xlabquotlabe for the xaxisquot ylabquotlabe for the yaxisquot axesTRUEFALSE lf axesTRUE then an enclosing box tick marks and axis labels will be plotted mainquottitle printed at the top of a graphquot subquotsubtitle printed at the bottom of a plotquot xlimcxminxmax Sets the limits of the xaxis between xmin and xmax ylimcyminymax Sets the limits of the yaxis between ymin and ymax legendX Y lnames lty pch creates a legend box on a plot XY are coordinates of two opposite corners of the rectangular area ofthe plot which is to contain the legend lnames is a vector of text strings to be associated with the line types or plotting characters lty or pch is the vector of line types or plotting characters used in the plot par This command is extremely useful providing control over many additional plotting parameters One common use is for creating a page with multiple plots For example parmfrowc32 will create a graphics page with 6 plots in a layout of 3 rows and 2 columns Check out the help file for more details Other plotting functions boxplot hist barplot pairs qqnorm qqline qqplot Statistical Functions SPLUS is a statistical package hence the statistical capabilities are well developed This is just a brief introduction to some of the commands Basic Summary Statistics meanX medianX sumX prodX varXY corXY varX returns the covariance matrix of X ifX is a matrix orthe variance of X if X is a vector tc Distributions There are functions for calculating values from common probability distributions There are 4 basic functions for each distribution pnorm25 computes probabilities from the cdf probability that a value from a normal0 l distribution is lt 25 qnormx computes quantiles from the inverse cdf xth quantile of normal0 l distribution dnormx computes density values density at X of normal0 l distribution rnorm1001 generates random numbers generates 10 random numbers from a N01 distribution Models Some ofthe common modeling functions include lmYX Fits a linear model where Y is the response and X is a predictor aov Fits analysis of variance models glm Fits a generalized linear model gam Fits a generalized additive model loess Fits a local regression model nls Fits a nonlinear model Getting Help Most of the SPLUS functions have associated help files These files provide a brief description of the function followed by the syntax and a description of the arguments and return values Most help files also include references examples and a see also section for related functions For many ofthe statistical functions specific algorithm details are described Help for an individual function gt plot The args functions is useful for getting a listing of a given functions arguments without opening the help file gt argsplot Miscellaneous Writing functions SPLUS is a programming language Customized functions can be written SPLUS supports iteration recursion and calls to already defined SPLUS functions Saving objects SPLUS stores objects in a Data subdirectory from which the interactive SPLUS session was initiated These objects therefore persist from one session to the next and can be easily reused as this directory is read in automatically if it exists every time an SPLUS session is initiated Reading External Files sourcequotcmdfilequot causes SPLUS to read in all expressions in the file cmd e and evaluate them as ifthey had been typed by the user All expressions in the file must execute correctly or none of the assignments done inside the file will be saved Sending Output to an External File sinkquot enamequot redirects SPLUS output to enarne rather than to the terminal This can be cancelled by typing sink Reading External Data Files Formatted data files external to SPLUS can be read in using the scan or the readtable commands For example M lt matrixscan39datafile39ncol3 byrowT will assign the n X 3 matrix of data in the file datafile assumed to be in the same directory as SPLUS was initiated from otherwise you must specify the relative pathname to the data file to the matrix M Going between SPlus and document files Reports If you use the pulldown menus to perform your analysis eg linear modeling the output is produced in a report file like a simple text file You can save the report as an SPlus report file srp or saveas a text file txt You can open the simple text file in your word processing program and use the output to create any necessary tables for your paper If you work from the command line your outputs are shown in the command window You can open a new report file from File9New9report file then copy and paste from the command window to the report window You can also directly copy and paste from the commands window to a Word document Graphics Once you ve created a plot in SPlus you can put it into a document two ways The simplest way would be to select the plot and copy it to the clipboard then paste it into your document Copying in this manner however tends to make your document large in terms of memory A more economical method would be to export the plot into an image file File Export graph You need to select a file format for the image file I usually use Windows metafile wmf You can then import the image file into your document Importing data les File lmport Data From file It is easiest to select File type All files lfthe file has text in the first line it is best to open the data file in Notepad and delete the text then save the file then import it


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.