# Tag Info

0

Data imputation can be done using Mean imputation, Regression imputation, etc. I am using one such implementation for my problem. I am also looking into non-imputation methods. If i find one, i will let it be known.

2

Q1 Almost invariably yes, you should use te() for smooth interactions. The only situation where you might not want to do that is where you are smoothing in multiple dimensions but everything is in the same units, like space. In such circumstances an isotropic smooth may make sense via s(). Q2 My personal belief is that you should fit the full model and do ...

0

All standard errors are standard deviations of (the sampling distribution of) point estimates. Can you link the articles? Empirical and model-based are two different approaches to estimating standard errors. By "general linear model", I assume you mean ordinary least squares (OLS). With OLS, to obtain exact inference in finite samples, you make ...

0

It sounds like what those authors call the 'empirical standard error' is the same as what most people simply call the standard error. Your slope coefficient is a sample estimate of the population slope coefficient. If you drew another sample you get a different slope coefficient estimate. With many samples you would get a distribution of sample slope ...

0

The mediate function in the mediation package takes only a binary mediator or a numeric mediator. In your case, it seems that your mediator is categorical but contains more than 2 levels. You can either convert it to numeric or dummy code it.

0

I don't have a fully satisfactory answer, but it may be helpful. If you really want to understand the details, you may want to step through the source code of forecast.Arima() (note the capital A). Your arima() call fits an ARIMA(0,1,0)(0,0,1)[12] model. The formula for this model is $$(1-B)y_t = (1-\Theta B^{12})\epsilon_t,$$ where $B$ indicates the ...

3

Nice question! Here are some hints to get you started. Your questions are not numbered well (question 2 appears twice), so you may want to renumber them to avoid confusion. Question 1 The general rule is that you would use an isotropic smooth s(x, cov1) if x and cov1 had the same units and you would use an anisotropic smooth te(x, cov1) if x and cov1 had ...

2

They are not equivalent, because when you leave everything together, you use all the data to estimate the error SD. Another way to look at it is that the EMMs are based on the model you fitted, and when you fit a different model, you get different results. When you keep all the data together in the one model, the one you show has an underlying assumption ...

2

The rma.uni() function doesn't allow you to add random effects (beyond the estimate-level random effects that are automatically added). You should look into the rma.mv() function, which provides full control over the random effects that can added. See here for the documentation of the function: https://wviechtb.github.io/metafor/reference/rma.mv.html and the ...

0

The zero value is not causing the error; setting y_t[30] to any other numeric value yields the same error. You supplied a matrix to the y argument, that causes the error. E.g., try: class(y_t) class(y_t[-30]) sample_lasso <- train(method = "glmnet", x = x_t, y = y_t[ , 1]) # works as expected As an aside, make sure to set the random seed before ...

0

You don't have to adjust residual error by volatility, since you can remove cluster volatility in the log price returns using a GARCH model before running any kind of regression. Below is a plot of volatility over time, $\sigma(t)$, as well as the SP500 log price returns with cluster volatility removed (red line). Be sure to always use the log price ...

0

You have to use matrix operators. Instead of *, use %*%, it should work fine. Also, you can replace int simply by 1 In cbind.

0

I would partition the ~400 patients with duplicates into their own analysis, since the remaining data set will have ~1200 subjects that don't have duplicates. Nearly three times as many subjects don't have repeated outcomes, and therefore the bulk of your analysis doesn't involve longitudinal outcomes. If your focus is solely on the ~400 with duplicates, ...

0

