ifelse command problem

I want to multiply regression result (pi is below) with variables/column for each observation.

this is pi:
dF/dx P>|z|
HizmetSuresi -0.06630969 0.000000e+00
SikayetSayisi 0.02506111 2.142303e-03
TeknikDestekTalebi -0.06455769 9.466772e-17
MobilDataKullanimi -0.33180028 3.543198e-45
IndirimOrani -0.51907675 0.000000e+00

if p value (P>|z|) is lower than 0.05 percent, which means that variable is statistically significant in this model, marjinal effect / dF/dx is gonna be multiplied with relevant column/variable. if not, it's gonna be multiplied with 1 that it does not change the value of column)

where do i make mistake in the ifelse commands? i dont understand. if you help me, i welcome a lot!

res<-probitmfx(formula=CHURN~ HizmetSuresi+SikayetSayisi+TeknikDestekTalebi+MobilDataKullanimi+IndirimOrani
,data = a,
atmean = TRUE, robust = FALSE, clustervar1 = NULL,
clustervar2 = NULL, start = NULL, control = list())




This is not an appropriate place to use ifelse() because you do not want to iterate along pi, you want to take an action if a single element of pi is less than 0.05. The logic of what you want is

if (pi[1,2] < 0.05) a$HizmetSuresi <- a$HizmetSuresi*pi[1,1]
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.