Learn R Programming

intsvy (version 2.9)

pirls.reg: Regression analysis

Description

pirls.reg performs linear regression analysis (OLS) for an observed depedent variable (NOT for plausible values)

Usage

pirls.reg(y, x, by, data, export = FALSE, 
name = "output", folder = getwd())

Value

pirls.reg prints a data.frame with regression results (i.e., coefficients, standard errors, t-values, R-squared) and stores different regression output including residuals and replicate coefficients in a list object of class "intsvy.reg".

Arguments

y

Label for dependent variable

x

Data labels of independent variables (e.g., x = c("ASDHEHLA", "ITSEX") ).

by

The label for the grouping variable, usually the countries (i.e., by="IDCNTRYL"), but could be any other categorical variable.

data

An R object, normally a data frame, containing the data from PIRLS.

export

A logical value. If TRUE, the output is exported to a file in comma-separated value format (.csv) that can be opened from LibreOffice or Excel.

name

The name of the exported file.

folder

The folder where the exported file is located.

See Also

timss.reg

Examples

Run this code
if (FALSE) {

# Recode ASBGBOOK
table(as.numeric(pirls$ASBGBOOK), pirls$ASBGBOOK)
pirls$BOOK[as.numeric(pirls$ASBGBOOK)==1] <- 5
pirls$BOOK[as.numeric(pirls$ASBGBOOK)==2] <- 18
pirls$BOOK[as.numeric(pirls$ASBGBOOK)==3] <- 63
pirls$BOOK[as.numeric(pirls$ASBGBOOK)==4] <- 151
pirls$BOOK[as.numeric(pirls$ASBGBOOK)==5] <- 251
table(pirls$BOOK)

pirls.reg(y= "BOOK", x= "ITSEX", by="IDCNTRYL", data=pirls)
}

Run the code above in your browser using DataLab