It's not a huge problem in your case. The best I can find on it is p.330-331 of this guide by Simon Wood. Because the edf is way below the basis dimension I don't see it as a problem (quote from Wood on page 331: "The...test still gives a low p-value, but since the edf is...below the basis dimension, and increasing the basis dimension barely changes the ...

0

Conditional logistic regression is not a model that's been widely developed in a lot of software packages, and requiring results for screening diagnostics such as sens/spec from conditional is more problematic. For your first question, yes you could implement a cluster variable to represent each cluster of a case and its controls, and then adjust a regular ...

0

I would use $x_{ij}$ and $\beta_j$ and ensure that all the hospital dummies are the model, the time dummies, and all their interactions. You are trying to frontload everything into one model, however, and it may work out that a "divide and conquer" approach to break up a large problem in order to solve easier smaller ones may be a better approach. ...

1

The formula cobalt uses is the same as that used for point treatments, i.e., the formula you gave. It treats each time period as a point treatment. There is no special way to calculate standardized mean differences for longitudinal treatments. Can you demonstrate how you are attempting to replicate the values cobalt produces? There is a literature on ...

0

Yes, you don't need two dummy indicator variables (0,1) to denote a binary variable, just one. If you regress weight on only the female_gender(0,1) variable, and specify that no constant term or y-intercept is to be determined, you should obtain two coefficients, each of which will be the average weight of females and average weight of males. The typical ...

1

It think you could be interested in this paper. Basically, I think it is up to you to decide what model is better. Complete reference : Lorah, J. A. (2020). Interpretation of main effects in the presence of non-significant interaction effects. The Quantitative Methods for Psychology, 16(1), 33-45. https://doi.org/10.20982/tqmp.16.1.p033

0

This answer is based on this link, answer by @jay.sf. Although it runs, I am not completely sure whether this would be correct. I would be very happy if someone could comment (or check). set.seed(2) sandbox$Group <- as.factor(sandbox$Group) reduced.form <- polr(Group ~ z + random_variable + year, data=sandbox) consistent.glm <- glm(y ~ Group + ...

2

You need to code Seasons, Holiday, and Functioning_day as factors, but your data.frame() is resulting in character vectors for those variables: > str(x.new) 'data.frame': 1 obs. of 14 variables: $Rainfall : num 0$ Snowfall : num 0 $Day : num 31$ Month : num 4 $Year : num 2018$ Functioning_Day: chr &...

0

Do I always have to include time fixed effects or is there also a good reason not to include them? No. The first model includes state effects, which adjust for factors that differ across states but are constant over time. The second model introduces the time effects, which now adjust for any unobserved factors that change over time but are constant across ...

0

The summary looks far from correct, but I can't find my mistakes, what did I do wrong? It doesn't appear you did anything wrong. Software simply dropped the redundant regressors. In your setting, it shouldn't affect the difference-in-differences coefficient. First, the panel unit is the individual. And the individual is observed over time. According to the ...

0

I'm a little rusty on my {lme4} syntax, but the specification you use there isn't estimating separate effects of a variance per site and a variance per block_id within site, at least as far as I can recollect. As such, I think the equivalent model in gam() is: m <- gam(response.var ~ site + year + s(block_id, bs = 're'), data = d, method = "REML"...

1

You can use the package sure (link), to calculate surrogate residuals with resids. The package is based on this paper, in the Journal of the American Statistical Association. library(sure) # for residual function and sample data sets library(MASS) # for polr function df1 <- df1 df1$x1 <- df1$x df1$x <- NULL df1$y <- df2$y df1$x2 <- df2$x df1$...

0

Thanks to everyone for the question and feedback. We are in the process of making some changes to address these issues. See the Github page for updates: https://github.com/jkropko/coxed. On the censoring problem, we followed some previously published papers' simulations with that decision primarily because it was simple and censoring was not the main focus ...

1

There is no difference. Both are correct (as can be seen by the fact that the outputs are the same). One treats the data as 10 Bernoulli data and the other treats them as 2 binomial data constituting, collectively, 10 Bernoulli trials.

1

Rationale for a paired design Dependent data actually provide a superior design for inferring conditional effects, such as change from baseline. While SES, demographics, etc. comprise the "standard" adjustments for non-conditional analyses, you are at an advantage with the design and model you are considering. Models for dependent data With ...

1

R isn't letting you do it, because it shouldn't be done. The interaction is represented by two variables; you need to retain both or neither. It doesn't matter if the p-value reported on the line associated with one of those variables is significant, as you will get different patterns of significance with the same data with different ways of specifying the ...

1

It is hard for non-R users to hack through that output to see what is going on and possibly not trivial even for R users. Focusing on fromit and total alone I note first very small samples (implying some greater caution in doing anything even a little complicated) but also approximate symmetry. This Stata output may not be exactly what you get in other ...

3

The function lm() does all the work as long as you specify that the variable is a factor (with as.factor() e.g.). Since gender is dichotomized you do not have to do this as it is already dichotomized (dummy). This code should work fine : data$educ.n = as.factor(data$educ.n) mod1<- lm(salary ~ hours + educ.n + gender, data = salary_data)

1

In your specific case Coefficients: (Intercept) log(x) 7.544 -2.268 In original $$y=7.544-2.268 \cdot \log(x)$$ therefore $$(7.544 - y)/2.268 = \log(x)$$ or $$\exp((7.544 - y)/2.268) = x$$

1

I don't have enough reputation to comment, but I've heard it referred to as calibration or inverse regression. Hope that gives you something to start.

1

I don't have enough reputation to comment, but see here. However, in most cases you could simply use the quantiles of the sample that you used to estimate the density.

2

Here, I'm going to reproduce example 3.1.1 in Su (2009) where he calculates 95% confidence intervals for the 99th quantile for the speed of light data from Michelson 1879. It basically boils down to implementing the formulas (4), (5) and (6) from Su (2009). In the following R code, I used the gld package to fit the generalized lambda distribution (FMKL). The ...

1

Whether or not the importances of gradient boosting are strongly influenced by randomness depends on the hyper-parameter configuration of the gradient boosting model. A gradient boosted model which uses random subsampling of features (or other randomized components) will estimate feature importances which vary to a greater or lesser degree upon repeated ...

0

If you look at EMM = emmeans(...) EMM@linfct Then each row of linfct has exactly the linear combination of coefficients that is used to obtain each estimate (on the logit scale).

2

The intensity of a point can be estimated by the number of points divided by the area of the window (survey region). In spatstat you estimate it by intensity(X) where X is the point pattern. It is not clear to me why you need the integral of the so-called O-ring statistic which is not standard in my field. We mention the statistic and its close connection to ...

0

As commented by other users, I needed to adjust the function to be arimafit_f = auto.arima(ts(kt_train_female, frequency = 12))

1

The referent level of a factor is chosen automatically if you don't specify (usually as it would appear in a sort()). With your output, it looks like you had 3 levels to genotype, and those would have been genotype.0, genotype.1, genotype.2. Since the first one is not shown, it was used as the referent. So your regression estimates for the first (non-...

2

Loess iteratively estimates the smoothing function. Part of the iteration involves a regression procedure to estimate the parameters of a smoothing spline as a predictive function. The option "degree" is the polynomial degree of the smoothing spline. As noted in the help file, family has to do with how the polynomial is estimated. With gaussian, ...

1

The fwildclusterboot R package implements a wild cluster bootstrap and allows for multiple fixed effects. The package is a port of the boottest package in Stata. fwildclusterboot accepts objects of type felm and fixest where multiple fixed effects are out-projected in the estimation stage. In the bootstrap inference stage, it converts all fixed effects to ...

1

This does get complicated. One option could be to use the lme function from the nlme package, which allows the inclusion of an autocorrelation structure to model time (or space) correlations. Example model for your data below. I've used corAR1(form=~1|Box), representing 1) an autocorrelation structure of order 1, 2) the order of the observations in the data ...

1

KW and Wilcoxon are rank-based tests. So you need to be able to reconstruct the ordering of the data values from then output. From the output you have, you seems not to be able to do that. There sre some posts at this site about testing and estimation using summary data. Have a look at Statistical test for two distributions where only 5-number summary is ...

2

If you do the equality of variance test for the purposes of assumptions of manova, you need to test the data on the scale you will use in the manova. Presumably (after what you told us) that is the square root scale.

1

I simulated some irrelevant data: library(lavaan) dat <- as.data.frame(mvrnorm(5e2, rep(0, 6), matrix(.25, 6, 6) + .75 * diag(6))) colnames(dat) <- c("X", "X2", "M1", "M2", "W", "Y") dat$X2 <- dat$X ^ 2 head(dat) # X X2 M1 M2 W Y # 1 -1....

1

I see two viable options in your case (there is probably many more). Option 1: Since you have data, you could use bootstrap to resample a,b,c,x,y instead of assuming that they are independent with their respectives means and standard deviations. This will preserve the properties of your data (covariances as you want, but distributions also). Option 2: If you ...

1

If the observed log-likelihood reads $$\sum_{g=1}^G \sum_{i=1}^{N_g} \log \sum_{k=1}^K q_k \varphi(y_{ig};\mu_{gk},\sigma_{gk})$$ the completed log-likelihood reads $$\sum_{g=1}^G \sum_{i=1}^{N_g} \sum_{k=1}^K z_{kig}\log \{q_k \varphi(y_{ig};\mu_{gk},\sigma_{gk})\}$$ where the $z_{kig}$'s are the component indicator variables. The E-function can thus be ...

0

Here are some tips: Always set the random seed to make it fully reproducible. Later, you'll be able to figure out what you did. I would create the matrix using rbind(), instead of cbind(), so that it's easier to see the matrix you are creating. Likewise, I add decimal places and spaces so that the values are aligned. That makes for a better gestalt, and ...

Top 50 recent answers are included