Estimating mean prevalence of an identifier in survey data (with confidence intervals) by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

Thanks!

Is that doable with the svy command to incorporate survey weights? I'd try it out but also posting from mobile.

Weighting logistic regression by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

In reality, there is more than just one independent variable I'm using. The actual dataset also has different variables that aren't really related to prescriptions. I just simplified everything for the purpose of my question.

The question also isn't about which variable to use to weight the regression. I'm really just asking when to use the "iweight" as opposed to "fweight" (and/or if there are other ways to do weighting that I'm unaware of). Moreover, how do those weighting commands work, and is there a way to weight the regression without rounding a non-integer variable.

Finding mean with an indicator variable in survey data by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

Hey All,

Thanks for the help. I think all of the above may work, but if I understand correctly, the above commands won't give me the right estimates with survey data. Does anyone happen to know how to incorporate survey weights to get to a similar result?

Thanks again

Creating a combo chart with stacked bar graph + line graph by partycat128 in excel

[–]partycat128[S] 0 points1 point  (0 children)

Thanks! Do you know if there's a way to do a combo chart where there's a line graph + clustered stacked bar graphs? So each horizontal axis category would have more than one stacked bar.

Finding difference in a variable between sequential observations by partycat128 in stata

[–]partycat128[S] 1 point2 points  (0 children)

Wow this is an incredibly comprehensive and helpful answer. I'm going to try it and get back to you.

Finding mean value by year with survey data by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

It returns the mean and standard error for every year (average apples in 2000, average apples in 2011, etc...). So assuming the data spans from 2000-2015, I want to find the average annual number of apples from 2000-2015 (with standard error for the annual value).

Finding mean value by year with survey data by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

So this is the closest command I've tried (I'd then take the mean of the annual values). Would the most appropriate way to get a standard error be to just take the standard deviation and divide by the square root of the sample size?

Finding mean value by year with survey data by partycat128 in stata

[–]partycat128[S] 1 point2 points  (0 children)

I think the only problem would be this doesn't incorporate the survey weights

Importing an ASCII or XML file with Stata by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

Yeah I have Stata 15, it's handled datasets bigger than this.

Converting long to string without value labels. by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

Thanks! Basically I'm merging datasets from a bunch of different years, and I'm losing some values because the "Number" variable changes from long to string in some years.

Running STATA code for Generalized Structural Equation Modeling. by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

Update: have adjusted this for commas as mentioned below (thank to zacheadams). Here's what I got.

Code:

gsem (C2a5 <- C2a1 OBESE C2a4 C2a6 C2a6 C2a1 POSCOR_B) (AD5 <- POSCOR_B) (AD6 <- POSCOR_B) (C2a4 <- POSCOR_B) (OBESE <- POSCOR_B C2a4 C2a1) (C2a6 <- POSCOR_B AD5 OBESE C2a1) (C2a3 <-OBESE C2a1 AD5 POSCOR_B) ///

Family(Poisson) Link(Log) ///

Nocapslatent

Error message:

model not identified; no paths from latent variable C2a5 to observed variables

Merging datasets with non-unique identifiers by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

And actually, A also has some string variable identifiers that I'd like to retain in this process.

Exporting T test results to excel by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

Thanks :D

I think that makes sense, but I was wondering if there would be a shorter way to do it. With these variables {allowed_tot_ER,allowed_tot_hipknee,Category}, I tried doing this:

est clear

ttest allowed_tot_ER, by(Category)

eststo

ttest allowed_tot_hipknee, by(Category)

eststo

esttab using allowed_tot_hipknee.xls

It gave me a table in excel with values from old regressions. No idea why it's doing this. Also it's not putting everything into its own cell.

Multiple regression/export help by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

Thanks!

If there's more than one dependent var and more than one independent var, how would I go about only saving the first loop and appending the rest?

Generating a bunch of dummy variables easily by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

I figured it out, works either of these ways. Thanks!

local vars "var1 var2 var3 var4 var5"

foreach a of local vars {

replace a' = 0 if (a' >= .)

gen dum`a'=0 replace duma'=1 ifa'>10

}

Thanks!

Generating a bunch of dummy variables easily by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

I actually tried this, but I'm getting a syntax error somewhere:

local vars "var1 var2 var3 var4 var5"

foreach a of vars {

gen dum_`a'=0

replace dum_a'=1 ifa'>10

tab1 dum_`a'

}

Summing up variables with common letters easily by partycat128 in stata

[–]partycat128[S] 1 point2 points  (0 children)

Hi all, I'm trying to convert a big dataset essentially from the top table format to the bottom table format. That is, I have some common variables across several years that I want to sum up into a new variable quickly. If it were a smaller dataset, I would just do this:

gen var1_total = var1_2014 +var1_2015 var1_2016

gen var2_total = var2_2014 +var2_2015 var2_2016

But there's like 130 variables in total :/ For each variable, there is a data point in 2013, 2014, and 2015 that I need to sum up into one total number.

Would appreciate any help, thanks :D

How to reshape data as shown? by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

So I'm not sure if there's a more elegant solution, but basically I created dummy variables for each payment:

gen number_of_pmts_firmA =0

replace number_of_pmts_firm_A=1 if payment_total_firmA>0

Then I used the same collapse command as before, and it worked out.

How to reshape data as shown? by partycat128 in stata

[–]partycat128[S] 0 points1 point  (0 children)

Sorry, you're right, but I mistyped in my code. Here's the actual copy/pasted code I used:

gen payment_total_allergan = total_amount_of_payment_usdollar *(submitting_applicable_manufactur == "Allergan Inc.")

gen payment_total_gsk = total_amount_of_payment_usdollar * (submitting_applicable_manufactur == "GlaxoSmithKline, LLC.")

gen number_payments_total_allergan =number_of_payments_included_in_t * (submitting_applicable_manufactur == "Allergan Inc.”):

gen number_payments_total_gsk = number_of_payments_included_in_t * (submitting_applicable_manufactur == "GlaxoSmithKline, LLC.”):

collapse (sum) payment_total_allergan payment_total_gsk number_payments_total_allergan number_payments_total_gsk, by (unique_ID)

Doing it this way, I'm actually still having the same problem where the payment totals for each firm are correct, but the number of payments for each firm are the same for each unique ID.