문자를 포함하는 고유 식별자와 함께 xtreg 사용 (Using xtreg with unique identifier that includes letters)


문제 설명

문자를 포함하는 고유 식별자와 함께 xtreg 사용 (Using xtreg with unique identifier that includes letters)

내 패널 데이터 세트로 회귀를 실행하려고 합니다.

상태 고정 효과를 설명하고 약간 이상한 식별자로 작업하려고 합니다.

내 분석 단위는 유틸리티 ID와 state로 구성된 복합 고유 식별자를 생성한 상태의 유틸리티입니다.

따라서 내 데이터는 다음과 같습니다.

unique_id     ownership   amiratio   popd
10570AL       REC         .45        3430
4032CA        IOU         .85        4350

그러나 xtset은(는) 식별자의 문자를 좋아하지 않습니다.

내가 의도한 회귀는 아래와 같습니다.

6
xtreg amiratio ownership ownership#popd, fe vce(cluster i.state) 

어떻게 해야 하나요? 이 회귀를 실행하기 위해 내 고유 ID를 올바른 형식으로 가져오시겠습니까?


참조 솔루션

방법 1:

The encode command can be used for this purpose:

clear
input str10 unique_id str3 ownership amiratio popd
10570AL REC .45 3430
4032CA IOU .85 4350
end

encode unique_id, generate(wanted)

This converts a string variable to numeric with value labels matching the strings:

list unique_id wanted, abbreviate(10)

     +‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑+
     | unique_id    wanted |
     |‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑|
  1. |   10570AL   10570AL |
  2. |    4032CA    4032CA |
     +‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑+

list unique_id wanted, abbreviate(10) nolabel

     +‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑+
     | unique_id   wanted |
     |‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑|
  1. |   10570AL        1 |
  2. |    4032CA        2 |
     +‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑+

Using xtset with wanted will work in contrast with unique_id:

xtset unique_id
string variables not allowed in varlist;
unique_id is a string variable
r(109);

xtset wanted
     panel variable:  wanted (balanced)

(by GentilmanMylesuser8682794)

참조 문서

  1. Using xtreg with unique identifier that includes letters (CC BY‑SA 2.5/3.0/4.0)

#panel #stata






관련 질문

R을 사용하여 패널 데이터의 마지막 이벤트 이후 실행 계산 (Using R to count a run since last event in panel data)

버튼을 클릭한 후 한 패널을 표시하고 동일한 프레임에서 두 번째 버튼을 클릭하면 다른 패널을 표시합니다. (show one panel after button is clicked and other panel when second button is clicked in the same frame)

외부를 클릭하면 패널을 닫아야 함(초점 상실) (Need To Close A Panel When Clicked Outside (Lost Focus))

asp.net gridview - updatepanel을 사용하여 행당 여러 줄에 바인딩된 데이터 분산 (asp.net gridview - spread bound data across multi lines per row with updatepanel)

문자를 포함하는 고유 식별자와 함께 xtreg 사용 (Using xtreg with unique identifier that includes letters)

matlab SVM은 NaN을 반환합니다. (matlab SVM returns NaN)

특정 형식의 JAVA GUI 제작에 대한 질문 (Question about making a JAVA GUI of a certain format)

슬라이딩 패널 구분선을 사용하여 HTML 페이지를 다른 섹션으로 분할하시겠습니까? 어떻게 이루어지나요? (Splitting HTML page into different sections using sliding panel dividers? How is it done?)

Swift Mac Os 응용 프로그램 - NSSavePanel이 '백그라운드 전용' 응용 프로그램에서 올바르게 작동하지 않습니다. (Swift Mac Os Application - NSSavePanel does not behave correctly with a 'background only' application)

Python 저주 update_panels() 및 Panel.move() 문제 (Python Curses update_panels() and Panel.move() issues)

stargazer를 사용하여 plm FE 회귀에서 전체 R2를 얻는 방법은 무엇입니까? (How to get between and overall R2 from plm FE regression with stargazer?)

Java, 패널용 그래픽 개체 생성 및 편집? (Java, create and edit a Graphics Object for Panel?)







코멘트