http://www.proaudiostar.com/gator-gpb-lak-1-black-aluminum-pedal-board-small-w-arry-bag.html

Skip to content
# My Statistical Tool box

## Posts

### Gator Cases GPB-LAK-1 Small Aluminum Pedal Board w/ Carry Bag

### How to derive the logit intercept value from %

### Adult and Community Education

### library(openintro)

### 「オブジェクト指向」を逆から解説してみる

### https://www.glowe.com/

### IDSS Distinguished Speaker Seminar with Kosuke Imai (Harvard University) - May 7, 2019

### Why are questions no longer being accepted from my account?

### R question

### R, basic function

Statsitics, Research Methods, SAS, HLM, Rasch model

**I use this a lot to convert a logit coefficient (from a logistic regression model) to a probability.**

p=exp(X) / (1+ exp(X))

This time I wanted to convert a probability (from the control group) into a logit.

**I put X on the left side.**

X= log( -p / (p-1)

This means that if I know the probability of a successful outcome occurance of the comparison group, I can get the logit intercept for the logistic regression model where only the treatment status was a predictor. (I can use this to create a graph).

**I tested this using a dataset. Based on a data, I know the probability of a failure was 0.6214286.**

data x;

per= 0.6214286;

intercept_derived=log((-1*per)/(per-1));

run;

I tested if I get the value for the intercept using the logistic regression. I did.

proc logistic data=temp descending;

model Y1_to_Y2_persistence=treat_original;

run;

#these are exmple datasets

library(openintro)

data(hsb2)

str(hsb2)

https://www.glowe.com/

Someone gave me am example of how to write a simple function. This was great.

addition = function(num1,num2){

answer = num1+num2

return(answer)

}

addition(10,9)

addition(5,4)

However, when I tried to use it, I realized I want to use a text instead of a number in this way.

my_matching = function(dataname){

m.out1<-matchit(data=dataname,control~gpa,method="nearest",ratio=1,

m.order="random", caliper=0.25)

}

my_matching(ABC_data1x)

my_matching(ABC_data2x)

Could you advise how I can run this without an error?

Also, how about a case like this? I used $ and . to indicate which part has to be replaced but this is not R way (This would be in SAS).

my_matching = function(data_N){

m.out1<-

matchit(data=ABC_data&data_n.x,control~gpa,method="nearest",ratio=1,

m.order="random", caliper=0.25)

}

my_matching(1)

my_matching(2)

Thank you!

addition = function(num1,num2){

answer = num1+num2

return(answer)

}

addition(10,9)

addition(5,4)

Thanks Isaac!

**Use "" if dealing with a string.**

addition = function(x1){

x1 = 2+3

return(x1)

}

addition(”kaz”)

addition(”john”)