c# free pdf viewer : Add page numbers pdf files software application project winforms html azure UWP R-intro5-part792

Chapter10: Writingyourownfunctions
45
N <- table(blocks, varieties)
A <- 1/sqrt(K) * * N N * rep(1/sqrt(R), rep(b, v))
sv <- - svd(A)
list(eff=1 - sv$d^2, blockcv=sv$u, varietycv=sv$v)
}
Itisnumericallyslightlybettertoworkwiththesingularvaluedecompositiononthisoccasion
ratherthantheeigenvalueroutines.
Theresultofthefunctionisalistgivingnotonlytheefficiencyfactorsasthefirstcomponent,
butalsotheblockandvarietycanonicalcontrasts,sincesometimesthesegiveadditionaluseful
qualitativeinformation.
10.6.2 Droppingallnamesinaprintedarray
Forprintingpurposeswithlargematricesorarrays,itisoftenusefultoprintthemincloseblock
formwithoutthearraynamesornumbers. Removingthe e dimnamesattributewillnotachieve
thiseffect,butratherthearraymustbegivenadimnamesattributeconsistingofemptystrings.
Forexampletoprintamatrix,X
> temp p <- - X
> dimnames(temp) ) <- list(rep("", nrow(X)), , rep("", , ncol(X)))
> temp; ; rm(temp)
Thiscanbemuchmoreconvenientlydoneusingafunction,no.dimnames(),shownbelow,
asa“wraparound”toachievethesameresult.Italsoillustrateshowsomeeffectiveanduseful
userfunctionscanbequiteshort.
no.dimnames <- function(a) ) {
## Removealldimensionnamesfromanarrayforcompactprinting.
d <- list()
l <- 0
for(i in dim(a)) {
d[[l <- l + + 1]] ] <- rep("", i)
}
dimnames(a) <- d
a
}
Withthisfunctiondefined,anarraymaybeprintedincloseformatusing
> no.dimnames(X)
Thisisparticularlyusefulforlargeintegerarrays,wherepatternsaretherealinterestrather
thanthevalues.
10.6.3 Recursivenumericalintegration
Functions may y be recursive, and may themselves define functions s within n themselves. . Note,
however,thatsuchfunctions,orindeedvariables,arenotinheritedbycalledfunctionsinhigher
evaluationframesastheywouldbeiftheywereonthesearchpath.
Theexamplebelowshowsanaivewayofperformingone-dimensionalnumericalintegration.
Theintegrandisevaluatedattheendpointsoftherangeandinthemiddle. Iftheone-panel
trapeziumruleansweriscloseenoughtothetwopanel,thenthelatterisreturnedasthevalue.
Otherwise the same e process s is s recursively y appliedto o each panel. . The e result is s an adaptive
integration process that concentrates s function n evaluations in regions where the integrand is
farthestfromlinear.Thereis,however,aheavyoverhead,andthefunctionisonlycompetitive
withotheralgorithmswhentheintegrandisbothsmoothandverydifficulttoevaluate.
TheexampleisalsogivenpartlyasalittlepuzzleinRprogramming.
area <- - function(f, a, b, eps = = 1.0e-06, , lim = 10) {
Add page numbers pdf files - insert pages into PDF file in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Guide C# Users to Insert (Empty) PDF Page or Pages from a Supported File Format
add and delete pages in pdf; add page break to pdf
Add page numbers pdf files - VB.NET PDF Page Insert Library: insert pages into PDF file in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Easy to Use VB.NET APIs to Add a New Blank Page to PDF Document
add page number to pdf reader; add pdf pages to word
Chapter10: Writingyourownfunctions
46
fun1 <- - function(f, , a, b, fa, , fb, , a0, eps, lim, fun) {
## function‘fun1’isonlyvisibleinside‘area’
d <- (a + b)/2
h <- (b - a)/4
fd <- - f(d)
a1 <- - h h * (fa + fd)
a2 <- - h h * (fd + fb)
if(abs(a0 - - a1 1 - - a2) ) < < eps s || lim m == = 0)
return(a1 + + a2)
else {
return(fun(f, a, d, fa, fd, a1, , eps, lim m - - 1, , fun) ) +
fun(f, d, b, fd, fb, a2, , eps, lim m - - 1, , fun))
}
}
fa <- - f(a)
fb <- - f(b)
a0 <- - ((fa a + + fb) * * (b - - a))/2
fun1(f, a, b, fa, , fb, , a0, , eps, lim, , fun1)
}
10.7 Scope
Thediscussioninthissectionissomewhatmoretechnicalthaninotherpartsofthisdocument.
However,itdetailsoneofthemajordifferencesbetweenS-PlusandR.
Thesymbolswhichoccurinthebodyofafunctioncanbedividedintothreeclasses;formal
parameters,localvariables andfreevariables. . The e formalparametersofafunctionarethose
occurringintheargument list ofthefunction. . Theirvaluesaredeterminedbytheprocessof
bindingtheactualfunctionargumentstotheformalparameters.Localvariablesarethosewhose
valuesaredeterminedbytheevaluationofexpressionsinthebodyofthefunctions. Variables
whicharenotformalparametersorlocalvariablesarecalledfreevariables.Freevariablesbecome
localvariablesiftheyareassignedto. Considerthefollowingfunctiondefinition.
f <- function(x) ) {
y <- 2*x
print(x)
print(y)
print(z)
}
Inthisfunction,xisaformalparameter,yisalocalvariableandzisafreevariable.
InRthefreevariablebindingsareresolvedbyfirstlookingintheenvironmentinwhichthe
functionwascreated.Thisiscalledlexicalscope. Firstwedefineafunctioncalledcube.
cube <- - function(n) {
sq <- - function() n*n
n*sq()
}
Thevariableninthefunctionsqisnotanargumenttothatfunction. Thereforeitisafree
variableandthescopingrulesmustbeusedtoascertainthevaluethatistobeassociatedwith
it. Understaticscope(S-Plus) ) thevalue isthat associatedwithaglobalvariable namedn.
Underlexicalscope(R)itistheparametertothefunctioncubesincethatistheactivebinding
forthevariablenatthe timethefunctionsqwasdefined. . Thedifferencebetweenevaluation
inRandevaluationinS-PlusisthatS-PluslooksforaglobalvariablecallednwhileRfirst
looksforavariablecallednintheenvironmentcreatedwhencubewasinvoked.
C# Create PDF Library SDK to convert PDF from other file formats
them the ability to count the page numbers of generated metadata adding control, you can add some additional Create PDF Document from Existing Files Using C#.
add pdf pages together; add page numbers to a pdf
C# Word - Word Create or Build in C#.NET
also offer them the ability to count the page numbers of generated using this Word document adding control, you can add some additional Create Word From PDF.
add page numbers to pdf in preview; add a page to a pdf
Chapter10: Writingyourownfunctions
47
## firstevaluationinS
S> cube(2)
Error in sq(): Object "n" not found
Dumped
S> n n <- - 3
S> cube(2)
[1] 18
## thenthesamefunctionevaluatedinR
R> cube(2)
[1] 8
Lexicalscope canalso be usedto give functions s mutable e state. . In n the followingexample
weshowhow Rcanbe usedtomimicabank account. . Afunctioningbankaccount t needsto
haveabalanceortotal,afunctionformakingwithdrawals,afunctionformakingdepositsand
a function for stating g the e current balance. . We e achieve this by y creating g the three functions
withinaccountandthenreturningalistcontainingthem. Whenaccountisinvokedittakes
anumericalargument total andreturns alistcontaining thethreefunctions. . Becausethese
functionsaredefinedinanenvironmentwhichcontainstotal,theywillhaveaccesstoitsvalue.
The specialassignment operator,<<-, isusedtochangethe valueassociatedwith total.
Thisoperatorlooksbackinenclosingenvironmentsforanenvironmentthatcontainsthesymbol
totalandwhenitfindssuchanenvironmentitreplacesthevalue,inthatenvironment,with
thevalueofrighthandside. Iftheglobalortop-levelenvironmentisreachedwithout t finding
thesymboltotalthenthatvariableiscreatedandassignedtothere.Formostusers<<-creates
aglobalvariableandassignsthevalueoftherighthandsidetoit
2
. Onlywhen<<-hasbeen
usedinafunctionthatwasreturnedasthevalueofanotherfunctionwillthespecialbehavior
describedhereoccur.
open.account <- function(total) {
list(
deposit = function(amount) {
if(amount <= = 0)
stop("Deposits must be positive!\n")
total <<- - total l + + amount
cat(amount, "deposited. . Your r balance is", , total, , "\n\n")
},
withdraw = = function(amount) ) {
if(amount > > total)
stop("You don’t t have e that much money!\n")
total <<- - total l - - amount
cat(amount, "withdrawn. . Your r balance is", , total, , "\n\n")
},
balance = function() {
cat("Your balance is", , total, "\n\n")
}
)
}
ross <- - open.account(100)
robert <- - open.account(200)
ross$withdraw(30)
2
InsomesensethismimicsthebehaviorinS-PlussinceinS-Plusthisoperator alwayscreatesorassignsto
aglobalvariable.
C# PowerPoint - PowerPoint Creating in C#.NET
New PowerPoint File and Load PowerPoint from Other Files. them the ability to count the page numbers of generated creating toolkit, if you need to add some text
add page numbers to pdf document; add document to pdf pages
C# Word - Word Creating in C#.NET
to Create New Word File and Load Word from Other Files. them the ability to count the page numbers of generated creating toolkit, if you need to add some text
add page to pdf; add multi page pdf to word document
Chapter10: Writingyourownfunctions
48
ross$balance()
robert$balance()
ross$deposit(50)
ross$balance()
ross$withdraw(500)
10.8 Customizingtheenvironment
Userscancustomizetheir environmentinseveraldifferentways. . Thereisa a siteinitialization
fileandeverydirectorycanhaveitsownspecialinitializationfile.Finally,thespecialfunctions
.Firstand.Lastcanbeused.
ThelocationofthesiteinitializationfileistakenfromthevalueoftheR_PROFILEenvironment
variable.Ifthatvariableisunset,thefileRprofile.siteintheRhomesubdirectoryetcisused.
ThisfileshouldcontainthecommandsthatyouwanttoexecuteeverytimeRisstartedunder
yoursystem.Asecond,personal,profilefilenamed.Rprofile
3
canbeplacedinanydirectory.If
Risinvokedinthatdirectorythenthatfilewillbesourced.Thisfilegivesindividualuserscontrol
overtheirworkspaceandallowsfordifferentstartupproceduresindifferentworkingdirectories.
Ifno.Rprofilefileisfoundinthestartupdirectory,thenRlooksfora.Rprofilefileinthe
user’shomedirectoryandusesthat(ifitexists). IftheenvironmentvariableR_PROFILE_USER
isset,thefileitpointstoisusedinsteadofthe.Rprofilefiles.
Any functionnamed.First()ineitherofthetwoprofilefilesorinthe.RDataimagehas
aspecialstatus. It t isautomatically performedat the beginning ofan n Rsessionandmaybe
usedtoinitializetheenvironment. Forexample,thedefinitionintheexamplebelowaltersthe
promptto$andsetsupvariousotherusefulthings thatcanthenbetakenforgrantedinthe
restofthesession.
Thus,thesequenceinwhichfilesareexecutedis,Rprofile.site,theuserprofile,.RData
andthen.First().Adefinitioninlaterfileswillmaskdefinitionsinearlierfiles.
> .First t <- function() {
options(prompt="$ ", continue="+\t") ) # # $istheprompt
options(digits=5, length=999)
# customnumbersandprintout
x11()
# forgraphics
par(pch = = "+")
# plottingcharacter
source(file.path(Sys.getenv("HOME"), "R", "mystuff.R"))
# mypersonalfunctions
library(MASS)
# attachapackage
}
Similarlyafunction.Last(),ifdefined,is(normally)executedattheveryendofthesession.
Anexampleisgivenbelow.
> .Last t <- function() {
graphics.off()
# asmallsafetymeasure.
cat(paste(date(),"\nAdios\n"))
# Isittimeforlunch?
}
10.9 Classes,genericfunctionsandobjectorientation
Theclassofanobjectdetermineshowitwillbetreatedbywhatareknownasgenericfunctions.
Puttheotherwayround,agenericfunctionperformsataskoractiononitsargumentsspecific
tothe class s of f the argument itself. . If f the argument lacks anyclassattribute,or has aclass
3
SoitishiddenunderUNIX.
C# Excel - Excel Creating in C#.NET
to Create New Excel File and Load Excel from Other Files. them the ability to count the page numbers of generated creating toolkit, if you need to add some text
add contents page to pdf; add page numbers to pdf online
VB.NET TIFF: VB.NET Sample Codes to Sort TIFF File with .NET
to sort a multi-page TIFF file with page numbers using VB define the orders for the TIFF file page sorting by pageCount - 1 To 0 Step -1 newOrders.Add(i) Next
add page to pdf preview; add pages to pdf acrobat
Chapter10: Writingyourownfunctions
49
notcateredforspecificallybythegenericfunctioninquestion,thereisalwaysadefault action
provided.
Anexamplemakesthingsclearer.Theclassmechanismofferstheuserthefacilityofdesigning
andwritinggenericfunctionsforspecialpurposes.Amongtheothergenericfunctionsareplot()
for displaying objects graphically, , summary() ) for summarizing analyses of various types,and
anova()forcomparingstatisticalmodels.
Thenumberofgenericfunctionsthatcantreataclassinaspecificwaycanbequitelarge.
Forexample,thefunctionsthatcanaccommodateinsomefashionobjectsofclass"data.frame"
include
[
[[<-
any
as.matrix
[<-
mean
plot
summary
Acurrentlycompletelistcanbegotbyusingthemethods()function:
> methods(class="data.frame")
Conversely the number of classes s a a generic c function can handle can also o be quite e large.
For example the plot() function has a default method and variants for r objects s of classes
"data.frame","density","factor",and more. . Acomplete e list canbegot again by using
themethods()function:
> methods(plot)
Formanygenericfunctionsthefunctionbodyisquiteshort,forexample
> coef
function (object, ...)
UseMethod("coef")
ThepresenceofUseMethodindicatesthisisagenericfunction.Toseewhatmethodsareavailable
wecanusemethods()
> methods(coef)
[1] coef.aov*
coef.Arima*
coef.default*
coef.listof*
[5] coef.nls*
coef.summary.nls*
Non-visible functions are asterisked
Inthisexampletherearesixmethods,noneofwhichcanbeseenbytypingitsname. Wecan
readthesebyeitherof
> getAnywhere("coef.aov")
A single e object t matching g ’coef.aov’ was found
It was found d in the e following places
registered S3 method d for r coef from m namespace stats
namespace:stats
with value
function (object, ...)
{
z <- object$coef
z[!is.na(z)]
}
> getS3method("coef", , "aov")
function (object, ...)
{
z <- object$coef
z[!is.na(z)]
C#: Use XImage.OCR to Recognize MICR E-13B, OCR-A, OCR-B Fonts
may need to scan and get check characters like numbers and codes. page.RecSettings. LanguagesEnabled.Add(Language.Other); page.RecSettings.OtherLanguage
add page numbers pdf files; add a page to pdf file
VB.NET Excel: VB Methods to Set and Customize Excel Rendering
treat every single Excel spreadsheet as a page in our An image consists of large numbers of dots, and the Our Excel converting add-on for VB.NET still supports
adding page numbers to pdf in; adding page numbers to a pdf document
50
}
Afunctionnamedgen.clwillbeinvokedby the genericgenforclasscl,sodonot name
functionsinthisstyleunlesstheyareintendedtobemethods.
Thereader isreferredtotheR Language Definition n for r amorecompletediscussionofthis
mechanism.
C# Excel: Create and Draw Linear and 2D Barcodes on Excel Page
barcode image to the first page page.AddImage(barcodeImage C#.NET Excel Barcode Creating Add-on imaging controls, PDF document, image to pdf files and components
add page number to pdf file; adding page numbers to a pdf in preview
VB.NET Image: Guide to Convert Images to Stream with DocImage SDK
Follow this guiding page to learn how to easily convert a single image or numbers of it an image processing component which can enable developers to add a wide
adding page numbers pdf; add page number to pdf hyperlink
51
11 StatisticalmodelsinR
Thissectionpresumesthereaderhassomefamiliaritywithstatisticalmethodology,inparticular
withregressionanalysisandtheanalysisofvariance.Laterwemakesomerathermoreambitious
presumptions,namelythatsomethingisknownaboutgeneralizedlinearmodelsandnonlinear
regression.
Therequirementsforfittingstatisticalmodelsaresufficientlywelldefinedtomakeitpossible
toconstructgeneraltoolsthatapplyinabroadspectrumofproblems.
Rprovidesaninterlockingsuiteoffacilitiesthatmakefittingstatisticalmodelsverysimple.
Aswementionintheintroduction,thebasicoutputis minimal,andoneneedstoaskforthe
detailsbycallingextractorfunctions.
11.1 Definingstatisticalmodels;formulae
Thetemplateforastatisticalmodelisalinearregressionmodelwithindependent,homoscedastic
errors
y
i
=
p
X
j=0
j
x
ij
+e
i
;
e
i
NID(0;
2
);
i=1;:::;n
Inmatrixtermsthiswouldbewritten
y=X+e
wheretheyis the responsevector,X X is s themodel matrix x or r designmatrix x andhas s columns
x
0
;x
1
;:::;x
p
,the determining variables. . Very y often n x
0
willbea columnofones definingan
intercept term.
Examples
Beforegivingaformalspecification,afewexamplesmayusefullysetthepicture.
Supposey,x,x0,x1,x2,...arenumericvariables,XisamatrixandA,B,C,...arefactors.
Thefollowingformulaeontheleftsidebelowspecifystatisticalmodelsasdescribedontheright.
y~x
y~1+x
Bothimplythe same simplelinear regressionmodel of y onx. . The e first has an
implicitinterceptterm,andthesecondanexplicitone.
y~0+x
y~-1+x
y~x-1
Simplelinearregressionofyonxthroughtheorigin(thatis,withoutanintercept
term).
log(y)~x1+x2
Multiple regression n of the e transformed variable, log(y), on x1 and d x2 (with an
implicitinterceptterm).
y~poly(x,2)
y~1+x+I(x^2)
Polynomialregressionofyonxofdegree2.Thefirstformusesorthogonalpolyno-
mials,andthesecondusesexplicitpowers,asbasis.
y~X+poly(x,2)
Multiple regression y y with model l matrix x consisting of the matrix X X as s well l as
polynomialtermsinxtodegree2.
Chapter11: StatisticalmodelsinR
52
y~A
Singleclassificationanalysisofvariancemodelofy,withclassesdeterminedbyA.
y~A+x
Single classificationanalysisof covariancemodelofy,withclassesdeterminedby
A,andwithcovariatex.
y~A*B
y~A+B+A:B
y~B%in%A
y~A/B
Two factornon-additivemodelofy onAandB. . Thefirsttwo o specify thesame
crossedclassificationandthesecondtwospecifythesamenestedclassification. In
abstracttermsallfourspecifythesamemodelsubspace.
y~(A+B+C)^2
y~A*B*C-A:B:C
Threefactorexperimentbutwithamodelcontainingmaineffectsandtwofactor
interactionsonly. Bothformulaespecifythesamemodel.
y~A*x
y~A/x
y~A/(1+x)-1
Separate simple e linear r regression models of y on x x within the levels of A, with
different codings. . The e last formproduces explicit estimates of as many different
interceptsandslopesastherearelevelsinA.
y~A*B+Error(C)
Anexperimentwithtwotreatmentfactors,AandB,anderrorstratadetermined
byfactorC.Forexampleasplitplotexperiment,withwholeplots(andhencealso
subplots),determinedbyfactorC.
The operator r ~ ~ is usedto define a model l formula in R. The e form,for an ordinary linear
model,is
response ~ op_1 1 term_1 1 op_2 term_2 2 op_3 3 term_3 ...
where
response
isavectorormatrix,(orexpressionevaluatingtoavectorormatrix)definingthe
responsevariable(s).
op
i
isanoperator,either +or -,implyingtheinclusionor exclusionof aterminthe
model,(thefirstisoptional).
term
i
iseither
 avectorormatrixexpression,or1,
 afactor,or
 aformula a expression n consisting g of factors, vectors or matrices connected by
formulaoperators.
In all cases each term defines a collection of columns either to o be added d to or
removedfromthe modelmatrix. . A A 1 1 stands for anintercept column n and is s by
defaultincludedinthemodelmatrixunlessexplicitlyremoved.
The formula operators s aresimilarineffect t totheWilkinsonandRogers notationusedby
suchprogramsasGlimandGenstat.Oneinevitablechangeisthattheoperator‘.’becomes‘:’
sincetheperiodisavalidnamecharacterinR.
Thenotationissummarizedbelow(basedonChambers&Hastie,1992,p.29):
Y~M
Y ismodeledasM.
M_1+M_2 IncludeM
1andM
2.
Chapter11: StatisticalmodelsinR
53
M_1-M_2 IncludeM
1leavingouttermsofM
2.
M_1:M_2 ThetensorproductofM
1andM
2.Ifbothtermsarefactors,thenthe“subclasses”
factor.
M_1%in%M_2
SimilartoM_1:M_2,butwithadifferentcoding.
M_1*M_2 M_1+M_2+M_1:M_2.
M_1/M_2 M_1+M_2%in%M_1.
M^n
AlltermsinM togetherwith“interactions”uptoordern
I(M)
InsulateM. InsideMalloperatorshavetheirnormalarithmeticmeaning,andthat
termappearsinthemodelmatrix.
Notethatinsidetheparenthesesthatusuallyenclosefunctionargumentsalloperatorshave
theirnormalarithmeticmeaning. ThefunctionI()isanidentityfunctionusedtoallowterms
inmodelformulaetobedefinedusingarithmeticoperators.
Note particularly that t the e model formulae specify y the columns of the model matrix, , the
specificationoftheparametersbeingimplicit. Thisisnotthecaseinothercontexts,forexample
inspecifyingnonlinearmodels.
11.1.1 Contrasts
Weneedatleastsomeideahowthemodelformulaespecifythecolumnsofthemodelmatrix.
Thisiseasyifwehavecontinuousvariables,aseachprovidesonecolumnofthemodelmatrix
(andtheinterceptwillprovideacolumnofonesifincludedinthemodel).
Whataboutak-levelfactorA? Theanswerdiffersforunorderedandorderedfactors. . For
unordered factorsk 1columnsaregeneratedfortheindicatorsofthesecond,...,kthlevels
ofthefactor. (Thustheimplicitparameterizationistocontrasttheresponseateachlevelwith
that at the first.) ) For r ordered d factors s the k 1columns s are the orthogonalpolynomials on
1;:::;k,omittingtheconstantterm.
Althoughtheanswerisalreadycomplicated,itisnotthewholestory.First,iftheintercept
isomittedinamodelthatcontainsafactorterm,thefirstsuchtermisencodedintokcolumns
giving the indicators for r all the e levels. . Second, , the whole e behavior r can n be e changed d by the
optionssettingforcontrasts. ThedefaultsettinginRis
options(contrasts = c("contr.treatment", "contr.poly"))
ThemainreasonformentioningthisisthatRandShavedifferentdefaultsforunorderedfactors,
SusingHelmertcontrasts. Soifyouneedtocompare e your results tothoseof atextbookor
paperwhichusedS-Plus,youwillneedtoset
options(contrasts = c("contr.helmert", "contr.poly"))
Thisisadeliberatedifference,astreatmentcontrasts(R’sdefault)arethoughteasierfornew-
comerstointerpret.
Wehavestillnotfinished,asthecontrastschemetobeusedcanbesetforeachterminthe
modelusingthefunctionscontrastsandC.
Wehavenot yet consideredinteractionterms: : thesegeneratetheproductsof f thecolumns
introducedfortheircomponentterms.
Althoughthedetailsarecomplicated,modelformulaeinRwillnormallygeneratethemodels
that anexpertstatisticianwouldexpect, , providedthatmarginality y is preserved. . Fitting, , for
example,amodelwithaninteractionbutnotthecorrespondingmaineffectswillingenerallead
tosurprisingresults,andisforexpertsonly.
Chapter11: StatisticalmodelsinR
54
11.2 Linearmodels
Thebasicfunctionforfittingordinarymultiplemodelsislm(),andastreamlinedversionofthe
callisasfollows:
> fitted.model l <- lm(formula, data a = = data.frame)
Forexample
> fm2 2 <- lm(y ~ ~ x1 1 + + x2, , data = = production)
wouldfitamultipleregressionmodelofyonx1andx2(withimplicitinterceptterm).
The important (but technically optional) parameter data=productionspecifiesthat any
variables needed d to construct t the model l shouldcome first fromthe production n data frame.
Thisisthe case regardlessofwhetherdataframe production hasbeenattachedonthe search
pathornot.
11.3 Genericfunctionsforextractingmodelinformation
Thevalueoflm()isafittedmodelobject;technicallyalistofresultsofclass"lm". Information
about thefittedmodelcanthen n be displayed, extracted, plottedandsoon by y using generic
functionsthatorientthemselvestoobjectsofclass"lm".Theseinclude
add1
deviance
formula
predict step
alias
drop1
kappa
print
summary
anova
effects
labels
proj
vcov
coef
family
plot
residuals
Abriefdescriptionofthemostcommonlyusedonesisgivenbelow.
anova(object_1,object_2)
Compareasubmodelwithanoutermodelandproduceananalysisofvariancetable.
coef(object)
Extracttheregressioncoefficient(matrix).
Longform:coefficients(object).
deviance(object)
Residualsumofsquares,weightedifappropriate.
formula(object)
Extractthemodelformula.
plot(object)
Producefourplots,showingresiduals,fittedvaluesandsomediagnostics.
predict(object,newdata=data.frame)
Thedataframesuppliedmusthavevariablesspecifiedwiththesamelabelsasthe
original. Thevalueis s avectorormatrixofpredictedvaluescorrespondingtothe
determiningvariablevaluesindata.frame.
print(object)
Printaconciseversionoftheobject. Mostoftenusedimplicitly.
residuals(object)
Extractthe(matrixof)residuals,weightedasappropriate.
Shortform:resid(object).
step(object)
Selectasuitablemodelbyaddingordroppingtermsandpreservinghierarchies.The
modelwiththesmallestvalueofAIC(Akaike’sAnInformationCriterion)discovered
inthestepwisesearchisreturned.
Documents you may be interested
Documents you may be interested