This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Data analysis project - carry out an IPTW causal analysis | |
| install.packages("tableone") | |
| install.packages("Matching") | |
| install.packages("ipw") | |
| install.packages("survey") | |
| install.packages("MatchIt") | |
| library(tableone) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics" | |
| Copyright (C) 2022 The R Foundation for Statistical Computing | |
| Platform: aarch64-apple-darwin20 (64-bit) | |
| R is free software and comes with ABSOLUTELY NO WARRANTY. | |
| You are welcome to redistribute it under certain conditions. | |
| Type 'license()' or 'licence()' for distribution details. | |
| Natural language support but running in an English locale |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ################### | |
| #RHC Example | |
| #install packages (if needed) | |
| install.packages("tableone") | |
| install.packages("ipw") | |
| install.packages("sandwich") | |
| install.packages("survey") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ################### | |
| #RHC Example | |
| #install packages | |
| install.packages("tableone") ## useful when you're doing a matched analysis. | |
| install.packages("Matching") ## carry out the actual matching. | |
| #load packages | |
| library(tableone) | |
| library(Matching) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # *----------------------------------------------------------------- | |
| # | PROGRAM NAME: ex matching.py | |
| # | DATE: 6/25/21 | |
| # | CREATED BY: MATT BOGARD | |
| # | PROJECT FILE: | |
| # *---------------------------------------------------------------- | |
| # | PURPOSE: very basic matching and IPTW analysis with balance diagnostics | |
| # *---------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def maxProfit(self, prices: List[int]) -> int: | |
| # buy and then sell. | |
| # sol 1: | |
| # time O(n) space O(1) | |
| if not prices: | |
| return 0 | |
| buy_price = float('inf') | |
| max_profit = 0 | |
| for p in prices: # O(n) | |
| if buy_price < p: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def merge_two_arrays_3(a,b): ## len_a=n, len_b=m, m>n | |
| # n is length of a; m is length of b | |
| # time O(m+n) space O(n+m) | |
| from collections import deque # first in first out | |
| da = deque(a) | |
| db = deque(b) | |
| res = [] | |
| while len(da) or len(db): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Mon Sep 23 23:16:44 2017 | |
| @author: Marios Michailidis | |
| This is an example that performs stacking to improve mean squared error | |
| This examples uses 2 bases learners (a linear regression and a random forest) | |
| and linear regression (again) as a meta learner to achieve the best score. | |
| The initial train data are split in 2 halves to commence the stacking. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://ideone.com/7RLpDt | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| void Print_Array(int * array, int array_size){ | |
| for (int i = 0; i < array_size; ++i) | |
| { | |
| if(i == (array_size-1)){ | |
| printf("%d \n", array[i]); | |
| } else { |