Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bivariate probit model with Panel structure

    Dear all,

    I want to estimate 2 equations using bivariate probit model . The problem is that I'm dealing with Panel data and while searching, I find that (biprobit) command can not be used with panel structure. Any idea about the code on Stata, which takes into account the panel structure using bivariate probit model ?

    Thanks you in advance


  • #2
    You might look into trying something like that illustrated below. It's an extension of what is illustrated in this post. Start at the "Begin here" comment.

    .ÿversionÿ15.1

    .ÿ
    .ÿclearÿ*

    .ÿ
    .ÿsetÿseedÿ`=strreverse("1443164")'

    .ÿ
    .ÿquietlyÿsetÿobsÿ250

    .ÿgenerateÿintÿpidÿ=ÿ_n

    .ÿgenerateÿdoubleÿpid_uÿ=ÿrnormal(0,ÿsqrt(0.75))

    .ÿ
    .ÿquietlyÿexpandÿ10

    .ÿbysortÿpid:ÿgenerateÿbyteÿtimÿ=ÿ_n

    .ÿdrawnormÿlat1ÿlat2,ÿdoubleÿcorr(1ÿ0.5ÿ\ÿ0.5ÿ1)

    .ÿ
    .ÿforvaluesÿiÿ=ÿ1/2ÿ{
    ÿÿ2.ÿÿÿÿÿÿÿÿÿquietlyÿsummarizeÿlat`i'
    ÿÿ3.ÿÿÿÿÿÿÿÿÿquietlyÿreplaceÿlat`i'ÿ=ÿ(lat`i'ÿ-ÿr(mean))ÿ/ÿr(sd)
    ÿÿ4.ÿÿÿÿÿÿÿÿÿgenerateÿbyteÿout`i'ÿ=ÿrbinomial(1,ÿnormal(pid_uÿ+ÿlat`i'))
    ÿÿ5.ÿ}

    .ÿ
    .ÿ*
    .ÿ*ÿBeginÿhere
    .ÿ*
    .ÿgsemÿ///
    >ÿÿÿÿÿÿÿÿÿ(out1ÿ<-ÿi.timÿM[pid]@1)ÿ(out1@1ÿ<-ÿF1)ÿ///
    >ÿÿÿÿÿÿÿÿÿ(out2ÿ<-ÿi.timÿM[pid]@1)ÿ(out2@1ÿ<-ÿF2),ÿ///
    >ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿfamily(binomial)ÿlink(probit)ÿ///
    >ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿvariance(F1@1ÿF2@1)ÿcovariance(F1*F2)ÿ///
    >ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿnocnsreportÿnodvheaderÿnolog

    GeneralizedÿstructuralÿequationÿmodelÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿÿÿÿÿ=ÿÿÿÿÿÿ2,500
    Logÿlikelihoodÿ=ÿ-3155.9006

    ------------------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿCoef.ÿÿÿStd.ÿErr.ÿÿÿÿÿÿzÿÿÿÿP>|z|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
    -------------+----------------------------------------------------------------
    out1ÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿtimÿ|
    ÿÿÿÿÿÿÿÿÿÿ2ÿÿ|ÿÿ-.2357913ÿÿÿ.1683681ÿÿÿÿ-1.40ÿÿÿ0.161ÿÿÿÿ-.5657867ÿÿÿÿÿ.094204
    ÿÿÿÿÿÿÿÿÿÿ3ÿÿ|ÿÿ-.0845516ÿÿÿ.1679551ÿÿÿÿ-0.50ÿÿÿ0.615ÿÿÿÿ-.4137376ÿÿÿÿ.2446344
    ÿÿÿÿÿÿÿÿÿÿ4ÿÿ|ÿÿ-.2000092ÿÿÿ.1687653ÿÿÿÿ-1.19ÿÿÿ0.236ÿÿÿÿ-.5307831ÿÿÿÿ.1307647
    ÿÿÿÿÿÿÿÿÿÿ5ÿÿ|ÿÿ-.0888489ÿÿÿ.1684533ÿÿÿÿ-0.53ÿÿÿ0.598ÿÿÿÿ-.4190114ÿÿÿÿ.2413135
    ÿÿÿÿÿÿÿÿÿÿ6ÿÿ|ÿÿ-.0242496ÿÿÿ.1689307ÿÿÿÿ-0.14ÿÿÿ0.886ÿÿÿÿ-.3553476ÿÿÿÿ.3068484
    ÿÿÿÿÿÿÿÿÿÿ7ÿÿ|ÿÿ-.1667478ÿÿÿ.1693017ÿÿÿÿ-0.98ÿÿÿ0.325ÿÿÿÿ-.4985731ÿÿÿÿ.1650775
    ÿÿÿÿÿÿÿÿÿÿ8ÿÿ|ÿÿ-.2085232ÿÿÿ.1686991ÿÿÿÿ-1.24ÿÿÿ0.216ÿÿÿÿ-.5391675ÿÿÿÿÿ.122121
    ÿÿÿÿÿÿÿÿÿÿ9ÿÿ|ÿÿ-.2088483ÿÿÿ.1684111ÿÿÿÿ-1.24ÿÿÿ0.215ÿÿÿÿ-.5389279ÿÿÿÿ.1212313
    ÿÿÿÿÿÿÿÿÿ10ÿÿ|ÿÿ-.0531784ÿÿÿÿ.168933ÿÿÿÿ-0.31ÿÿÿ0.753ÿÿÿÿÿ-.384281ÿÿÿÿ.2779243
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿM[pid]ÿ|ÿÿÿÿÿÿÿÿÿÿ1ÿÿ(constrained)
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿÿF1ÿ|ÿÿÿÿÿÿÿÿÿÿ1ÿÿ(constrained)
    ÿÿÿÿÿÿÿ_consÿ|ÿÿÿ.1776282ÿÿÿ.1309046ÿÿÿÿÿ1.36ÿÿÿ0.175ÿÿÿÿÿÿ-.07894ÿÿÿÿ.4341965
    -------------+----------------------------------------------------------------
    out2ÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿtimÿ|
    ÿÿÿÿÿÿÿÿÿÿ2ÿÿ|ÿÿ-.3030561ÿÿÿ.1686316ÿÿÿÿ-1.80ÿÿÿ0.072ÿÿÿÿÿ-.633568ÿÿÿÿ.0274557
    ÿÿÿÿÿÿÿÿÿÿ3ÿÿ|ÿÿ-.1228088ÿÿÿ.1687937ÿÿÿÿ-0.73ÿÿÿ0.467ÿÿÿÿ-.4536383ÿÿÿÿ.2080207
    ÿÿÿÿÿÿÿÿÿÿ4ÿÿ|ÿÿ-.2672512ÿÿÿ.1686184ÿÿÿÿ-1.58ÿÿÿ0.113ÿÿÿÿ-.5977372ÿÿÿÿ.0632347
    ÿÿÿÿÿÿÿÿÿÿ5ÿÿ|ÿÿ-.1588312ÿÿÿ.1686773ÿÿÿÿ-0.94ÿÿÿ0.346ÿÿÿÿ-.4894325ÿÿÿÿ.1717702
    ÿÿÿÿÿÿÿÿÿÿ6ÿÿ|ÿÿ-.0827164ÿÿÿ.1694265ÿÿÿÿ-0.49ÿÿÿ0.625ÿÿÿÿ-.4147862ÿÿÿÿ.2493534
    ÿÿÿÿÿÿÿÿÿÿ7ÿÿ|ÿÿ-.2219035ÿÿÿ.1695638ÿÿÿÿ-1.31ÿÿÿ0.191ÿÿÿÿ-.5542425ÿÿÿÿ.1104355
    ÿÿÿÿÿÿÿÿÿÿ8ÿÿ|ÿÿ-.2118125ÿÿÿ.1692297ÿÿÿÿ-1.25ÿÿÿ0.211ÿÿÿÿ-.5434966ÿÿÿÿ.1198716
    ÿÿÿÿÿÿÿÿÿÿ9ÿÿ|ÿÿ-.2179697ÿÿÿ.1692644ÿÿÿÿ-1.29ÿÿÿ0.198ÿÿÿÿ-.5497218ÿÿÿÿ.1137824
    ÿÿÿÿÿÿÿÿÿ10ÿÿ|ÿÿ-.0470109ÿÿÿ.1682005ÿÿÿÿ-0.28ÿÿÿ0.780ÿÿÿÿ-.3766778ÿÿÿÿÿ.282656
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿM[pid]ÿ|ÿÿÿÿÿÿÿÿÿÿ1ÿÿ(constrained)
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿÿF2ÿ|ÿÿÿÿÿÿÿÿÿÿ1ÿÿ(constrained)
    ÿÿÿÿÿÿÿ_consÿ|ÿÿÿ.2125296ÿÿÿ.1314688ÿÿÿÿÿ1.62ÿÿÿ0.106ÿÿÿÿ-.0451445ÿÿÿÿ.4702036
    -------------+----------------------------------------------------------------
    ÿÿvar(M[pid])|ÿÿÿ.7217052ÿÿÿ.0888341ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ.5670041ÿÿÿÿÿ.918615
    ÿÿÿÿÿÿvar(F1)|ÿÿÿÿÿÿÿÿÿÿ1ÿÿ(constrained)
    ÿÿÿÿÿÿvar(F2)|ÿÿÿÿÿÿÿÿÿÿ1ÿÿ(constrained)
    -------------+----------------------------------------------------------------
    ÿÿÿcov(F1,F2)|ÿÿÿ.5003991ÿÿÿÿ.067701ÿÿÿÿÿ7.39ÿÿÿ0.000ÿÿÿÿÿ.3677076ÿÿÿÿ.6330906
    ------------------------------------------------------------------------------

    .ÿÿÿÿÿÿÿÿÿ
    .ÿexit

    endÿofÿdo-file


    .


    When you set up models like this in gsem, you have to make a rather strong assumption about what the data-generating process looks like. It's not obvious to me how you'd divine this, which is one reason why I was reluctant to suggest much more than what you'd get with, say, suest when a couple of related questions arose this past month (here and here).

    Comment

    Working...
    X