mardi 12 novembre 2019

I need to find the codes for running this exact regression of Stata in R. It has an if condition

This is the regression in Stata 1) reg infl infoprov access staff int_cso int_cor pom if sample==1 & io==4, robust

I tried in R to create subsets, but it gives me an error.

I create this subset df <- data.frame(mydata$sample,mydata$io)

df <- df[df$mydata.sample==1,]

df <- df[df$mydata.io==4,]

and then run the model like this fit <- lm(formula=infl~infoprov+access+staff+int_cso+int_cor+pom, data = mydata, subset=df) but it gives me error: "Error in [.default(xj, i) : invalid subscript type 'list'"

I dont know how to translate this regression in R, could you help me please.

Aucun commentaire:

Enregistrer un commentaire