Learn R Programming

PathSelectMP (version 1.1)

CalculatRiskRatios: Calculate Risk Ratios from Direct Effects

Description

calculates risk ratios from direct effects for each imputed data set path analyssi or just one data set path analysis if no imputations

Usage

CalculatRiskRatios(AllDat, NADes, Directry = getwd(), WhichCat, WhichRiskCalc)

Arguments

AllDat

output from ConvertData2

NADes

a one element vector containing a string which is the missing value designation

Directry

the working directory or the path where the folder for backward selection is located

WhichCat

list length of number of variables in initial data with 1 specifying variable is categorical and 0 specifying variable is continuous

WhichRiskCalc

list length of number of variables in initial data with 1 specifying use default for risk ratio calculation which is to calculate a risk ratio for all category levels compared to the lowest level and include an averaging over all of these levels when calculating other variable risk ratios and if variable is continuous 1 specifies using average of all values for variable compared to zero. Otherwise a list can be given to specify which values to use for the risk ratios which are averaged over when calculated risk ratios for other variables.

Value

A dataframe where the row names are dependent variables and the columns are independent variables with the corresponding risk ratios.

Details

if there is more than one threshold value for a categorical dependent variable the calculations are performed for all thresholds according to M Plus Manual Chapter 14 on probit calculations

References

M Plus method WLSMV

Examples

Run this code
# NOT RUN {
InitD=Simulate(MissingYN=1)
xxx=Initialize(InitD,NumImpute=3,WhichCat=c(1,1,1,1,0))
ggg=AllBackwardSelect(xxx[[1]])
yyy=AllSummary2(xxx[[1]])
AllDat1=ConvertData2(xxx[[1]],xxx[[2]],yyy[[1]])
wwwA=lapply(AllDat1,CalculatRiskRatios,NADes=c(-99),WhichCat=c(1,1,1,1,0),WhichRiskCalc=c(0,
list(c(0,1,2)),list(c(0,1,2,4)),list(c(0,1,2)),0))
# }

Run the code above in your browser using DataLab