117 pág.

# Apostila Introdução ao R (Português)

DisciplinaBioestatística I4.650 materiais34.932 seguidores
Pré-visualização33 páginas
```SERÅ DADOÅMUITOÅ CUIDADOÅ QUANDOÅ SEÅ DEFINEMÅ OUÅ ELIMINAMÅ ATRIBUTOS\ufffdÅ POISÅ ELESÅ FAZEMÅPARTEÅINTEGRALÅDOÅOBJECTOÅUSADOÅEMÅ2\ufffd1UANDOÅAÅFUN¯«OÅATTR\ufffd	 ±ÅUSADAÅNOÅLADOÅESQUERDOÅDEÅUMÅCOMANDOÅDEÅASSIGNA¯«O\ufffdÅPODEÅSERÅUSADAÅ QUERÅ PARAÅ ASSOCIARÅ UMÅ NOVOÅ ATRIBUTOÅ QUERÅ PARAÅ ALTERARÅ UMÅ ATRIBUTOÅ EXISTENTE\ufffdÅ 0ORÅEXEMPLO\ufffd!\ufffdDWWU\ufffd]\ufffd´GLP´\ufffd\ufffd\ufffd\ufffd F\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdPERMITEÅQUEÅ2ÅTRATE ZÅCOMOÅUMAÅMATRIZÅDEÅ\ufffd\ufffdÅLINHASÅPORÅ\ufffd\ufffdÅCOLUNAS\ufffd\ufffd\ufffd\ufffd &ODVVHV\ufffdGH\ufffdREMHFWRV5MÅATRIBUTOÅESPECIALÅDESIGNADOÅPORÅCLASS \ufffdCLASSE	ÅDOÅOBJECTOÅ±ÅUSADOÅPARAÅVOCACIONARÅESSEÅOBJECTOÅPARAÅOÅESTILOÅDEÅPROGRAMA¯«OÅEMÅ2\ufffd0ORÅ EXEMPLOÅ SEÅ UMÅ OBJECTOÅ ±Å DAÅ CLASSEÅ kDATA\ufffdFRAMEl\ufffdÅ SER©Å VISUALIZADOÅ SEGUNDOÅ UMAÅDETERMINADAÅ FORMA\ufffdÅ AÅ FUN¯«OÅ PLOT\ufffd	 VISUALIZ©
LO
©Å DEÅ DETERMINADAÅ FORMA\ufffdÅ EÅ QUALQUERÅ OUTRAÅFUN¯«OÅ DEÅ USOÅ GEN±RICOÅ TALÅ COMOÅ SUMMARY\ufffd	 REAGIR«OÅ PERANTEÅ ESTEÅ OBJECTOÅ DEÅ UMAÅMANEIRAÅESPECIFICAMENTEÅORIENTADAÅPARAÅESTAÅCLASSE\ufffd0ARAÅ REMOVERÅ TEMPORARIAMENTEÅ OSÅ EFEITOSÅ DEÅ CLASSEÅ DEÅ UMÅ OBJECTO\ufffdÅ USA
\ufffdÅ &ACTORES \ufffd\ufffd
\ufffd\ufffd )DFWRUHV
NOS
EMOSÅ AÅAPRESENTAR ALGUNSÅEXEMPLOS\ufffd\ufffd\ufffd\ufffd 8P\ufffdH[HPSOR\ufffdHVSHFtILFR3UPONHAÅQUEÅSEÅDISP¼EMÅDEÅUMAÅAMOSTRAÅDEÅ\ufffd\ufffdÅPROFISSIONAISÅLIBERAISÅDEÅDIVERSOSÅDISTRITOSÅDOÅCONTINENTE\ufffdÅOÅVECTOR PROVINCIAÅCONT±MÅASÅINICIAISÅDAÅPROVµNCIA\ufffd DEÅCADAÅUMÅDOSÅELEMENTOSÅDESTAÅAMOSTRA\ufffd! SURYLQFLD\ufffd \ufffd\ufffd F\ufffd\ufffdWPG\ufffd\ufffd\ufffd \ufffdEO\ufffd\ufffd\ufffd \ufffdPLQ\ufffd\ufffd\ufffd \ufffdULE\ufffd\ufffd \ufffd\ufffd \ufffdULE\ufffd\ufffd\ufffd \ufffdED\ufffd\ufffd\ufffd \ufffdDOW\ufffd\ufffd\ufffdDOW\ufffd\ufffd\ufffd \ufffdPLQ\ufffd\ufffd\ufffd \ufffdDOJ\ufffd\ufffd\ufffd \ufffdULE\ufffd\ufffd\ufffd \ufffdDOJ\ufffd\ufffd\ufffd \ufffdPLQ\ufffd\ufffd\ufffd \ufffdPLQ\ufffd\ufffd \ufffdEO\ufffd\ufffd\ufffd \ufffdWPG\ufffd\ufffd\ufffdEO\ufffd\ufffd\ufffd \ufffdED\ufffd\ufffd\ufffd \ufffdDOW\ufffd\ufffd \ufffdDOJ\ufffd\ufffd\ufffd \ufffdPLQ\ufffd\ufffd\ufffd \ufffdULE\ufffd\ufffd\ufffd \ufffdULE\ufffd\ufffd\ufffd \ufffdDOW\ufffd\ufffd\ufffd \ufffdEO\ufffd\ufffd\ufffdEE\ufffd\ufffd\ufffd\ufffdULE\ufffd\ufffd\ufffd\ufffdDOJ\ufffd\ufffd\ufffd\ufffdDOJ\ufffd\ufffd\ufffd\ufffdEE\ufffd\ufffd0ARAÅCRIARÅUMÅFACTOR AÅPARTIRÅDOÅVECTOR PROVINCIA\ufffdÅUSA
SEÅAÅFUN¯«OÅFACTOR\ufffd	\ufffd!\ufffdISURYLQFLD\ufffd\ufffd\ufffd IDFWRU\ufffdSURYLQFLD\ufffd!ÅFUN¯«OÅPRINT\ufffd	 MANUSEIAÅOSÅFACTORESÅDEÅMODOÅESPECµFICO\ufffdÅEÅAÅSAµDAÅ±ÅAÅSEGUINTE\ufffd!\ufffdISURYLQFLD;\ufffd=ÅTMDÅBLÅÅMIN RIBÅRIBÅBAÅÅALTÅALTÅMINÅALGÅRIBÅALGÅMINÅMINÅBLÅÅTMDÅBLÅÅBAÅÅALT;\ufffd\ufffd=ÅALGÅMIN RIBÅRIBÅALTÅBLÅÅBBÅÅRIBÅALGÅALGÅBBÅ,EVELS\ufffdÅÅALGÅALTÅBAÅBBÅBLÅMIN RIBÅTMD0ARAÅOBTERÅASÅCATEGORIASÅDE UMÅFACTOR USA
OS
-ONTES\ufffdÅBA\ufffdÅ&quot;EIRAÅ!LTA\ufffdÅBB\ufffdÅ&quot;EIRAÅ&quot;AIXA\ufffdÅBL\ufffdÅ&quot;EIRAÅ,ITORAL\ufffdÅALT\ufffdÅ!LENTEJO\ufffdÅALG\ufffdÅ!LGARVE\ufffdÅRIB\ufffdÅ2IBATEJO\ufffd
\ufffdÅ &ACTORES \ufffd\ufffd
QUEÅCALCULAÅOÅVECTOR DEÅM±DIASÅDEÅCADAÅUMAÅDASÅCATEGORIAS\ufffd!\ufffdUHQGDPHGLDALG ALT BA BB BL MIN RIB TMDÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅ \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd!Å FUN¯«OÅ TAPPLY\ufffd	 APLICAÅ UMAÅ FUN¯«O\ufffdÅ NESTEÅ CASOÅ AÅ FUN¯«OÅMEAN\ufffd	\ufffdÅ AÅ CADAÅ GRUPOÅ DEÅELEMENTOSÅ DOÅ PRIMEIROÅ ARGUMENTOÅ \ufffdVECTOR RENDIMENTO	\ufffdÅDEFINIDOSÅ PELOSÅ NµVEISÅ OUÅ CATEGORIASÅDOÅSEGUNDOÅ ARGUMENTOÅ \ufffdVECTORÅ FPROVINCIA	\ufffdÅ COMOÅ SEÅ CADAÅ GRUPOÅ FOSSEÅ UMÅ VECTORÅ PORÅ SIÅ Sº\ufffdÅ /ÅRESULTADOÅ±ÅUMAÅESTRUTURAÅCUJOÅCOMPRIMENTOÅ±ÅOÅNÁMEROÅDEÅCATEGORIASÅDOÅFACTOR\ufffdÅ6EJAÅAÅAJUDAÅASSOCIADAÅAÅTAPPLY\ufffd	 PARAÅMAISÅDETALHES\ufffd3UPONHAÅ AGORA QUEÅ PRETENDEMOSÅ CALCULARÅ OSÅ ERROS
PADR«OÅDAÅM±DIAÅDEÅUMÅ VECTOR NUM±RICO\ufffdÅ 3ENDOÅVAR\ufffd	ÅAÅ FUN¯«OÅ QUEÅ CALCULAÅ A VARIªNCIAÅ AMOSTRAL\ufffdÅ ENT«OÅ AÅ FUN¯«OÅPARAÅCALCULARÅOÅERRO
PADR«OÅDAÅM±DIA\ufffd PODEÅSERÅDEFINIDAÅPELAÅEXPRESS«O\ufffd\ufffd!\ufffdHUURSDGUDR\ufffd\ufffd\ufffd IXQFWLRQ\ufffd[\ufffd^VTUW\ufffdYDU\ufffd[\ufffd\ufffdOHQJWK\ufffd[\ufffd\ufffd`!GORAÅBASTAÅAPLICARÅAÅFUN¯«OÅERROPADRAO\ufffd	 COMOÅARGUMENTOÅ¨ÅFUN¯«OÅTAPPLY\ufffd	\ufffd!\ufffdHUURS\ufffd\ufffd\ufffd WDSSO\\ufffdUHQGLPHQWR\ufffd\ufffdISURYLQFLD\ufffd\ufffdHUURSDGUDR\ufffd/SÅVALORESÅCALCULADOSÅS«O\ufffd!\ufffdHUURSALGÅÅÅÅÅÅÅÅÅÅALTÅÅÅÅÅÅÅÅ BA BBÅÅÅÅÅÅÅÅÅÅÅÅBLÅÅÅÅÅÅÅÅÅÅÅÅMIN RIBÅÅÅÅÅÅÅÅÅÅÅÅTMDÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdÅÅÅÅ\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd#OMOÅEXERCµCIO\ufffdÅPODEÅCALCULARÅOÅINTERVALOÅDEÅCONFIAN¯AÅAÅ\ufffd\ufffd\ufffdÅPARAÅAÅM±DIAÅDOSÅRENDIMENTOSÅPORÅ PROVµNCIA\ufffdÅ 0ARAÅ TAL\ufffdÅ PODEÅ USARÅ AÅ FUN¯«OÅ TAPPLY\ufffd	\ufffdÅ AÅ FUN¯«OÅ LENGTH\ufffd	 PARAÅ CALCULARÅ OSÅTAMANHOSÅ AMOSTRAIS\ufffdÅ EÅ AÅ FUN¯«OÅ QT\ufffd	 PARAÅ OBTERÅ OSÅ QUANTISÅ DASÅ DISTRIBUI¯¼ESÅ T DEÅ 3TUDENTÅCORRESPONDENTES\ufffd!Å FUN¯«OÅ TAPPLY\ufffd	 PODEÅ USAR
SEÅ PARAÅ APLICARÅ UMAÅ FUN¯«OÅ AÅ UMÅ VECTOR INDEXADOÅ PORÅDIFERENTESÅ CATEGORIASÅ SIMULTANEAMENTE\ufffdÅ 0ORÅ EXEMPLO\ufffdÅ PODEÅ INTERESSARÅ DIVIDIRÅ AÅ AMOSTRAÅ PORÅESTADOÅOUÅPORÅSEXO\ufffdÅ/SÅELEMENTOSÅDOÅVECTORÅV«OÅSERÅAGRUPADOSÅEMÅSUB
AMOSTRASÅCORRESPONDENTESÅÅ¨SÅ DISTINTASÅ CATEGORIASÅ OUÅ NµVEIS\ufffdÅ EÅ AÅ FUN¯«OÅ ±Å APLICADAÅ AÅ CADAÅ UMAÅ DESTASÅ SUB