RandiLGarcia / dyadr

r package for dyadic data analysis
21 stars 13 forks source link

simple_slopes() #12

Open RandiLGarcia opened 7 years ago

RandiLGarcia commented 7 years ago

See Dave's email on Jun 21. Can be used instead of re-centering.

RandiLGarcia commented 6 years ago

Setup

yay: model object (with summary?)

parti: partner effect in the analysis (could be actor and everything changes accordinging)

kk: number of the partner effect in yay

api: interaction effect in the analysis

jj: number of the interaction effect in yay

xmean: mean of predictor X

xsd: sd of predictor X

Simple Slopes

upp=parti+api(xmean+xsd)
lwer=parti+api
(xmean-xsd)

covpint = yay$varBeta[kk,jj] varp = yay$varBeta[kk,kk] varint = yay$varBeta[jj,jj]

Standard Error of the simple slopes

seupp = sqrt(varp + 2(xsd+xmean)covpint+(xsd+xmean)^2varint) selow = sqrt(varp + 2(-xsd+xmean)covpint + (-xsd+xmean)^2varint)

p value for the simple slope

plow = 2-2pnorm(abs((parti+api(xmean-xsd))/selow))